[collectd] [PATCH] df plugin: when checking / do it just once

Bruno Prémont bonbons at linux-vserver.org
Wed Mar 21 21:34:00 CET 2012


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 at linux-vserver.org>
---
diff -NurpP collectd-5.0.1.orig/src/df.c collectd-5.0.1/src/df.c
--- collectd-5.0.1.orig/src/df.c	2011-10-14 22:49:49.000000000 +0200
+++ collectd-5.0.1/src/df.c	2011-11-01 18:21:04.124973135 +0100
@@ -228,6 +228,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



More information about the collectd mailing list