[Nagiosplug-devel] [ nagiosplug-Patches-2924632 ] Add a --human-readable option to check_disk

SourceForge.net noreply at sourceforge.net
Fri Jan 1 20:53:12 CET 2010


Patches item #2924632, was opened at 2010-01-01 19:53
Message generated for change (Tracker Item Submitted) made by 
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=2924632&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Enhancement
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: elmo ()
Assigned to: Nobody/Anonymous (nobody)
Summary: Add a --human-readable option to check_disk

Initial Comment:
I recently switched all our machines to use '-u GB' with check_disk
which was a vast improvement for most machines.  However it's turns
out to be less useful for small drives, e.g.

| $ /usr/lib/nagios/plugins/check_disk -u GB -w 40% -c 20% -p /
| DISK WARNING - free space: / 0 GB (35% inode=74%);| /=1GB;0;0;0;1

To try and work around this, I added a --human-readable option, a la
GNU df(1), e.g.

| $ ./check_disk --human-readable -w 40% -c 20% -p /
| DISK WARNING - free space: / 632M (35% inode=74%);| /=1163MB;1134;1512;0;1891

I've attached the patch I used to do this; would it be possible to
include it (or something like it) in future releases of
nagios-plugins?

A few notes:

 1) It requires importing the 'human' module from gnulib into 'gl'.  I
    didn't attach a patch to do this, since the resulting patch is
    messy and very dependent on the versions of auto* and gnulib on my
    local system.  If you want such a patch anyway, I'll be happy to
    provide one.

 2) It's based on 1.4.13+git200906171200 because that's the version in
    Ubuntu right now; if you want a patch rebased against current git,
    please let me know.

 3) I chose to avoid altering the performance data and separated the
    new option from -u/--units as that seemed to make the most sense
    to me but if you want it done differently, I'm happy to do that
    too.

 4) I used --human-readable and 'Z' (internally only) as the options;
    this is different from df(1) which dedicates -h to the option, but
    I assumed consistency with other plugins would trump consistency
    with df(1)?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=2924632&group_id=29880




More information about the Devel mailing list