From af9b05b8c7651d01a46c5af9b9a56192e0f4adde Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 2 Oct 2009 11:35:43 +0200 Subject: [PATCH] df plugin: Implement the "ReportInodes" option. This option can be used to enable / disable inode statistics collection. Defaults to "false" for now. --- src/collectd.conf.pod | 9 +++++++++ src/df.c | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 7a641895..ae56da3d 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -899,6 +899,15 @@ set to "free", "reserved" and "used" as appropriate. Enabling this option is recommended. +=item B B|B + +Enables or disables reporting of free, reserved and used inodes. Defaults to +inode collection being disabled. + +Enable this option if inodes are a scarce resource for you, usually because +many small files are stored on the disk. This is a usual scenario for mail +transfer agents and web caches. + =back =head2 Plugin C diff --git a/src/df.c b/src/df.c index 66daab26..62775fd2 100644 --- a/src/df.c +++ b/src/df.c @@ -51,7 +51,8 @@ static const char *config_keys[] = "FSType", "IgnoreSelected", "ReportByDevice", - "ReportReserved" + "ReportReserved", + "ReportInodes" }; static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); @@ -61,6 +62,7 @@ static ignorelist_t *il_fstype = NULL; static _Bool by_device = false; static _Bool report_reserved = false; +static _Bool report_inodes = false; static int df_init (void) { @@ -128,6 +130,15 @@ static int df_config (const char *key, const char *value) return (0); } + else if (strcasecmp (key, "ReportInodes") == 0) + { + if (IS_TRUE (value)) + report_inodes = true; + else + report_inodes = false; + + return (0); + } return (-1); @@ -292,6 +303,7 @@ static int df_read (void) } /* inode handling */ + if (report_inodes) { uint64_t inode_free; uint64_t inode_reserved; -- 2.30.2