From 3ada23491952cc01baadd19ffeba27e0c332f0c1 Mon Sep 17 00:00:00 2001 From: Paul Sadauskas Date: Thu, 30 Jul 2009 08:31:58 +0200 Subject: [PATCH] collectd.conf(5): Add new config option. --- src/collectd.conf.pod | 6 ++++++ src/df.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 8a5f6fde..64837553 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -870,6 +870,12 @@ match any one of the criteria are collected. By default only selected partitions are collected if a selection is made. If no selection is configured at all, B partitions are selected. +=item B I|I + +Report using the device name rather than the mountpoint. i.e. with this I, +(the default), it will report a disk as "root", but with it I, it will be +"sda1" (or whichever). + =back =head2 Plugin C diff --git a/src/df.c b/src/df.c index dedf1bf5..a9c1bdb7 100644 --- a/src/df.c +++ b/src/df.c @@ -117,7 +117,7 @@ static int df_config (const char *key, const char *value) || (strcasecmp (value, "Yes") == 0) || (strcasecmp (value, "On") == 0)) { - by_device = false; + by_device = true; } return (0); } @@ -187,7 +187,12 @@ static int df_read (void) if (by_device) { // eg, /dev/hda1 -- strip off the "/dev/" - strncpy (disk_name, mnt_ptr->device + 5, sizeof (disk_name)); + strncpy (disk_name, mnt_ptr->spec_device + 5, sizeof (disk_name)); + if (strlen(disk_name) < 1) + { + DEBUG("df: no device name name for mountpoint %s, skipping", mnt_ptr->dir); + continue; + } } else { -- 2.30.2