[Nagiosplug-devel] bug with "-e" argument to check_disk [patc h included]
Voon, Ton
Ton.Voon at egg.com
Tue Jun 1 06:01:13 CEST 2004
Sean,
Which version of the plugins are you using? It looks like 1.3.1.
Does this exist in 1.4? If so, can you provide a patch against CVS HEAD and
I'll apply it.
Ton
-----Original Message-----
From: sean finney [mailto:seanius at seanius.net]
Sent: 31 May 2004 18:01
To: nagiosplug-devel at lists.sourceforge.net
Subject: [Nagiosplug-devel] bug with "-e" argument to check_disk [patch
included]
hi there,
i've been looking into getting disk space monitoring integrated into the
other nagios monitoring i'm already doing, and i think i've found a bug with
on of the command line options, "-e". the description says:
-e, --errors-only
Display only devices/mountpoints with errors
when running on a system with no disk space errors:
cork[~]12:49:49$ /usr/local/sbin/check_disk -w 15% -c 10% DISK OK [1247916
kB (63%) free on /dev/sda7] [25815 kB (26%) free on /dev/sda2] [1931628 kB
(100%) free on /dev/shm] [1768884 kB (52%) free on /dev/sda6] [7517516 kB
(76%) free on /dev/sda3] [9166460 kB (93%) free on /dev/sda5] [16410780 kB
(74%) free on /dev/emcpowerb6] [92890296 kB (78%) free on /dev/emcpowera1]
[51267056 kB (43%) free on /dev/emcpowera2] [22861384 kB (79%) free on
/dev/emcpowerb3] [7366696 kB
(51%) free on /dev/emcpowerb5]
however, when running with -e
cork[~]12:50:05$ /usr/local/sbin/check_disk -w 15% -c 10% -e Unable to read
output /bin/df -Pk
/dev/emcpowerb5 15124868 6983988 7372576 49%
/usr/local/swat
very strange indeed! even stranger, if you specify the run with the -v
option, the behaviour goes away:
cork[~]12:50:44$ /usr/local/sbin/check_disk -w 15% -c 10% -e -v /bin/df -Pk
==> DISK OK [1247900 kB (63%) free on /dev/sda7] [25815 kB
(26%) free on /dev/sda2] [1931628 kB (100%) free on /dev/shm] [1768884 kB
(52%) free on /dev/sda6] [7517516 kB (76%) free on /dev/sda3]
[9166276 kB (93%) free on /dev/sda5] [16410760 kB (74%) free on
/dev/emcpowerb6] [92899616 kB (78%) free on /dev/emcpowera1] [51266780 kB
(43%) free on /dev/emcpowera2] [22861368 kB (79%) free on /dev/emcpowerb3]
[7326368 kB (51%) free on /dev/emcpowerb5]
some investigation turned up what looks like a bug in the flow of execution
in the main while loop processing the output of df, which causes the last
processed line to always have result == STATE_UNKNOWN.
specifically, line 121-122:
if (disk_result==STATE_OK && erronly && !verbose)
continue
result is not set to the value of disk_result (via calling max_state at the
end of the while loop, which is skipped by this continue statement), and as
such is still in STATE_UNKNOWN.
attached is a very short patch (diff -u) which i believe fixes the problem.
sean
ps - please cc me with any correspondance, i'm not subscribed to the
list
This private and confidential e-mail has been sent to you by Egg.
The Egg group of companies includes Egg Banking plc
(registered no. 2999842), Egg Financial Products Ltd (registered
no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
is authorised and regulated by the Financial Services Authority. Egg
Investments Ltd. is entered in the FSA register under number 190518.
Registered in England and Wales. Registered offices: 1 Waterhouse
Square, 138-142 Holborn, London EC1N 2NA.
If you are not the intended recipient of this e-mail and have received
it in error, please notify the sender by replying with 'received in
error' as the subject and then delete it from your mailbox.
More information about the Devel
mailing list