]> arthur.barton.de Git - netdata.git/commitdiff
show disk space stats when disk performance is not available; fixes #1369
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Tue, 13 Dec 2016 20:46:30 +0000 (22:46 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Tue, 13 Dec 2016 20:46:30 +0000 (22:46 +0200)
src/proc_diskstats.c

index fe5b0556fa5dffff8c395bf9ee2ee4460464ab38..2632e059902d5288eb45583a8ff84ae729f84665 100644 (file)
@@ -450,6 +450,24 @@ int do_proc_diskstats(int update_every, usec_t dt) {
         globals_initialized = 1;
     }
 
+    // --------------------------------------------------------------------------
+    // this is smart enough not to reload it every time
+
+    mountinfo_reload(0);
+
+    // --------------------------------------------------------------------------
+    // disk space metrics
+
+    struct mountinfo *mi;
+    for(mi = disk_mountinfo_root; mi ;mi = mi->next) {
+        if(unlikely(mi->flags & (MOUNTINFO_IS_DUMMY|MOUNTINFO_IS_BIND|MOUNTINFO_IS_SAME_DEV|MOUNTINFO_NO_STAT|MOUNTINFO_NO_SIZE|MOUNTINFO_READONLY)))
+            continue;
+
+        do_disk_space_stats(mi, update_every, dt);
+    }
+
+    // --------------------------------------------------------------------------
+
     if(unlikely(!ff)) {
         char filename[FILENAME_MAX + 1];
         snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/proc/diskstats");
@@ -462,9 +480,6 @@ int do_proc_diskstats(int update_every, usec_t dt) {
 
     uint32_t lines = procfile_lines(ff), l;
 
-    // this is smart enough not to reload it every time
-    mountinfo_reload(0);
-
     for(l = 0; l < lines ;l++) {
         // --------------------------------------------------------------------------
         // Read parameters
@@ -845,16 +860,5 @@ int do_proc_diskstats(int update_every, usec_t dt) {
         }
     }
 
-    // --------------------------------------------------------------------------
-    // space metrics for non-block devices
-
-    struct mountinfo *mi;
-    for(mi = disk_mountinfo_root; mi ;mi = mi->next) {
-        if(unlikely(mi->flags & (MOUNTINFO_IS_DUMMY|MOUNTINFO_IS_BIND|MOUNTINFO_IS_SAME_DEV|MOUNTINFO_NO_STAT|MOUNTINFO_NO_SIZE|MOUNTINFO_READONLY)))
-            continue;
-
-        do_disk_space_stats(mi, update_every, dt);
-    }
-
     return 0;
 }