From: Florian Forster Date: Fri, 2 Oct 2009 09:35:43 +0000 (+0200) Subject: df plugin: Implement the "ReportInodes" option. X-Git-Tag: collectd-4.9.0~57 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=af9b05b8c7651d01a46c5af9b9a56192e0f4adde;p=collectd.git df plugin: Implement the "ReportInodes" option. This option can be used to enable / disable inode statistics collection. Defaults to "false" for now. --- 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;