[Nagiosplug-devel] check_udp
Ton Voon
ton.voon at altinity.com
Thu Mar 23 06:07:09 CET 2006
On 23 Mar 2006, at 12:59, sean finney wrote:
> On Thu, Mar 23, 2006 at 10:49:20AM +0000, Ton Voon wrote:
>> Since udp is connectionless, a check_udp -H hostname -p port is
>> useless - it will always return OK. Will need the send and receive to
>> work in order to prove that data is being sent and responded to.
>> However, it looks like the send and receive functions do not
>> currently work. It seems that you cannot use the send function, so
>> you have to use the sendto function. However, I'm having trouble
>> setting up the hostname and socket and how it should interact with
>> np_net_connect.
>
> by send/recieve, to you mean the "send/expect", or the send/sendto/
> recv
> functions? for the former i'm not sure what can be done if there
> isn't some data to send (send an arbitrary packet and see what
> happens? bail with an error?). for the latter, i don't think
> they're at all necessary. np_net_connect (or my_udp_connect,
> or even process_udp_request) should make the need for these
> functions moot, as you can use the standard read/write calls
> on the file descriptor you get back. or am i misunderstanding?
>
>> Anyone willing to take a look at this? Please reply to list or
>> offline if you are.
>
> sure, though i won't have time until later tonight. it shouldn't be
> too hard to figure out what's going on (assuming the above can be
> clarified) with a little netcat and possibly tcpdump assistance.
Sorry, my mistake. I've been working on MacOSX and it defaults to
IPv6. nc -l -p 3333 -u uses IPv4 and then when I tried check_udp, it
defaulted to IPv6 and thus looked like it wasn't sending any data.
From CVS HEAD (on Debian):
./configure
cd plugins
make check_tcp
rm -f check_udp
ln -s check_tcp check_udp
./check_udp -H localhost -p 3333 # will always return OK. Is
this right?
./check_udp -H 10.10.10.10 -p 3333 # will always return OK. Is
this right if the host does not exist?
nc -l -p 3333 -u &
./check_udp -H localhost -p 3333 -s foo # nc will show foo being
received, as expected (on systems with IPv6 as default (like MacOSX),
need -4 flag)
kill %1
nc -l -p 3333 -u &
./check_udp -H localhost -p 3333 -s foo -e bar # Will timeout
waiting for response. Correct?
kill %1
I guess my real question is: what should be in the test script for
check_udp?
At the moment, the tests for check_udp are:
./check_udp -H $some_time_server -p 37 -w 300 -c 600 # but this
will always be OK ?!
./check_udp -H $non_responsive_host -p 37 -w 0 -c 0 -t 1 # should
return CRITICAL, but is currently OK
This confusion is due to my lack of understanding of UDP, but I'm
happy to keep this hole because others are more knowledgeable.
However, I just want to know what tests need to be setup to prove or
disprove that check_udp is working. Can anyone give me some examples
of what commands should be run and what output I should expect and
I'll put that into the test scripts?
Ton
http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon
More information about the Devel
mailing list