diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2023-10-09 23:18:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 23:18:21 +0300 |
commit | 936d62302af37571b9b8408b4bf9d7a19d063dac (patch) | |
tree | f7fb1e31dd8fee0141748ca35895c86776285dce | |
parent | f235491381f5836701f2fb1cb2e2aed432ef127d (diff) | |
parent | 08540c44629ad0fedf5feb2b535c2df182ac3973 (diff) |
Merge pull request #6584 from hnyman/stat
luci-app-statistics: memory: make hiding 'free' configurable
3 files changed, 10 insertions, 2 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js index 9b0d179b0a..960d98c108 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js @@ -5,12 +5,14 @@ 'use strict'; 'require baseclass'; +'require uci'; return baseclass.extend({ title: _('Memory'), rrdargs: function(graph, host, plugin, plugin_instance, dtype) { var p = []; + var hide_free = uci.get("luci_statistics", "collectd_memory", "HideFree") == "1" ? true : false; var memory = { title: "%H: Memory usage", @@ -21,7 +23,7 @@ return baseclass.extend({ data: { instances: { memory: [ - "free", + ...(hide_free ? [] : ["free"]), "buffered", "cached", "used" @@ -58,7 +60,7 @@ return baseclass.extend({ data: { instances: { percent: [ - "free", + ...(hide_free ? [] : ["free"]), "buffered", "cached", "used" diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js index a4a8eb2761..864857faa3 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js @@ -11,6 +11,11 @@ return baseclass.extend({ o = s.option(form.Flag, 'enable', _('Enable this plugin')); + o = s.option(form.Flag, 'HideFree', _('Hide free memory'), + _('Hiding the free memory item makes the graph to scale to actual memory usage, not to 100%.')); + o.default = '0'; + o.rmempty = false; + o = s.option(form.Flag, 'ValuesAbsolute', _('Absolute values'), _('When set to true, we request absolute values')); o.default = '1'; o.depends('enable', '1'); diff --git a/applications/luci-app-statistics/root/etc/config/luci_statistics b/applications/luci-app-statistics/root/etc/config/luci_statistics index 2008a7966a..f7783d73f3 100644 --- a/applications/luci-app-statistics/root/etc/config/luci_statistics +++ b/applications/luci-app-statistics/root/etc/config/luci_statistics @@ -158,6 +158,7 @@ config statistics 'collectd_load' config statistics 'collectd_memory' option enable '1' + option HideFree '0' option ValuesAbsolute '1' option ValuesPercentage '0' |