summaryrefslogtreecommitdiffstats
path: root/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/network.js
blob: ba5551ed979f3f406acdf4240d3afe16493554e7 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'use strict';
'require baseclass';
'require form';

return baseclass.extend({
	title: _('Network Plugin Configuration'),
	description: _('The network plugin provides network based communication between different collectd instances. Collectd can operate both in client and server mode. In client mode locally collected data is transferred to a collectd server instance, in server mode the local instance receives data from other hosts.'),

	addFormOptions(s) {
		let o, ss;

		o = s.option(form.Flag, 'enable', _('Enable this plugin'));
		o.default = '0';

		o = s.option(form.Value, 'TimeToLive', _('TTL for network packets'));
		o.placeholder = '1';
		o.datatype = 'range(1, 255)';
		o.depends('enable', '1');

		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.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');
		o.title = _('Listener interfaces');
		o.description = _('This section defines on which interfaces collectd will wait for incoming connections.');
		o.depends('enable', '1');

		ss = o.subsection;
		ss.anonymous = true;
		ss.addremove = true;

		o = ss.option(form.Value, 'host', _('Listen host'));
		o.default = '0.0.0.0';
		o.datatype = 'ipaddr("nomask")';

		o = ss.option(form.Value, 'port', _('Listen port'));
		o.default = '25826';
		o.datatype = 'port';
		//o.optional = true;

		o = s.option(form.SectionValue, '__servers', form.TableSection, 'collectd_network_server');
		o.title = _('Server interfaces');
		o.description = _('This section defines to which servers the locally collected data is sent to.');
		o.depends('enable', '1');

		ss = o.subsection;
		ss.anonymous = true;
		ss.addremove = true;

		o = ss.option(form.Value, 'host', _('Server host'));
		o.default = '0.0.0.0';
		o.datatype = 'or(hostname,ipaddr("nomask"))';

		o = ss.option(form.Value, 'port', _('Server port'));
		o.default = '25826';
		o.datatype = 'port';
		//o.optional = true;
	},

	configSummary(section) {
		return _('Network communication enabled');
	}
});