2020-02-08 21:12:17 +00:00
|
|
|
'use strict';
|
2020-04-03 08:00:06 +00:00
|
|
|
'require baseclass';
|
2020-02-08 21:12:17 +00:00
|
|
|
'require form';
|
|
|
|
|
2020-04-03 08:00:06 +00:00
|
|
|
return baseclass.extend({
|
2020-02-08 21:12:17 +00:00
|
|
|
title: _('TCPConns Plugin Configuration'),
|
|
|
|
description: _('The tcpconns plugin collects information about open tcp connections on selected ports.'),
|
|
|
|
|
|
|
|
addFormOptions: function(s) {
|
|
|
|
var o;
|
|
|
|
|
|
|
|
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
|
|
|
|
|
|
|
|
o = s.option(form.Flag, 'ListeningPorts', _('Monitor all local listen ports'));
|
|
|
|
o.depends('enable', '1');
|
2020-02-22 22:26:49 +00:00
|
|
|
o.rmempty = false;
|
2020-12-13 09:09:33 +00:00
|
|
|
o.default = '0';
|
2020-02-08 21:12:17 +00:00
|
|
|
|
2020-02-22 22:26:49 +00:00
|
|
|
o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports'));
|
2020-02-08 21:12:17 +00:00
|
|
|
o.optional = true;
|
2020-02-22 22:26:49 +00:00
|
|
|
o.datatype = 'port';
|
2020-12-13 09:09:33 +00:00
|
|
|
o.default = '22 80';
|
2020-02-08 21:12:17 +00:00
|
|
|
o.depends({ enable: '1', ListeningPorts: '0' });
|
|
|
|
|
2020-02-22 22:26:49 +00:00
|
|
|
o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports'));
|
2020-02-08 21:12:17 +00:00
|
|
|
o.optional = true;
|
2020-02-22 22:26:49 +00:00
|
|
|
o.datatype = 'port';
|
2020-02-08 21:12:17 +00:00
|
|
|
o.depends({ enable: '1', ListeningPorts: '0' });
|
|
|
|
},
|
|
|
|
|
|
|
|
configSummary: function(section) {
|
|
|
|
var lports = L.toArray(section.LocalPorts),
|
|
|
|
rports = L.toArray(section.RemotePorts);
|
|
|
|
|
|
|
|
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)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|