summaryrefslogtreecommitdiffstats
path: root/src/proc_meminfo.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2016-11-23 15:49:10 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2016-11-23 15:49:10 +0000
commit87649cf32bd0e14d5a903fb85b01e9f41a253540 (patch)
treebbefda6dac074aeb87529592e8e5064f69cbe024 /src/proc_meminfo.c
parentImported Upstream version 1.3.0+dfsg (diff)
downloadnetdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.tar.xz
netdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.zip
New upstream version 1.4.0+dfsgupstream/1.4.0+dfsg
Diffstat (limited to 'src/proc_meminfo.c')
-rw-r--r--src/proc_meminfo.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/proc_meminfo.c b/src/proc_meminfo.c
index 4295cd6da..999c9538d 100644
--- a/src/proc_meminfo.c
+++ b/src/proc_meminfo.c
@@ -9,14 +9,14 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
static int do_ram = -1, do_swap = -1, do_hwcorrupt = -1, do_committed = -1, do_writeback = -1, do_kernel = -1, do_slab = -1;
if(do_ram == -1) do_ram = config_get_boolean("plugin:proc:/proc/meminfo", "system ram", 1);
- if(do_swap == -1) do_swap = config_get_boolean("plugin:proc:/proc/meminfo", "system swap", 1);
+ if(do_swap == -1) do_swap = config_get_boolean_ondemand("plugin:proc:/proc/meminfo", "system swap", CONFIG_ONDEMAND_ONDEMAND);
if(do_hwcorrupt == -1) do_hwcorrupt = config_get_boolean_ondemand("plugin:proc:/proc/meminfo", "hardware corrupted ECC", CONFIG_ONDEMAND_ONDEMAND);
if(do_committed == -1) do_committed = config_get_boolean("plugin:proc:/proc/meminfo", "committed memory", 1);
if(do_writeback == -1) do_writeback = config_get_boolean("plugin:proc:/proc/meminfo", "writeback memory", 1);
if(do_kernel == -1) do_kernel = config_get_boolean("plugin:proc:/proc/meminfo", "kernel memory", 1);
if(do_slab == -1) do_slab = config_get_boolean("plugin:proc:/proc/meminfo", "slab memory", 1);
- if(dt) {};
+ (void)dt;
if(!ff) {
char filename[FILENAME_MAX + 1];
@@ -105,15 +105,15 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
if(!st) {
st = rrdset_create("system", "ram", NULL, "ram", NULL, "System RAM", "MB", 200, update_every, RRDSET_TYPE_STACKED);
- rrddim_add(st, "buffers", NULL, 1, 1024, RRDDIM_ABSOLUTE);
+ rrddim_add(st, "free", NULL, 1, 1024, RRDDIM_ABSOLUTE);
rrddim_add(st, "used", NULL, 1, 1024, RRDDIM_ABSOLUTE);
rrddim_add(st, "cached", NULL, 1, 1024, RRDDIM_ABSOLUTE);
- rrddim_add(st, "free", NULL, 1, 1024, RRDDIM_ABSOLUTE);
+ rrddim_add(st, "buffers", NULL, 1, 1024, RRDDIM_ABSOLUTE);
}
else rrdset_next(st);
- rrddim_set(st, "used", MemUsed);
rrddim_set(st, "free", MemFree);
+ rrddim_set(st, "used", MemUsed);
rrddim_set(st, "cached", Cached);
rrddim_set(st, "buffers", Buffers);
rrdset_done(st);
@@ -123,7 +123,9 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
unsigned long long SwapUsed = SwapTotal - SwapFree;
- if(do_swap) {
+ if(SwapTotal || SwapUsed || SwapFree || do_swap == CONFIG_ONDEMAND_YES) {
+ do_swap = CONFIG_ONDEMAND_YES;
+
st = rrdset_find("system.swap");
if(!st) {
st = rrdset_create("system", "swap", NULL, "swap", NULL, "System Swap", "MB", 201, update_every, RRDSET_TYPE_STACKED);