[collectd] [RFC] df plugin and df_complex use df_submit_three

Carlos Alberto Lopez Perez clopez at igalia.com
Wed Dec 28 18:43:10 CET 2011


On 26/12/11 21:31, Carlos Alberto Lopez Perez wrote:
> Hello,
> 
> 
> I am trying to configure a threshold for sending alerts when the
> disk-free is below the 5% but using the complex type of df (the one that
> takes into account the reserved blocks)
> 
> 
> I have:
> 
> 
> [...]
> 
> <Plugin df>
>        FSType "ext3"
>        ReportReserved true
> </Plugin>
> 
> [...]
> 
> <Threshold>
>        <Plugin "df">
>                <Type "df_complex">
>                        DataSource "free"
>                        Percentage true
>                        WarningMin 5.0
>                        FailureMin 2.0
>                </Type>
>        </Plugin>
> </Threshold>
> 
> [...]
> 
> However I get lot of warnings from collectd saying this:
> 
> ut_check_one_threshold: The df_complex type has only one data source,
> but you have configured to check this as a percentage. That doesn't make
> much sense, because the percentage will always be 100%!
> 
> 
> I am running collectd 4.9.1
> 
> 
> What I am doing wrong?
> 
> 
> Thanks!
> 
> 
> 
> 
> 
> 
> _______________________________________________
> collectd mailing list
> collectd at verplant.org
> http://mailman.verplant.org/listinfo/collectd


Since I didn't got any reply I dig on the man page and the code and I
found that the df plugin is not sending a type df_complex with tree
datasources (free,reserved,used) like I would expect.

Instead what the df plugin is doing, is send three independent instances
df_complex_free, df_complex_reserved and df_complex_used.

Therefore it makes impossible to configure a threshold with percentages
(AFAIK).

See this code from "src/df.c"

[...]

if (report_reserved)
{
        uint64_t blk_free;
        uint64_t blk_reserved;
        uint64_t blk_used;

        /* Sanity-check for the values in the struct */
        if (statbuf.f_bfree < statbuf.f_bavail)
                statbuf.f_bfree = statbuf.f_bavail;
        if (statbuf.f_blocks < statbuf.f_bfree)
                statbuf.f_blocks = statbuf.f_bfree;

        blk_free = (uint64_t) statbuf.f_bavail;
        blk_reserved = (uint64_t) (statbuf.f_bfree - statbuf.f_bavail);
        blk_used = (uint64_t) (statbuf.f_blocks - statbuf.f_bfree);

        df_submit_one (disk_name, "df_complex", "free",
                        (gauge_t) (blk_free * blocksize));
        df_submit_one (disk_name, "df_complex", "reserved",
                        (gauge_t) (blk_reserved * blocksize));
        df_submit_one (disk_name, "df_complex", "used",
                        (gauge_t) (blk_used * blocksize));
}
else /* compatibility code */
{
        gauge_t df_free;
        gauge_t df_used;

        df_free = statbuf.f_bfree * blocksize;
        df_used = (statbuf.f_blocks - statbuf.f_bfree) * blocksize;

        df_submit_two (disk_name, "df", df_used, df_free);
}

[...]


Why you are doing this?

Wouldn't it better to make a

df_submit_three (disk_name, "df_complex", df_used, df_free, df_reserved)

instead of the three df_submit_ones ?

like the load plugin does (function load_submit) ????


Is there any reason that I am missing that prevents yo to use a function
like df_submit_three for the df_complex type?



Is there any way with the current code to configure a threshold that
triggers when the df_free of a *df_complex* type is below 5% ?




-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carlos Alberto Lopez Perez                           http://neutrino.es
Igalia - Free Software Engineering                http://www.igalia.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20111228/6ae61baf/attachment.pgp>


More information about the collectd mailing list