093f3fddbcd12c44a6b86703d1989dfdfecd5a5f
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / view / statistics / plugins / exec.js
1 'use strict';
2 'require form';
3 'require tools.widgets as widgets';
4
5 return L.Class.extend({
6 title: _('Exec Plugin Configuration'),
7 description: _('The exec plugin starts external commands to read values from or to notify external processes when certain threshold values have been reached.'),
8
9 addFormOptions: function(s) {
10 var o, ss;
11
12 o = s.option(form.Flag, 'enable', _('Enable this plugin'));
13 o.default = '0';
14
15 o = s.option(form.SectionValue, '__input', form.TableSection, 'collectd_exec_input');
16 o.title = _('Add command for reading values');
17 o.description = _('Here you can define external commands which will be started by collectd in order to read certain values. The values will be read from stdout.');
18 o.depends('enable', '1');
19
20 ss = o.subsection;
21 ss.anonymous = true;
22 ss.addremove = true;
23
24 o = ss.option(form.Value, 'cmdline', _('Script'));
25 o.default = '/usr/bin/stat-dhcpusers';
26
27 o = ss.option(widgets.UserSelect, 'cmduser', _('User'));
28 o.default = 'nobody';
29 o.optional = true;
30 o.rmempty = true;
31
32 o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group'));
33 o.default = 'nogroup';
34 o.optional = true;
35 o.rmempty = true;
36
37 o = s.option(form.SectionValue, '__notify', form.TableSection, 'collectd_exec_notify');
38 o.title = _('Add notification command');
39 o.description = _('Here you can define external commands which will be started by collectd when certain threshold values have been reached. The values leading to invocation will be fed to the the called programs stdin.');
40 o.depends('enable', '1');
41
42 ss = o.subsection;
43 ss.anonymous = true;
44 ss.addremove = true;
45
46 o = ss.option(form.Value, 'cmdline', _('Script'));
47 o.default = '/usr/bin/stat-dhcpusers';
48
49 o = ss.option(widgets.UserSelect, 'cmduser', _('User'));
50 o.default = 'nobody';
51 o.optional = true;
52 o.rmempty = true;
53
54 o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group'));
55 o.default = 'nogroup';
56 o.optional = true;
57 o.rmempty = true;
58 },
59
60 configSummary: function(section) {
61 return _('Command monitoring enabled');
62 }
63 });