monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request: UDP generic protocol testing


From: Jan-Henrik Haukeland
Subject: Re: Feature request: UDP generic protocol testing
Date: Sat, 29 Oct 2005 01:58:43 +0200


On 22. okt. 2005, at 03.43, Alex Black wrote:

There are a number of things I'd like to test for using Monit that answer on UDP, for example SIP and IAX (voip protocols). Could functionality be added so send/expect can be used with UDP sockets as well as TCP stream sockets?

I have studied this and have one question. Are you sure that send/ expect does not work over UDP?

The reason I ask is that send/expect should in principle work with UDP sockets. I thought it would not, but after reading up on Stevens (again) there is nothing in monits code that prevent send/expect to work with UDP. I have even written a simple echo-server to test UDP with monit and it works perfectly (admittedly it is a simple test).


Technical discussion:

1) We call connect on all sockets, also UDP sockets. This allow us to use write/read on UDP as well as TCP sockets. I.e. make i/o operations transparent which we use in the socket.c and net.c code.

2) We do not have logic to a) resend lost UDP packets nor b) sequence number testing to assembly packets in order when we read. These shortcomings makes send/expect over UDP unreliable.

3) Adding reliability to UDP sockets require support for both a) and b). This means quite a bit of recoding and redesign in monit's net.c and socket.c code. It's possible of course and if anyone would like to provide a patch it would be very welcome. I really need to use most of my free time now on m/monit.

4) However if you follow these recommendations then testing an UDP server may work.

 - Use a send then expect pattern. That is, for each send call expect.

- Make sure that you do not send or that the server send more text than can be put into an IP packet. The Ethernet Frame max out at around 1500 bytes. In case of problems, limit the test to only one send/expect pair and send max a few
   hundred bytes and hope the server does the same.

- Since packets may be lost, use the new fail tolerant mode in monit version
   4.6 to allow some failure before raising an error. For example,

check host foo with address foo.baz
      if failed port 9877 type udp
           send "Hello World!\r\n"
           expect "Hello World*"
           send "Hello Norway\r\n"
           expect "Hello*"
           for 5 times within 8 cycles # Fail tolerant
      then alert

Does this work?

--
Jan-Henrik Haukeland
Mobil +47 97141255





reply via email to

[Prev in Thread] Current Thread [Next in Thread]