]> arthur.barton.de Git - netdata.git/blobdiff - src/proc_meminfo.c
Fix mirrored disks stats issue in FreeBSD plugin
[netdata.git] / src / proc_meminfo.c
index 0e5e14fd20e9d91b0015718a2552cac69fb812cf..d4fcbfeed5918378bc54b8aeb071bd6afc3a94a2 100644 (file)
@@ -1,6 +1,6 @@
 #include "common.h"
 
-int do_proc_meminfo(int update_every, unsigned long long dt) {
+int do_proc_meminfo(int update_every, usec_t dt) {
     (void)dt;
 
     static procfile *ff = NULL;
@@ -114,7 +114,6 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
         return 0; // we return 0, so that we will retry to open it next time
 
     uint32_t lines = procfile_lines(ff), l;
-    uint32_t words;
 
     int hwcorrupted = 0;
 
@@ -162,7 +161,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
             HardwareCorrupted = 0;
 
     for(l = 0; l < lines ;l++) {
-        words = procfile_linewords(ff, l);
+        uint32_t words = procfile_linewords(ff, l);
         if(unlikely(words < 2)) continue;
 
         char *name = procfile_lineword(ff, l, 0);
@@ -263,12 +262,12 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
 
     // --------------------------------------------------------------------
 
-    if(hwcorrupted && do_hwcorrupt && HardwareCorrupted > 0) {
+    if(hwcorrupted && (do_hwcorrupt == CONFIG_ONDEMAND_YES || (do_hwcorrupt == CONFIG_ONDEMAND_ONDEMAND && HardwareCorrupted > 0))) {
         do_hwcorrupt = CONFIG_ONDEMAND_YES;
 
         st = rrdset_find("mem.hwcorrupt");
         if(!st) {
-            st = rrdset_create("mem", "hwcorrupt", NULL, "errors", NULL, "Hardware Corrupted ECC", "MB", 9000, update_every, RRDSET_TYPE_LINE);
+            st = rrdset_create("mem", "hwcorrupt", NULL, "ecc", NULL, "Hardware Corrupted ECC", "MB", 9000, update_every, RRDSET_TYPE_LINE);
             st->isdetail = 1;
 
             rrddim_add(st, "HardwareCorrupted", NULL, 1, 1024, RRDDIM_ABSOLUTE);