luci/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js
Hannu Nyman 1cff100221 luci-app-statistics: CPU plugin: hide 'idle', tweak defaults
* Add functionality to hide the metric of 'idle' state
  from the chart and data table. Many routers are mostly idle,
  and the 98% 'idle' dominates the graph reducing its usefulness.
  Without 'idle', the smaller CPU usage spikes are visible.

* Hide 'idle' by default. Provide config option to show it.
  (note: the option in inside LuCI, and has no impact on actual
   data collection by collectd.)

* Tweak the defaults to use the percentage data by default.
  It makes more sense to average users than jiffies.

* Set the current LuCI defaults also in the config file.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-11-08 09:29:03 +02:00

42 lines
1.2 KiB
JavaScript

'use strict';
'require baseclass';
'require form';
return baseclass.extend({
title: _('CPU Plugin Configuration'),
description: _('The cpu plugin collects basic statistics about the processor usage.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(form.Flag, 'ReportByCpu', _('Report by CPU'),
_('By setting this, CPU is not aggregate of all processors on the system'));
o.default = '1';
o.rmempty = false;
o.depends('enable', '1');
o = s.option(form.Flag, 'ReportByState', _('Report by state'),
_('When set to true, reports per-state metric (system, user, idle)'));
o.default = '1';
o.rmempty = false;
o.depends('enable', '1');
o = s.option(form.Flag, 'ShowIdle', _('Show Idle state'),
_('Report also the value for the idle metric'));
o.default = '0';
o.rmempty = false;
o.depends({'enable': '1', 'ReportByState': '1'});
o = s.option(form.Flag, 'ValuesPercentage', _('Report in percent'),
_('When set to true, we request percentage values'));
o.default = '1';
o.rmempty = false;
o.depends({ 'enable': '1', 'ReportByCpu': '1', 'ReportByState': '1' });
},
configSummary: function(section) {
return _('CPU monitoring is enabled');
}
});