[Pkg-nagios-devel] Bug#564005: nagios-plugins-basic: check_tcp -e option doesn't work on Lenny
Geoff Crompton
geoff at cromp.id.au
Thu Jan 7 00:48:01 UTC 2010
Package: nagios-plugins-basic
Version: 1.4.12-5
Severity: normal
When using the -e flag the check_tcp plugin returns CRITICAL even though
the remote service does send through the expected string. It should be
returning OK.
For example, here is check_tcp incorrectly returning CRITICAL
geoffc at monit01:~$ /usr/lib/nagios/plugins/check_tcp -H ian -p 8000 -d 1
-s 'NOOP' -e 'OK 0' -q 'QUIT'
CRITICAL - Socket timeout after 10 seconds
However this works:
geoffc at monit01:/etc/nagios3/nagios.d$ /usr/lib/nagios/plugins/check_tcp
-H ian -p 8000 -d 1 -s 'NOOP' -q 'QUIT'
TCP OK - 0.001 second response time on port
8000|time=0.000902s;;;0.000000;10.000000
A manual netcat session shows the string used in the -e flag is sent by
the server:
geoffc at monit01:~$ nc ian 8000
NOOP
OK 0
QUIT
Quitting...
I did some investigation, and found something with strace that might
help solve the problem. Running check_tcp with strace shows the
following snippet:
geoffc at chiraz-60:~/rt/37751$ strace /usr/lib/nagios/plugins/check_tcp -H
ian -p 8000 -d 1 -s 'NOOP' -q 'QUIT' -e 'OK 0'
...
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(8000),
sin_addr=inet_addr("203.28.
240.55")}, 16) = 0
send(3, "NOOP"..., 4, 0) = 4
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0}) = 0
read(3, 0x804f4e0, 1024) = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---
...
It looks like when check_tcp receives the ERESTARTSYS return code, it
decides to return critical. According to
http://lkml.indiana.edu/hypermail/linux/kernel/0104.0/0743.html userland
shouldn't receive this signal, but that post is from 2001, so I don't
know if that is a red herring.
I haven't yet been able to confirm if this bug is present in sid.
-- System Information:
Debian Release: 5.0.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages nagios-plugins-basic depends on:
ii iputils-ping 3:20071127-1 Tools to test the
reachability of
ii libc6 2.7-18 GNU C Library: Shared libraries
ii libssl0.9.8 0.9.8g-15+lenny5 SSL shared libraries
ii procps 1:3.2.7-11 /proc file system utilities
ii ucf 3.0016 Update Configuration File:
preserv
nagios-plugins-basic recommends no packages.
Versions of packages nagios-plugins-basic suggests:
pn nagios3 <none> (no description available)
-- no debconf information
--
+-Geoff Crompton
+--Debian System Administrator
+---Trinity College
More information about the Pkg-nagios-devel
mailing list