luci-app-statistics: enhance tcpconns plugin
Modernize tcpconns plugin to match the features in collectd: * Support summary of all ports * 'All listening ports' can be concurrent to specified ports, not just alternative Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
This commit is contained in:
parent
9b12a48c3f
commit
c9c395920e
3 changed files with 19 additions and 13 deletions
|
@ -19,25 +19,30 @@ return baseclass.extend({
|
|||
o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports'));
|
||||
o.optional = true;
|
||||
o.datatype = 'port';
|
||||
o.default = '22 80';
|
||||
o.depends({ enable: '1', ListeningPorts: '0' });
|
||||
o.default = '22';
|
||||
o.depends('enable', '1');
|
||||
|
||||
o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports'));
|
||||
o.optional = true;
|
||||
o.datatype = 'port';
|
||||
o.depends({ enable: '1', ListeningPorts: '0' });
|
||||
o.depends('enable', '1');
|
||||
|
||||
o = s.option(form.Flag, 'AllPortsSummary', _('Summary of all ports'));
|
||||
o.rmempty = false;
|
||||
o.depends('enable', '1');
|
||||
},
|
||||
|
||||
configSummary: function(section) {
|
||||
var lports = L.toArray(section.LocalPorts),
|
||||
rports = L.toArray(section.RemotePorts);
|
||||
rports = L.toArray(section.RemotePorts),
|
||||
listen = section.ListeningPorts == '1',
|
||||
summary = section.AllPortsSummary == '1';
|
||||
|
||||
if (section.ListeningPorts == '1')
|
||||
return _('Monitoring local listen ports');
|
||||
else
|
||||
return _('Monitoring %s and %s').format(
|
||||
N_(lports.length, 'one local port', '%d local ports').format(lports.length),
|
||||
N_(rports.length, 'one remote port', '%d remote ports').format(rports.length)
|
||||
);
|
||||
return _('Monitoring %s and %s, %s %s').format(
|
||||
N_(lports.length, 'one local', '%d local').format(lports.length),
|
||||
N_(rports.length, 'one remote port', '%d remote ports').format(rports.length),
|
||||
listen ? _('all local listening ports,') : '',
|
||||
summary ? _('summary of all ports') : _('no summary')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -203,7 +203,8 @@ config statistics 'collectd_splash_leases'
|
|||
config statistics 'collectd_tcpconns'
|
||||
option enable '0'
|
||||
option ListeningPorts '0'
|
||||
option LocalPorts '22 80'
|
||||
list LocalPorts '22'
|
||||
option AllPortsSummary '0'
|
||||
|
||||
config statistics 'collectd_thermal'
|
||||
option enable '0'
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"category": "network",
|
||||
"legend": [
|
||||
[],
|
||||
["ListeningPorts"],
|
||||
["ListeningPorts", "AllPortsSummary"],
|
||||
["LocalPorts", "RemotePorts"]
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue