luci-app-statistics: clean and fix plugin configurations

- Remove redundant form flags
 - Fix various default values
 - Add some new collect options and remove options that do not exist anymore

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2020-02-22 23:26:49 +01:00
parent d527c28ffa
commit d4a475163e
28 changed files with 70 additions and 136 deletions

View file

@ -9,7 +9,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Host', _('Monitor host'));
o.default = 'localhost';

View file

@ -9,21 +9,21 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Flag, 'ReportByCpu', _('Report by CPU'),
_('By setting this, CPU is not aggregate of all processors on the system'));
o.default = '1';
o.rmempty = false;
o.depends('enable', '1');
o = s.option(form.Flag, 'ReportByState', _('Report by state'),
_('When set to true, reports per-state metric (system, user, idle)'));
o.default = '1';
o.rmempty = false;
o.depends('enable', '1');
o = s.option(form.Flag, 'ValuesPercentage', _('Report in percent'),
_('When set to true, we request percentage values'));
o.default = '0';
o.depends({ 'enable': '1', 'ReportByCpu': '1', 'ReportByState': '1' });
},

View file

@ -5,22 +5,7 @@ return L.Class.extend({
title: _('CPU Frequency Plugin Configuration'),
description: _('This plugin collects statistics about the processor frequency scaling.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Flag, 'ExtraItems', _('Extra items'),
_('More details about frequency usage and transitions'));
o.default = '0';
o.optional = true;
o.depends('enable', '1');
},
configSummary: function(section) {
return (section.ExtraItems == '1')
? _('Detailled CPU frequency monitoring enabled')
: _('Simple CPU frequency monitoring enabled');
return _('CPU frequency monitoring enabled');
}
});

View file

@ -9,14 +9,12 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Value, 'DataDir', _('Storage directory for the csv files'));
o.default = '127.0.0.1';
o.default = '/tmp/csv';
o.depends('enable', '1');
o = s.option(form.Flag, 'StoreRates', _('Store data values as rates instead of absolute values'));
o.default = '0';
o.depends('enable', '1');
},

View file

@ -8,7 +8,6 @@ return L.Class.extend({
var o, ss;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.SectionValue, '__pages', form.TableSection, 'collectd_curl_page');
o.title = _('Fetch pages');
@ -20,6 +19,7 @@ return L.Class.extend({
o = ss.option(form.Flag, 'enable', _('Enable'));
o.default = '1';
o.rmempty = false;
o = ss.option(form.Value, 'name', _('Name'));

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Devices', _('Monitor devices'));
o.optional = true;
@ -87,7 +86,6 @@ return L.Class.extend({
};
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.default = '0';
o.depends('enable', '1');
},

View file

@ -10,11 +10,9 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Disks', _('Monitor disks and partitions'),
_('When none selected, all disks will be monitored.'));
o.rmempty = true;
o.depends('enable', '1');
o.load = function(section_id) {
return fs.trimmed('/proc/partitions').then(L.bind(function(str) {
@ -31,7 +29,6 @@ return L.Class.extend({
};
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.default = '0';
o.depends('enable', '1');
},

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'),
_('When none selected, all interfaces will be monitored.'));

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Value, 'SocketFile', _('Socket file'));
o.default = '/var/run/collect-email.sock';
@ -19,13 +18,11 @@ return L.Class.extend({
o = s.option(widgets.GroupSelect, 'SocketGroup', _('Socket group'));
o.default = 'nogroup';
o.optional = true;
o.rmempty = true;
o.depends('enable', '1');
o = s.option(form.Value, 'SocketPerms', _('Socket permissions'));
o.default = '0770';
o.optional = true;
o.rmempty = true;
o.depends('enable', '1');
o.validate = function(section_id, v) {
if (v == '')
@ -41,7 +38,6 @@ return L.Class.extend({
o.datatype = 'range(1,16384)';
o.default = '5';
o.optional = true;
o.rmempty = true;
o.depends('enable', '1');
},

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o, ss;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.SectionValue, '__input', form.TableSection, 'collectd_exec_input');
o.title = _('Add command for reading values');
@ -27,12 +26,10 @@ return L.Class.extend({
o = ss.option(widgets.UserSelect, 'cmduser', _('User'));
o.default = 'nobody';
o.optional = true;
o.rmempty = true;
o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group'));
o.default = 'nogroup';
o.optional = true;
o.rmempty = true;
o = s.option(form.SectionValue, '__notify', form.TableSection, 'collectd_exec_notify');
o.title = _('Add notification command');
@ -49,12 +46,10 @@ return L.Class.extend({
o = ss.option(widgets.UserSelect, 'cmduser', _('User'));
o.default = 'nobody';
o.optional = true;
o.rmempty = true;
o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group'));
o.default = 'nogroup';
o.optional = true;
o.rmempty = true;
},
configSummary: function(section) {

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'));
o.multiple = true;
@ -18,7 +17,6 @@ return L.Class.extend({
o.depends('enable', '1');
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.default = '0';
o.depends('enable', '1');
},

View file

@ -11,7 +11,6 @@ return L.Class.extend({
var o, ss;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
for (var family = 4; family <= 6; family += 2) {
var suffix = (family == 4 ? '' : '6');
@ -85,7 +84,6 @@ return L.Class.extend({
o = ss.option(form.Value, 'table', _('Table'));
o.default = 'filter';
o.optional = true;
o.rmempty = true;
o.transformChoices = function() { return this.super('transformChoices', []) || {} };
o.validate = function(section_id, table) {
var chain_opt = this.section.children.filter(function(o) { return o.option == 'chain' })[0],
@ -99,7 +97,6 @@ return L.Class.extend({
o = ss.option(form.Value, 'chain', _('Chain'));
o.optional = true;
o.rmempty = true;
o.transformChoices = function() { return this.super('transformChoices', []) || {} };
o.validate = function(section_id, chain) {
var table_opt = this.section.children.filter(function(o) { return o.option == 'table' })[0],
@ -138,7 +135,6 @@ return L.Class.extend({
o = ss.option(form.Value, 'rule', _('Comment / Rule Number'));
o.optional = true;
o.rmempty = true;
o.transformChoices = function() { return this.super('transformChoices', []) || {} };
o.load = function(section_id) {
var table = uci.get('luci_statistics', section_id, 'table'),

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Irqs', _('Monitor interrupts'));
o.optional = true;
@ -41,8 +40,6 @@ return L.Class.extend({
};
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.default = '0';
o.optional = 'true';
o.depends('enable', '1');
},

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(widgets.DeviceSelect, 'Interfaces', _('Monitor interfaces'), _('Leave unselected to automatically determine interfaces to monitor.'));
o.multiple = true;
@ -23,7 +22,6 @@ return L.Class.extend({
};
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.default = '0';
o.depends('enable', '1');
},

View file

@ -9,18 +9,12 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Flag, 'ValuesAbsolute', _('Absolute values'),
_('When set to true, we request absolute values'));
o = s.option(form.Flag, 'ValuesAbsolute', _('Absolute values'), _('When set to true, we request absolute values'));
o.default = '1';
o.optional = false;
o.depends('enable', '1');
o = s.option(form.Flag, 'ValuesPercentage', _('Percent values'),
_('When set to true, we request percentage values'));
o.default = '0';
o.optional = false;
o = s.option(form.Flag, 'ValuesPercentage', _('Percent values'), _('When set to true, we request percentage values'));
o.depends('enable', '1');
},

View file

@ -38,7 +38,6 @@ return L.Class.extend({
o.depends('enable', '1');
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.default = '0';
o.depends('enable', '1');
},

View file

@ -12,21 +12,19 @@ return L.Class.extend({
o.default = '0';
o = s.option(form.Value, 'TimeToLive', _('TTL for network packets'));
o.default = '128';
o.datatype = 'range(0, 255)';
o.optional = true;
o.placeholder = '1';
o.datatype = 'range(1, 255)';
o.depends('enable', '1');
o = s.option(form.Flag, 'Forward', _('Forwarding between listen and server addresses'));
o.default = '0';
o.optional = true;
o = s.option(form.Value, 'MaxPacketSize', _('Maximum packet size'), _('Set the maximum size for datagrams sent over the network'));
o.placeholder = '1452';
o.datatype = 'range(1024, 65535)';
o.depends('enable', '1');
o = s.option(form.Value, 'CacheFlush', _('Cache flush interval'),
_('Seconds'));
o.default = '86400';
o.datatype = 'uinteger';
o.optional = true;
o = s.option(form.Flag, 'Forward', _('Enable forwarding'), _('Forwarding between listen and server addresses'));
o.depends('enable', '1');
o = s.option(form.Flag, 'ReportStats', _('Enable statistics'), _('Create statistics about the network plugin itself'));
o.depends('enable', '1');
o = s.option(form.SectionValue, '__listeners', form.TableSection, 'collectd_network_listen');

View file

@ -9,10 +9,8 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Value, 'UPS', _('UPS'), _('UPS name in NUT ups@host format'));
o.rmempty = true;
},
configSummary: function(section) {

View file

@ -9,16 +9,13 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Value, 'Host', _('Host'),
_('IP or hostname where to get the txtinfo output from'));
o.datatype = 'host';
o.rmempty = true;
o = s.option(form.Value, 'Port', _('Port'));
o.datatype = 'port';
o.rmempty = true;
o = s.option(form.ListValue, 'CollectLinks', _('CollectLinks'),
_('Specifies what information to collect about links.'));

View file

@ -10,30 +10,20 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Flag, 'CollectIndividualUsers', _('Generate a separate graph for each logged user'));
o.default = '0';
o.rmempty = true;
o.depends('enable', '1');
o = s.option(form.Flag, 'CollectUserCount', _('Aggregate number of connected users'));
o.default = '0';
o.rmempty = true;
o.depends('enable', '1');
o = s.option(form.Flag, 'CollectCompression', _('Gather compression statistics'));
o.default = '0';
o.rmempty = true;
o.depends('enable', '1');
o = s.option(form.Flag, 'ImprovedNamingSchema', _('Use improved naming schema'));
o.default = '0';
o.rmempty = true;
o.depends('enable', '1');
o = s.option(form.DynamicList, 'StatusFile', _('OpenVPN status files'));
o.rmempty = true;
o.depends('enable', '1');
o.load = function(section_id) {
return L.resolveDefault(fs.list('/var/run'), []).then(L.bind(function(entries) {

View file

@ -9,7 +9,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Hosts', _('Monitor hosts'));
o.default = '127.0.0.1';

View file

@ -9,7 +9,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Processes', _('Monitor processes'));
o.default = 'uhttpd dropbear dnsmasq';

View file

@ -9,44 +9,33 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Value, 'DataDir', _('Storage directory'),
_('Note: as pages are rendered by user \'nobody\', the *.rrd files, the storage directory and all its parent directories need to be world readable.'));
o.default = '/tmp';
o.optional = true;
o.rmempty = true;
o.default = '/tmp/rrd';
o.depends('enable', '1');
o = s.option(form.Value, 'StepSize', _('RRD step interval'),
_('Seconds'));
o.default = '30';
o.optional = true;
o.rmempty = true;
o = s.option(form.Value, 'StepSize', _('RRD step interval'), _('Seconds'));
o.placeholder = '30';
o.datatype = 'uinteger';
o.depends('enable', '1');
o = s.option(form.Value, 'HeartBeat', _('RRD heart beat interval'),
_('Seconds'));
o.default = '60';
o.optional = true;
o.rmempty = true;
o = s.option(form.Value, 'HeartBeat', _('RRD heart beat interval'), _('Seconds'));
o.placeholder = '60';
o.datatype = 'uinteger';
o.depends('enable', '1');
o = s.option(form.Flag, 'RRASingle', _('Only create average RRAs'),
_('reduces rrd size'));
o.default = 'true';
o = s.option(form.Flag, 'RRASingle', _('Only create average RRAs'), _('reduces rrd size'));
o.default = '1';
o.rmempty = false;
o.depends('enable', '1');
o = s.option(form.Flag, 'RRAMax', _('Show max values instead of averages'),
_('Max values for a period can be used instead of averages when not using \'only average RRAs\''));
o.default = 'false';
o.rmempty = true;
o.depends('RRASingle', '0');
o = s.option(form.DynamicList, 'RRATimespans', _('Stored timespans'));
o.default = '10min 1day 1week 1month 1year';
o.optional = true;
o.rmempty = true;
o.depends('enable', '1');
o.validate = function(section_id, value) {
if (value == '')
@ -59,30 +48,46 @@ return L.Class.extend({
};
o = s.option(form.Value, 'RRARows', _('Rows per RRA'));
o.default = '100';
o.optional = true;
o.rmempty = true;
o.placeholder = '1200';
o.datatype = 'min(1)';
o.depends('enable', '1');
o = s.option(form.Value, 'XFF', _('RRD XFiles Factor'));
o.default = '0.1';
o.optional = true;
o.rmempty = true;
o.placeholder = '0.1';
o.depends('enable', '1');
o.validate = function(section_id, value) {
if (value == '')
return true;
o = s.option(form.Value, 'CacheTimeout', _('Cache collected data for'),
_('Seconds'));
o.default = '100';
o.optional = true;
o.rmempty = true;
o.depends('enable', '1');
if (value.match(/^[0-9]+(?:\.[0-9]+)?$/) && +value >= 0 && +value < 1)
return true;
o = s.option(form.Value, 'CacheFlush', _('Flush cache after'),
_('Seconds'));
o.default = '100';
o.optional = true;
o.rmempty = true;
return _('Expecting decimal value lower than one');
};
o = s.option(form.Value, 'CacheTimeout', _('Cache collected data for'), _('Seconds'));
o.depends('enable', '1');
o.datatype = 'uinteger';
o.placeholder = '0';
o.validate = function(section_id, value) {
var flushinp = this.map.findElement('id', 'widget.cbid.luci_statistics.collectd_rrdtool.CacheFlush');
if (value != '' && !isNaN(value) && +value > 0) {
flushinp.placeholder = 10 * +value;
flushinp.disabled = false;
}
else {
flushinp.value = '';
flushinp.placeholder = '0';
flushinp.disabled = true;
}
return true;
};
o = s.option(form.Value, 'CacheFlush', _('Flush cache after'), _('Seconds'));
o.depends('enable', '1');
o.datatype = 'uinteger';
},
configSummary: function(section) {

View file

@ -18,7 +18,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Sensor', _('Sensor list'));
o.rmempty = true;
@ -45,8 +44,6 @@ return L.Class.extend({
};
o = s.option(form.Flag, 'IgnoreSelected', _('Monitor all except specified'));
o.default = '0';
o.rmempty = true;
o.depends('enable', '1');
},

View file

@ -9,18 +9,20 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Flag, 'ListeningPorts', _('Monitor all local listen ports'));
o.default = '1';
o.depends('enable', '1');
o.rmempty = false;
o.default = '1';
o = s.option(form.Value, 'LocalPorts', _('Monitor local ports'));
o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports'));
o.optional = true;
o.datatype = 'port';
o.depends({ enable: '1', ListeningPorts: '0' });
o = s.option(form.Value, 'RemotePorts', _('Monitor remote ports'));
o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports'));
o.optional = true;
o.datatype = 'port';
o.depends({ enable: '1', ListeningPorts: '0' });
},

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.DynamicList, 'Device', _('Monitor device(s) / thermal zone(s)'), _('Empty value = monitor all'));
o.load = function(section_id) {

View file

@ -10,7 +10,6 @@ return L.Class.extend({
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o.default = '0';
o = s.option(form.Value, 'SocketFile', _('Socket path'));
o.default = '/var/run/collect-query.socket';

View file

@ -183,9 +183,11 @@ function config_network( c )
end
end
return str .. _string( c["TimeToLive"], "TimeToLive" )
.. _string( c["CacheFlush"], "CacheFlush" )
.. _bool( c["Forward"], "Forward" )
return str ..
_string(c["MaxPacketSize"], "MaxPacketSize") ..
_string(c["TimeToLive"], "TimeToLive") ..
_bool(c["Forward"], "Forward") ..
_bool(c["ReportStats"], "ReportStats")
end