]> arthur.barton.de Git - netdata.git/commitdiff
do not collect /run/user/ disk space statistics by default
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 22 Oct 2016 23:49:15 +0000 (02:49 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 22 Oct 2016 23:49:15 +0000 (02:49 +0300)
src/proc_diskstats.c

index 85da496a7ddfee403b75d6284aa65a3070e180b1..6a5bf0a35cf969b153b3c073e5263debf0ec5857 100644 (file)
@@ -57,12 +57,6 @@ static inline void mountinfo_reload(int force) {
 }
 
 static inline void do_disk_space_stats(struct disk *d, const char *mount_point, const char *mount_source, const char *disk, const char *family, int update_every, unsigned long long dt) {
-    struct statvfs buff_statvfs;
-    if (statvfs(mount_point, &buff_statvfs) < 0) {
-        error("Failed statvfs() for '%s' (disk '%s')", mount_point, disk);
-        return;
-    }
-
     int do_space, do_inodes;
 
     if(d) {
@@ -91,6 +85,9 @@ static inline void do_disk_space_stats(struct disk *d, const char *mount_point,
 
         int def_space = CONFIG_ONDEMAND_ONDEMAND;
 
+        if(unlikely(strncmp(mount_point, "/run/user/", 10) == 0))
+            def_space = CONFIG_ONDEMAND_NO;
+
         // check the user configuration (this will also show our 'on demand' decision)
         def_space = config_get_boolean_ondemand(var_name, "enable space metrics", def_space);
 
@@ -101,6 +98,15 @@ static inline void do_disk_space_stats(struct disk *d, const char *mount_point,
         do_inodes = config_get_boolean_ondemand(var_name, "inodes usage", ddo_inodes);
     }
 
+    if(do_space == CONFIG_ONDEMAND_NO && do_inodes == CONFIG_ONDEMAND_NO)
+        return;
+
+    struct statvfs buff_statvfs;
+    if (statvfs(mount_point, &buff_statvfs) < 0) {
+        error("Failed statvfs() for '%s' (disk '%s')", mount_point, disk);
+        return;
+    }
+
     // taken from get_fs_usage() found in coreutils
     unsigned long bsize = (buff_statvfs.f_frsize) ? buff_statvfs.f_frsize : buff_statvfs.f_bsize;