NRPE gives wrong exit codes
Ciro Iriarte
cyruspy at gmail.com
Fri Sep 4 23:48:50 CEST 2009
2009/9/4 Marc Powell <marc at ena.com>:
>
> On Sep 4, 2009, at 2:30 PM, Ciro Iriarte wrote:
>
>>> It's weird, if I restart the daemon it works, but just for the
>>> first execution.
>>>
>>> ---------
>>> spmon:/etc/nagios/objects/services #
>>> /usr/lib/nagios/plugins/check_nrpe -H billbd2 -c check_disk -a 90%
>>> 80%
>>> /kml_inst2
>>> DISK CRITICAL - free space: /kml_inst2 76172 MB (21% inode=100%);|
>>> /kml_inst2=273552MB;34972;69944;0;349725
>>> spmon:/etc/nagios/objects/services # echo $?
>>> 2
>>> spmon:/etc/nagios/objects/services #
>>> /usr/lib/nagios/plugins/check_nrpe -H billbd2 -c check_disk -a 90%
>>> 80%
>>> /kml_inst2
>>> DISK CRITICAL - free space: /kml_inst2 76172 MB (21% inode=100%);|
>>> /kml_inst2=273552MB;34972;69944;0;349725
>>> spmon:/etc/nagios/objects/services # echo $?
>>> 0
>>> ----------
>>>
>>> Regards,
>>>
>>
>> Any ideas?.
>
> Never seen it before.
>
> Don't test as root.
>
> Try using truss on check_nrpe to verify that you're getting the right
> exit code back from the remote host.
>
> --
> Marc
I'm running linux on the nagios end.... I ran truss attached to the
NRPE service. This are two executions, the first one from the check
that works and the second one with the critical message + exit code=0.
---- Exit code = 2 - Fine -----
25565: stat("/kml_inst2", 0x0003CB28) = 0
25565: stat("/kml_inst2", 0x0003CB28) = 0
25565: statvfs("/kml_inst2", 0xFFBFFAA8) = 0
25565: ioctl(1, TCGETA, 0xFFBFED5C) Err#22 EINVAL
25565: fstat64(1, 0xFFBFEDD0) = 0
25565: fstat64(1, 0xFFBFEC78) = 0
25565: write(1, " D I S K C R I T I C A".., 108) = 108
25565: _exit(2)
25561: read(6, " D I S K C R I T I C A".., 5120) = 108
25563: waitid(P_PID, 25565, 0xFFBFFA28, WEXITED|WTRAPPED|WNOWAIT) = 0
25563: ioctl(0, TIOCGPGRP, 0xFFBFFA44) Err#6 ENXIO
25563: getpgid(25565) = 25561
25563: ioctl(0, TIOCGPGRP, 0xFFBFFA44) Err#6 ENXIO
25563: waitid(P_PID, 25565, 0xFFBFFA28, WEXITED|WTRAPPED) = 0
25563: brk(0x0003AA20) = 0
25563: _exit(2)
25561: read(6, 0x000B2DBC, 5120) = 0
25561: write(8, " D I S K C R I T I C A".., 108) = 108
25561: llseek(6, 0, SEEK_CUR) Err#29 ESPIPE
25561: close(6) = 0
25561: waitid(P_PID, 25563, 0xFFBFC560, WEXITED|WTRAPPED) = 0
25561: close(8) = 0
25561: alarm(0) = 60
25561: lseek(1, 0, SEEK_CUR) = 0
25561: lseek(2, 0, SEEK_CUR) = 0
25561: lseek(2, 0, SEEK_CUR) = 0
25561: lseek(1, 0, SEEK_CUR) = 0
25561: lseek(2, 0, SEEK_CUR) = 0
25561: lseek(2, 0, SEEK_CUR) = 0
25561: write(5, " 005020102 B\0", 7) = 7
25561: close(5) = 0
25561: close(3) = 0
25561: _exit(2)
------------------
-------- Exit code 0 - Wrong! ----------
1383: stat("/kml_inst2", 0x0003CB28) = 0
1383: stat("/kml_inst2", 0x0003CB28) = 0
1383: statvfs("/kml_inst2", 0xFFBFFAA8) = 0
1383: ioctl(1, TCGETA, 0xFFBFED5C) Err#22 EINVAL
1383: fstat64(1, 0xFFBFEDD0) = 0
1383: fstat64(1, 0xFFBFEC78) = 0
1383: write(1, " D I S K C R I T I C A".., 108) = 108
1383: _exit(2)
1379: read(6, " D I S K C R I T I C A".., 5120) = 108
1381: waitid(P_PID, 1383, 0xFFBFFA28, WEXITED|WTRAPPED|WNOWAIT) = 0
1381: ioctl(0, TIOCGPGRP, 0xFFBFFA44) Err#6 ENXIO
1381: getpgid(1383) = 1379
1381: ioctl(0, TIOCGPGRP, 0xFFBFFA44) Err#6 ENXIO
1381: waitid(P_PID, 1383, 0xFFBFFA28, WEXITED|WTRAPPED) = 0
1381: brk(0x0003AA20) = 0
1381: _exit(2)
1379: read(6, 0x000B2DBC, 5120) = 0
1379: write(8, " D I S K C R I T I C A".., 108) = 108
1379: llseek(6, 0, SEEK_CUR) Err#29 ESPIPE
1379: close(6) = 0
1379: waitid(P_PID, 1381, 0xFFBFC560, WEXITED|WTRAPPED) = 0
1379: close(8) = 0
1379: alarm(0) = 60
1379: lseek(1, 0, SEEK_CUR) = 0
1379: lseek(2, 0, SEEK_CUR) = 0
1379: lseek(2, 0, SEEK_CUR) = 0
1379: lseek(1, 0, SEEK_CUR) = 0
1379: lseek(2, 0, SEEK_CUR) = 0
1379: lseek(2, 0, SEEK_CUR) = 0
1379: write(5, " 005020102 B\0", 7) Err#32 EPIPE
1379: Received signal #13, SIGPIPE [default]
1377: waitid(P_PID, 1379, 0xFFBFC568, WEXITED|WTRAPPED) = 0
1377: time() = 1252097350
1377: read(6, " D I S K C R I T I C A".., 2047) = 108
1377: close(6) = 0
----------------
This doesn't seem right in the second execution compared with the first one:
----------
1379: write(5, " 005020102 B\0", 7) Err#32 EPIPE
1379: Received signal #13, SIGPIPE [default]
----------
Regards,
--
Ciro Iriarte
http://cyruspy.wordpress.com
--
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list