#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);
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();
#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)
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);
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;
}