summaryrefslogtreecommitdiffstats
path: root/src/plugin_proc_diskspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugin_proc_diskspace.c')
-rw-r--r--src/plugin_proc_diskspace.c70
1 files changed, 40 insertions, 30 deletions
diff --git a/src/plugin_proc_diskspace.c b/src/plugin_proc_diskspace.c
index 52c1f5ae6..e41e76182 100644
--- a/src/plugin_proc_diskspace.c
+++ b/src/plugin_proc_diskspace.c
@@ -227,6 +227,12 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
fsfilcnt_t freserved_root = favail_root - favail;
fsfilcnt_t fused = ftotal - favail_root;
+ if(m->do_inodes == CONFIG_BOOLEAN_AUTO && favail == (fsfilcnt_t)-1) {
+ // this file system does not support inodes reporting
+ // eg. cephfs
+ m->do_inodes = CONFIG_BOOLEAN_NO;
+ }
+
#ifdef NETDATA_INTERNAL_CHECKS
if(unlikely(btotal != bavail + breserved_root + bused))
error("DISKSPACE: disk inode statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)ftotal, (unsigned long long)favail, (unsigned long long)freserved_root, (unsigned long long)fused);
@@ -251,6 +257,8 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
, "disk.space"
, title
, "GB"
+ , "diskspace"
+ , NULL
, 2023
, update_every
, RRDSET_TYPE_STACKED
@@ -289,6 +297,8 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
, "disk.inodes"
, title
, "Inodes"
+ , "diskspace"
+ , NULL
, 2024
, update_every
, RRDSET_TYPE_STACKED
@@ -384,21 +394,21 @@ void *proc_diskspace_main(void *ptr) {
getrusage(RUSAGE_THREAD, &thread);
- if(!stcpu_thread) {
- stcpu_thread = rrdset_find_localhost("netdata.plugin_diskspace");
- if(!stcpu_thread)
- stcpu_thread = rrdset_create_localhost(
- "netdata"
- , "plugin_diskspace"
- , NULL
- , "diskspace"
- , NULL
- , "NetData Disk Space Plugin CPU usage"
- , "milliseconds/s"
- , 132020
- , update_every
- , RRDSET_TYPE_STACKED
- );
+ if(unlikely(!stcpu_thread)) {
+ stcpu_thread = rrdset_create_localhost(
+ "netdata"
+ , "plugin_diskspace"
+ , NULL
+ , "diskspace"
+ , NULL
+ , "NetData Disk Space Plugin CPU usage"
+ , "milliseconds/s"
+ , "diskspace"
+ , NULL
+ , 132020
+ , update_every
+ , RRDSET_TYPE_STACKED
+ );
rd_user = rrddim_add(stcpu_thread, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
rd_system = rrddim_add(stcpu_thread, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
@@ -412,21 +422,21 @@ void *proc_diskspace_main(void *ptr) {
// ----------------------------------------------------------------
- if(!st_duration) {
- st_duration = rrdset_find_localhost("netdata.plugin_diskspace_dt");
- if(!st_duration)
- st_duration = rrdset_create_localhost(
- "netdata"
- , "plugin_diskspace_dt"
- , NULL
- , "diskspace"
- , NULL
- , "NetData Disk Space Plugin Duration"
- , "milliseconds/run"
- , 132021
- , update_every
- , RRDSET_TYPE_AREA
- );
+ if(unlikely(!st_duration)) {
+ st_duration = rrdset_create_localhost(
+ "netdata"
+ , "plugin_diskspace_dt"
+ , NULL
+ , "diskspace"
+ , NULL
+ , "NetData Disk Space Plugin Duration"
+ , "milliseconds/run"
+ , "diskspace"
+ , NULL
+ , 132021
+ , update_every
+ , RRDSET_TYPE_AREA
+ );
rd_duration = rrddim_add(st_duration, "duration", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
}