[Nagiosplug-devel] Patch for check_tcp

Howard Wilkinson howard at cohtech.com
Wed Mar 31 01:55:05 CEST 2004


This patch alters check_tcp to enable it to handle general conversations 
with the server. It is now table driven and the syntax of the command 
line has changed slightly (should be compatible with previous uses).

Usage: check_tcp -H host -p port [-w <warning time>] [-c <critical 
time>] [[-s <send string>]* [-e <expect string>]*]* [-q <quit string>] 
[-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>] [-r <refuse 
state>] [-v] [-4|-6] [-P <protocol>] [-X <service>]

So send and expect strings can be specified any number of times. Each 
send string item separates an expect string stanza. An empty send string 
is a NULL operation (possibly should be a separate flag). The expect 
items are alternatives in each separate occurence.

Thus:

check_tcp -H mailserver -p smtp -s "USER: fred" -e "OK" -e "FAILED"

means send "USER: fred" and expect either OK or FAILED in response.

While check_tcp -H mailserver -p smtp -s "USER: fred" -e "OK" -s "" -e 
"LOGIN ACCEPTED"

means send "USER: fred and expect OK followed by LOGIN ACCEPTED in 
separate records.

Further advantage of this approach is that additional protocols can be 
built in as necessary with simple table entries.

I considered but have yet to implement a general scheme using the 
services file to look up the protocol and port to use from any program 
name. Uses -p servicename lookup already.

Regards, Howard.



This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from you system.

E-mail transmission cannot be guarenteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nagios-plugins-1.4.0pre1-check-tcp.patch
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20040331/8983d805/attachment.ksh>


More information about the Devel mailing list