check_disk perfdata as percentages

eponymous alias eponymousalias at
Mon Dec 16 17:07:10 CET 2013

The check_disk plugin has a lot of flexibility in how it presents
its results, but in one particular way it is rigid.  And that is,
it always prints the perfdata in absolute space units.  It's true
that this provides all the data needed, but in some situations it
would be more convenient if the perfdata space measurements were
presented as percentages.

I would like to modify the check_disk plugin to provide this
capability.  My first thought was to provide a "-u %" option.
But that would also disturb the readable message output:

    % ./check_disk -w 20% -c 10% -p /
    DISK WARNING - free space: / 1425 MB (13% inode=75%);| /=9299MB;8666;9749;0;10833

There we see that the space is listed in the message as an absolute
value in MB (reasonable in that context), and imposing a "-u %"
option would necessarily default the "MB" measurement for that
absolute value, by disallowing other -u settings.

So I propose instead to support a -P (--percentage-perfdata)
option, with no arguments, to convert the perfdata (only) to all
percentage values:

    % ./check_disk -w 20% -c 10% -p / -P
    DISK WARNING - free space: / 1425 MB (13% inode=75%);| /=86%;80;90;0;100

Does this seem to folks here like a reasonable design?  If so,
I'll make the code changes, test, and contribute them back here.

More information about the Devel mailing list