[Nagiosplug-devel] bug with "-e" argument to check_disk [patch included]
carole verdon
verdon at cict.fr
Tue Jun 1 05:41:02 CEST 2004
Hi,
I haven't got the same error. On the other hand, i have another problem.
If i execute this command ./check_disk -e -w 10% -c 5% -X lofs -X nfs, i
obtain the following result that i don't understand:
DISK CRITICAL - free space: /var/mail.avant.coque 1085 MB (10%);
/aurore6 305 MB (8%); /aurore9 1546 MB (8%); /aurore14 4666 MB (94%);
/aurore15 3384 MB (70%);| /=996MB;2292;2419;0;2547
/tmp=4333MB;3899;4116;0;4333
/var/mail.avant.coque=1085MB;9983;10538;0;11093
/usr/local=759MB;3631;3833;0;4035 /aurore1=1721MB;2723;2874;0;3026
/aurore2=1185MB;2723;2874;0;3026 /aurore3=3803MB;3902;4119;0;4336
/aurore4=1023MB;3631;3833;0;4035 /aurore5=1031MB;3631;3833;0;4035
/aurore6=304MB;3631;3833;0;4035 /aurore7=2127MB;2257;2382;0;2508
/aurore8=12265MB;18152;19160;0;20169 /aurore9=1546MB;18152;19160;0;20169
/aurore10=3421MB;18152;19160;0;20169
/aurore11=9207MB;18152;19160;0;20169
/aurore12=14657MB;15954;16840;0;17727
/aurore13=24646MB;34092;35986;0;37881 /aurore14=4665MB;4954;4954;0;4954
/aurore15=3384MB;4840;4840;0;4840
Why the output displays "/aurore14 4666 MB (94%)" and "/aurore15 3384
MB (70%)" whereas they have respectively 94% and 70% of free space?
Does your patch correct also this error ?
Carole.
sean finney wrote:
>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
>
>
>------------------------------------------------------------------------
>
>--- check_disk.c.old 2004-05-31 12:04:37.000000000 -0400
>+++ check_disk.c 2004-05-31 12:45:11.000000000 -0400
>@@ -118,8 +118,10 @@
> if (strcmp (file_system, "none") == 0)
> strncpy (file_system, mntp, MAX_INPUT_BUFFER-1);
>
>- if (disk_result==STATE_OK && erronly && !verbose)
>+ if (disk_result==STATE_OK && erronly && !verbose){
>+ result = max_state (result, disk_result);
> continue;
>+ }
>
> if (disk_result!=STATE_OK || verbose>=0)
> asprintf (&output, "%s [%.0f kB (%d%%) free on %s]", output,
>
>
--
**********************************
VERDON Carole
Ingénieur Système
CICT - Université Paul Sabatier
118, route de Narbonne
31062 Toulouse Cedex
Tél.: 05.61.36.60.44
Fax: 05.61.52.14.58
Mail: verdon at cict.fr
**********************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20040601/4759d7f2/attachment.html>
More information about the Devel
mailing list