diff options
Diffstat (limited to 'src/collectors/diskspace.plugin')
-rw-r--r-- | src/collectors/diskspace.plugin/integrations/disk_space.md | 6 | ||||
-rw-r--r-- | src/collectors/diskspace.plugin/metadata.yaml | 2 | ||||
-rw-r--r-- | src/collectors/diskspace.plugin/plugin_diskspace.c | 22 |
3 files changed, 16 insertions, 14 deletions
diff --git a/src/collectors/diskspace.plugin/integrations/disk_space.md b/src/collectors/diskspace.plugin/integrations/disk_space.md index 61015120d..d27e7da25 100644 --- a/src/collectors/diskspace.plugin/integrations/disk_space.md +++ b/src/collectors/diskspace.plugin/integrations/disk_space.md @@ -108,8 +108,8 @@ The file format is a modified INI syntax. The general structure is: [section2] option3 = some third value ``` -You can edit the configuration file using the `edit-config` script from the -Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). +You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config) script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). ```bash cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata @@ -125,7 +125,7 @@ You can also specify per mount point `[plugin:proc:diskspace:mountpoint]` |:----|:-----------|:-------|:--------:| | update every | Data collection frequency. | 1 | no | | remove charts of unmounted disks | Remove chart when a device is unmounted on host. | yes | no | -| check for new mount points every | Parse proc files frequency. | 15 | no | +| check for new mount points every | Parse proc files frequency. | 15s | no | | exclude space metrics on paths | Do not show metrics (charts) for listed paths. This option accepts netdata simple pattern. | /proc/* /sys/* /var/run/user/* /run/user/* /snap/* /var/lib/docker/* | no | | exclude space metrics on filesystems | Do not show metrics (charts) for listed filesystems. This option accepts netdata simple pattern. | *gvfs *gluster* *s3fs *ipfs *davfs2 *httpfs *sshfs *gdfs *moosefs fusectl autofs | no | | exclude inode metrics on filesystems | Do not show metrics (charts) for listed filesystems. This option accepts netdata simple pattern. | msdosfs msdos vfat overlayfs aufs* *unionfs | no | diff --git a/src/collectors/diskspace.plugin/metadata.yaml b/src/collectors/diskspace.plugin/metadata.yaml index 578f56bd0..a00a9e91d 100644 --- a/src/collectors/diskspace.plugin/metadata.yaml +++ b/src/collectors/diskspace.plugin/metadata.yaml @@ -63,7 +63,7 @@ modules: required: false - name: check for new mount points every description: Parse proc files frequency. - default_value: 15 + default_value: 15s required: false - name: exclude space metrics on paths description: Do not show metrics (charts) for listed paths. This option accepts netdata simple pattern. diff --git a/src/collectors/diskspace.plugin/plugin_diskspace.c b/src/collectors/diskspace.plugin/plugin_diskspace.c index f1d8909b2..c9f6fe599 100644 --- a/src/collectors/diskspace.plugin/plugin_diskspace.c +++ b/src/collectors/diskspace.plugin/plugin_diskspace.c @@ -544,11 +544,11 @@ void *diskspace_slow_worker(void *ptr) usec_t step = slow_update_every * USEC_PER_SEC; usec_t real_step = USEC_PER_SEC; heartbeat_t hb; - heartbeat_init(&hb); + heartbeat_init(&hb, USEC_PER_SEC); while(service_running(SERVICE_COLLECTORS)) { worker_is_idle(); - heartbeat_next(&hb, USEC_PER_SEC); + heartbeat_next(&hb); if (real_step < step) { real_step += USEC_PER_SEC; @@ -629,7 +629,7 @@ static void diskspace_main_cleanup(void *pptr) { #error WORKER_UTILIZATION_MAX_JOB_TYPES has to be at least 3 #endif -int diskspace_function_mount_points(BUFFER *wb, const char *function __maybe_unused) { +static int diskspace_function_mount_points(BUFFER *wb, const char *function __maybe_unused, BUFFER *payload __maybe_unused, const char *source __maybe_unused) { netdata_mutex_lock(&slow_mountinfo_mutex); buffer_flush(wb); @@ -849,17 +849,20 @@ void *diskspace_main(void *ptr) { worker_register_job_name(WORKER_JOB_CLEANUP, "cleanup"); rrd_function_add_inline(localhost, NULL, "mount-points", 10, - RRDFUNCTIONS_PRIORITY_DEFAULT, RRDFUNCTIONS_DISKSPACE_HELP, + RRDFUNCTIONS_PRIORITY_DEFAULT, RRDFUNCTIONS_VERSION_DEFAULT, + RRDFUNCTIONS_DISKSPACE_HELP, "top", HTTP_ACCESS_ANONYMOUS_DATA, diskspace_function_mount_points); cleanup_mount_points = config_get_boolean(CONFIG_SECTION_DISKSPACE, "remove charts of unmounted disks" , cleanup_mount_points); - int update_every = (int)config_get_number(CONFIG_SECTION_DISKSPACE, "update every", localhost->rrd_update_every); - if(update_every < localhost->rrd_update_every) + int update_every = (int)config_get_duration_seconds(CONFIG_SECTION_DISKSPACE, "update every", localhost->rrd_update_every); + if(update_every < localhost->rrd_update_every) { update_every = localhost->rrd_update_every; + config_set_duration_seconds(CONFIG_SECTION_DISKSPACE, "update every", update_every); + } - check_for_new_mountpoints_every = (int)config_get_number(CONFIG_SECTION_DISKSPACE, "check for new mount points every", check_for_new_mountpoints_every); + check_for_new_mountpoints_every = (int)config_get_duration_seconds(CONFIG_SECTION_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; @@ -873,12 +876,11 @@ void *diskspace_main(void *ptr) { diskspace_slow_worker, &slow_worker_data); - usec_t step = update_every * USEC_PER_SEC; heartbeat_t hb; - heartbeat_init(&hb); + heartbeat_init(&hb, update_every * USEC_PER_SEC); while(service_running(SERVICE_COLLECTORS)) { worker_is_idle(); - /* usec_t hb_dt = */ heartbeat_next(&hb, step); + /* usec_t hb_dt = */ heartbeat_next(&hb); if(unlikely(!service_running(SERVICE_COLLECTORS))) break; |