1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
'use strict';
'require baseclass';
'require form';
return baseclass.extend({
title: _('TCPConns Plugin Configuration'),
description: _('The tcpconns plugin collects information about open tcp connections on selected ports.'),
addFormOptions(s) {
let 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');
o.rmempty = false;
o.default = '0';
o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports'));
o.optional = true;
o.datatype = 'port';
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');
o = s.option(form.Flag, 'AllPortsSummary', _('Summary of all ports'));
o.rmempty = false;
o.depends('enable', '1');
},
configSummary(section) {
let lports = L.toArray(section.LocalPorts);
const rports = L.toArray(section.RemotePorts);
const listen = section.ListeningPorts == '1';
const summary = section.AllPortsSummary == '1';
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')
);
}
});
|