diff options
3 files changed, 16 insertions, 2 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpu.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpu.js index 464b28e8e..7d0dc9a15 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpu.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpu.js @@ -15,6 +15,8 @@ return baseclass.extend({ if (plugin_instance != '') title = "%H: Processor usage on core #%pi"; + var show_idle = uci.get("luci_statistics", "collectd_cpu", "ShowIdle") == "1" ? true : false; + if (uci.get("luci_statistics", "collectd_cpu", "ReportByState") == "1") { var cpu = { title: title, @@ -25,7 +27,7 @@ return baseclass.extend({ data: { instances: { cpu: [ - "idle", + ...(show_idle ? ["idle"] : []), "interrupt", "nice", "softirq", @@ -81,7 +83,7 @@ return baseclass.extend({ data: { instances: { percent: [ - "idle", + ...(show_idle ? ["idle"] : []), "interrupt", "nice", "softirq", diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js index 7b2963cad..e013e80cd 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/cpu.js @@ -23,8 +23,16 @@ return baseclass.extend({ 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' }); }, diff --git a/applications/luci-app-statistics/root/etc/config/luci_statistics b/applications/luci-app-statistics/root/etc/config/luci_statistics index 1ab9208c3..5a2b94b67 100644 --- a/applications/luci-app-statistics/root/etc/config/luci_statistics +++ b/applications/luci-app-statistics/root/etc/config/luci_statistics @@ -67,6 +67,10 @@ config statistics 'collectd_contextswitch' config statistics 'collectd_cpu' option enable '1' + option ReportByCpu '1' + option ReportByState '1' + option ShowIdle '0' + option ValuesPercentage '1' config statistics 'collectd_cpufreq' option enable '0' |