Skip to content

Commit

Permalink
Merge pull request #6584 from hnyman/stat
Browse files Browse the repository at this point in the history
luci-app-statistics: memory: make hiding 'free' configurable
  • Loading branch information
hnyman authored Oct 9, 2023
2 parents f235491 + 08540c4 commit 936d623
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -21,7 +23,7 @@ return baseclass.extend({
data: {
instances: {
memory: [
"free",
...(hide_free ? [] : ["free"]),
"buffered",
"cached",
"used"
Expand Down Expand Up @@ -58,7 +60,7 @@ return baseclass.extend({
data: {
instances: {
percent: [
"free",
...(hide_free ? [] : ["free"]),
"buffered",
"cached",
"used"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ config statistics 'collectd_load'

config statistics 'collectd_memory'
option enable '1'
option HideFree '0'
option ValuesAbsolute '1'
option ValuesPercentage '0'

Expand Down

0 comments on commit 936d623

Please sign in to comment.