[collectd] df plugin and statfs/statvfs
Martin B. Smith
smithmb at ufl.edu
Fri Mar 11 23:14:40 CET 2011
On 03/11/2011 03:45 PM, Florian Forster wrote:
> Hi Martin,
> On Fri, Mar 11, 2011 at 01:33:36PM -0500, Martin B. Smith wrote:
>> > Can anyone wager any other reason why this might not work? Any advice?
> the "df" plugin reads a list of mountpoints (using getmntent(3) when on
> Linux) and calls statvfs(2) only for returned directories. I assume that
> unless the filesystem is in fact mounted, possible targets of
> automounter are not returned by getmntent(3).
Ah, that'll do it. I must have missed getmntent() somewhere when
scanning through df.c. Thank you for pointing that out :)
I'm actually explicitly specifying the 'automountable' directories, so I
wasn't expecting the 'df' plugin to check if the mount was currently
mounted -- I was hoping it would just call statvfs() on what I told it
should be checked.
Would you think that a reasonable behavior when mount points are
explicitly given in the config would be that they shouldn't be checked
against getmntent? Or that statvfs() should be called before getmntent()
and then again after? I'd be happy to provide a patch either way.
> If you use the file system and it is actually mounted, collectd should
> pick it up and report statistics. I don't know if this counts as "usage"
> of the file system, so it might be that it these file systems are not
> unmounted automatically when collectd is running [*].
Indeed, on automounted filesystems that go up and down, I get slices of
time where the df plugin returns interesting data split between slices
of time where it doesn't see the mount.
> Hope this helps,
> [*] Given that nobody has complained about this yet, I guess this is not
This leaves me in a weird situation. I have some NFS appliances that I
cannot run collectd on, and I'd prefer to have the same style and format
of output data on those as I do on regular Linux machines.
What do you think of my two options of calling statvfs() once before
getmntent() or ignoring getmntent() when a mount point is explicitly
Martin B. Smith
smithmb at ufl.edu - (352) 273-1374
CNS/Open Systems Group
University of Florida
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5497 bytes
Desc: S/MIME Cryptographic Signature
More information about the collectd