diff options
author | Costa Tsaousis <costa@tsaousis.gr> | 2016-12-13 22:51:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-13 22:51:05 +0200 |
commit | 892a8114054404dab69a8094f879fe2c715d289a (patch) | |
tree | 762bc21b26fb7fefa81a9142fb903224f81b02f2 | |
parent | a71060f8751ed972319a957a271eae3c06814201 (diff) | |
parent | 302ea6ecbb032b0b782dfa4415d8aaf32b8f797a (diff) |
Merge pull request #1370 from ktsaou/master
show disk space stats when disk performance is not available
-rw-r--r-- | src/proc_diskstats.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/proc_diskstats.c b/src/proc_diskstats.c index fe5b0556fa..2632e05990 100644 --- a/src/proc_diskstats.c +++ b/src/proc_diskstats.c @@ -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; } |