[collectd] df plugin and statfs/statvfs

Martin B. Smith smithmb at ufl.edu
Sat Mar 12 01:08:21 CET 2011

Hello again,

On 03/11/2011 05:57 PM, Florian Forster wrote:
 > Hi,
 > On Fri, Mar 11, 2011 at 05:14:40PM -0500, Martin B. Smith wrote:
 >> >  Would you think that a reasonable behavior when mount points are
 >> >  explicitly given in the config would be that they shouldn't be 
 >> >  against getmntent? Or that statvfs() should be called before
 >> >  getmntent()  and then again after? I'd be happy to provide a patch
 >> >  either way.
 > the way this currently works is that the mount points configured are an
 > "ignore list", i.e. you can put "/foobar" in there and it won't complain
 > if such a directory doesn't exist. It merely black / white lists mount
 > points (depending on the "IgnoreSelected" setting).
 > Wouldn't it be an easy solution to simply mount the NFS share on the
 > machine? Why go through all the trouble of involving automount?

We have replicated NFS across multiple sites, and these mounts get new 
files deposited on them periodically. And when the devices do IP 
takeover (e.g. maintenance), it's much nicer after an NFS maintenance to 
have the automounter remount than deal with broken static mounts on 300+ 

 > If you want to implement this, I'd suggest to introduce a new
 > 'ForceMountPoint "/foo"' setting which can be repeated to add multiple
 > directories. The plugin would then behave like this:
 >    for each<mount point>  in [force mount point]
 >      get and submit stats;
 >    for each<mount point>  in getmntent()
 >      if<mount point>  is in [force mount point]
 >        has already been handled, ignore;
 >      else
 >        proceed as-is (i.e. check the three ignore lists and possibly
 >        query and submit the values).
 > Does this sound reasonable to you? Since the directory given isn't
 > necessarily a mount point, maybe "ForceDirectory" would be a better
 > name. What do you think?

Is there any risk running a statvfs() or statfs() on anything listed as 
a "MountPoint" before the existing 'for' loop? If you do that, anything 
that is valid and automountable will suddenly appear in /etc/mtab, and 
subsequently show up in getmntent() too.

 > Best regards,
 > —octo

Thanks for the all the help!
Martin B. Smith
smithmb at ufl.edu - (352) 273-1374
CNS/Open Systems Group
University of Florida

More information about the collectd mailing list