From: Paul Sadauskas Date: Thu, 30 Jul 2009 06:31:58 +0000 (+0200) Subject: collectd.conf(5): Add new config option. X-Git-Tag: collectd-4.8.0~69 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=3ada23491952cc01baadd19ffeba27e0c332f0c1;p=collectd.git collectd.conf(5): Add new config option. --- 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 {