]> arthur.barton.de Git - netdata.git/commitdiff
configurable time to check for new mount points
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 14 Jan 2017 13:53:15 +0000 (15:53 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 14 Jan 2017 13:53:15 +0000 (15:53 +0200)
src/plugin_proc_diskspace.c
src/proc_diskstats.c

index 7e606db47182e333fa5b6cf7a30565333af0d939..581c6c6df459a2e9a3b6492f8be0536ac463c1e9 100644 (file)
@@ -1,18 +1,15 @@
 #include "common.h"
 
-#ifndef NETDATA_RELOAD_MOUNTINFO_EVERY
-#define NETDATA_RELOAD_MOUNTINFO_EVERY 60
-#endif
-
 #define DELAULT_EXLUDED_PATHS "/proc/ /sys/ /var/run/user/ /run/user/"
 
 static struct mountinfo *disk_mountinfo_root = NULL;
+static int check_for_new_mountpoints_every = 15;
 
 static inline void mountinfo_reload(int force) {
     static time_t last_loaded = 0;
     time_t now = now_realtime_sec();
 
-    if(force || now - last_loaded >= NETDATA_RELOAD_MOUNTINFO_EVERY) {
+    if(force || now - last_loaded >= check_for_new_mountpoints_every) {
         // mountinfo_free() can be called with NULL disk_mountinfo_root
         mountinfo_free(disk_mountinfo_root);
 
@@ -186,6 +183,10 @@ void *proc_diskspace_main(void *ptr) {
     if(update_every < rrd_update_every)
         update_every = rrd_update_every;
 
+    check_for_new_mountpoints_every = (int)config_get_number("plugin:proc:diskspace", "check for new mount points every", check_for_new_mountpoints_every);
+    if(check_for_new_mountpoints_every < update_every)
+        check_for_new_mountpoints_every = update_every;
+
     usec_t step = update_every * USEC_PER_SEC;
     for(;;) {
         usec_t now = now_monotonic_usec();
index 673aa9a6dd048d5a7e82bbbf0a4958ef4c351f66..ff036eb400effa1dc264aa160691a84fc6bdde64 100644 (file)
@@ -6,9 +6,7 @@
 #define DISK_TYPE_PARTITION 2
 #define DISK_TYPE_CONTAINER 3
 
-#ifndef NETDATA_RELOAD_MOUNTINFO_EVERY
-#define NETDATA_RELOAD_MOUNTINFO_EVERY 60
-#endif
+static int check_for_new_mountpoints_every = 15;
 
 static struct disk {
     char *disk;             // the name of the disk (sda, sdb, etc)
@@ -38,7 +36,7 @@ static inline void mountinfo_reload(int force) {
     static time_t last_loaded = 0;
     time_t now = now_realtime_sec();
 
-    if(force || now - last_loaded >= NETDATA_RELOAD_MOUNTINFO_EVERY) {
+    if(force || now - last_loaded >= check_for_new_mountpoints_every) {
         // mountinfo_free() can be called with NULL disk_mountinfo_root
         mountinfo_free(disk_mountinfo_root);
 
@@ -244,6 +242,10 @@ int do_proc_diskstats(int update_every, usec_t dt) {
         global_do_util    = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "utilization percentage for all disks", global_do_util);
         global_do_backlog = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "backlog for all disks", global_do_backlog);
 
+        check_for_new_mountpoints_every = (int)config_get_number("plugin:proc:/proc/diskstats", "check for new mount points every", check_for_new_mountpoints_every);
+        if(check_for_new_mountpoints_every < update_every)
+            check_for_new_mountpoints_every = update_every;
+
         globals_initialized = 1;
     }