Code

df plugin: when checking / do it just once
authorBruno Prémont <bonbons@linux-vserver.org>
Wed, 21 Mar 2012 20:34:00 +0000 (21:34 +0100)
committerFlorian Forster <octo@collectd.org>
Fri, 7 Sep 2012 08:48:38 +0000 (10:48 +0200)
Newer system symlink /etc/mtab to /proc/mounts which makes root
filesystem seem mounted twice, once as type rootfs and once for the
real device.

When / is selected for df plugin, skip the rootfs mount-point as
real root is usually mounted right on top of it.

Not skipping it causes rrdtool to complain about two updates for the
same timestamp, the first entry for rootfs passes but rrdtool complains
when stats for the second occurrence for real filesystem is being
considered.

Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Florian Forster <octo@collectd.org>
src/df.c

index 22264d30228f5f8d8f5946beec819f20844cfd7f..dc7be1ebd8238a3f6913819c1d406d3f4130ae6c 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -257,6 +257,8 @@ static int df_read (void)
                {
                        if (strcmp (mnt_ptr->dir, "/") == 0)
                        {
+                               if (strcmp (mnt_ptr->type, "rootfs") == 0)
+                                       continue;
                                sstrncpy (disk_name, "root", sizeof (disk_name));
                        }
                        else