[collectd] [PATCH] df plugin also collects inode count now.

Florian Forster octo at verplant.org
Fri Oct 2 08:42:46 CEST 2009


Hi Patrik,

On Thu, Oct 01, 2009 at 01:57:10PM +0200, Patrik Weiskircher wrote:
> diff --git a/src/df.c b/src/df.c

thanks for your patch :)

Looking at the `struct statvfs' just now I noticed that we don't handle
blocks reserved for root separately. I'll probably write a patch
allowing the user to enable a separation here in a backwards compatible
fashion.

Patrik, could you change the inode code to do this right from the start
so we don't need all this backwards compatibility business? I think the
best way would be to change the "df_inodes" type from
> +df_inodes               used:GAUGE:0:1125899906842623, free:GAUGE:0:1125899906842623
to
   df_inodes value:GAUGE:0:U
(spare the maximum - we don't have any counters involved so if we
subtract carefully no wraparound will happen ;)

Then calculate used space correctly:
  if ((statbuf.f_ffree < statbuf.f_favail)
      || (statbuf.f_files < statbuf.f_ffree))
    continue;
  df_inodes_norm_free = statbuf.f_favail;
  df_inodes_resv_free = statbuf.f_ffree - statbuf.f_favail;
  df_inodes_used      = statbuf.f_files - statbuf.f_ffree;

That'd be great ;) I've already pushed your patch to the master branch,
so you can start from there.

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20091002/0cb0e46b/attachment.pgp 


More information about the collectd mailing list