luci/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/exec.js
Jo-Philipp Wich d4a475163e luci-app-statistics: clean and fix plugin configurations
- Remove redundant form flags
 - Fix various default values
 - Add some new collect options and remove options that do not exist anymore

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-22 23:26:49 +01:00

58 lines
1.9 KiB
JavaScript

'use strict';
'require form';
'require tools.widgets as widgets';
return L.Class.extend({
title: _('Exec Plugin Configuration'),
description: _('The exec plugin starts external commands to read values from or to notify external processes when certain threshold values have been reached.'),
addFormOptions: function(s) {
var o, ss;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(form.SectionValue, '__input', form.TableSection, 'collectd_exec_input');
o.title = _('Add command for reading values');
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.');
o.depends('enable', '1');
ss = o.subsection;
ss.anonymous = true;
ss.addremove = true;
o = ss.option(form.Value, 'cmdline', _('Script'));
o.default = '/usr/bin/stat-dhcpusers';
o = ss.option(widgets.UserSelect, 'cmduser', _('User'));
o.default = 'nobody';
o.optional = true;
o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group'));
o.default = 'nogroup';
o.optional = true;
o = s.option(form.SectionValue, '__notify', form.TableSection, 'collectd_exec_notify');
o.title = _('Add notification command');
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.');
o.depends('enable', '1');
ss = o.subsection;
ss.anonymous = true;
ss.addremove = true;
o = ss.option(form.Value, 'cmdline', _('Script'));
o.default = '/usr/bin/stat-dhcpusers';
o = ss.option(widgets.UserSelect, 'cmduser', _('User'));
o.default = 'nobody';
o.optional = true;
o = ss.option(widgets.GroupSelect, 'cmdgroup', _('Group'));
o.default = 'nogroup';
o.optional = true;
},
configSummary: function(section) {
return _('Command monitoring enabled');
}
});