luci/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/ping.js
Hannu Nyman f7e5b56649 luci-app-statistics: Adjust UI defaults to match config file
Adjust the defaults shown in the LuCI user interface to match
the real default values in the default config file.

(If a plugin is disabled and config values get deleted from
the config file, user has been offered incorrect default
values from UI defaults when the plugin is later re-enabled.)

* dns: set br-lan as the interface
* email: socket in /var/run/collectd/ dir
* interface: set br-lan as the interface
* ping: TTL 127, interval 30
* rrdtool: 1hour as shortest period, 144 RRArows
* tcpconns: Do not monitor all, only 22 80
* unixsock: socket in /var/run/collectd/ dir

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-12-13 11:23:09 +02:00

43 lines
1.2 KiB
JavaScript

'use strict';
'require baseclass';
'require form';
return baseclass.extend({
title: _('Ping Plugin Configuration'),
description: _('The ping plugin will send icmp echo replies to selected hosts and measure the roundtrip time for each host.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(form.DynamicList, 'Hosts', _('Monitor hosts'));
o.default = '127.0.0.1';
o.datatype = 'ipaddr("nomask")';
o.depends('enable', '1');
o = s.option(form.ListValue, 'AddressFamily', _('Address family'));
o.default = 'any';
o.depends('enable', '1');
o.value('any');
o.value('ipv4');
o.value('ipv6');
o = s.option(form.Value, 'TTL', _('TTL for ping packets'));
o.default = '127';
o.datatype = 'range(0, 255)';
o.depends('enable', '1');
o = s.option(form.Value, 'Interval', _('Interval for pings'), _('Seconds'));
o.default = '30';
o.datatype = 'ufloat';
o.depends('enable', '1');
},
configSummary: function(section) {
var hosts = L.toArray(section.Hosts);
if (hosts.length)
return N_(hosts.length, 'Monitoring one host', 'Monitoring %d hosts').format(hosts.length);
}
});