[Nagiosplug-devel] A different ping

Rodger Allen r.allen at awayweb.com
Thu Dec 19 23:25:03 CET 2002


Hello plugin developers


I have written a different type of tcp ping plugin which some may find
useful for "check-host-alive" type host checking commands, particularly 
in firewalled DMZ environment.

We found the normal check_ping to be inadequate in our firewalled
environment, where ICMP (and other traffic) is heavily restricted.  We
needed to know whether a machine was actually alive, even though all of
the services defined in nagios may be down.


This plugin will attempt to connect on a designated tcp port, and will
return CRITICAL if it fails, but, importantly, it will return OK if the
connection is refused.  If the machine is refusing connections, it means
that at least the IP stack is alive.

There is also a switch "-w" that will issue a WARNING if the plugin
receives a connection refused, which some may also find useful, but
should not be used in a host check command.

Some caveats:
If it used as a host-alive-check then you may need to turn on 
"use_agressive_host_checking" in your nagios.cfg, as nagios appears to 
define a host as down if it cannot access any of its services without 
this option set.
Alternatively, you can use it as separate service check (probably with 
the "-w" option), and point it at a port that another service check is 
using, but even then I haven't found that nagios is all that reliable at 
determining that a host has come back up again.


Usage:
   check_tcp_ping [-w] [-t timeout] [-p port] <host>
   check_tcp_ping -V prints version info
   check_tcp_ping -h prints more detailed help
Options:
   -w  issue warning if connection refused (default is OK)
by default, port is 22
by default, timeout is 10


Attached are:
check_tcp_ping.c             put it into the plugins directory
patch-plugins_Makefile.am    apply as "patch -p0 < patch-..."


I submit this for the other nagios plugin developers consideration.  It 
should integrate easily into the main plugin schema if the patch to 
plugins/Makefile.am is applied.
Hopefully, its worst fault is the name - check_tcp_ping.


This is mainly a hack on the check_ssh plugin written by Remi Paulmier, 
and should compile and work on the same systems that that plugin does.



Rodger


-- 
Rodger Allen - Security Consultant     | "te occidere possunt sed
r.allen at awayweb.com                    | te edere non possunt nefas
Mob: +61 402 209 256                   | est" DFW
GPG fingerprint = 958F 256F 5327 D14E 49EA 0681 05E6 2EC3 62E8 793F
Thawte fingerprint = 96:09:A2:3B:67:9F:B4:AE:C8:50:BC:2F:31:00:AB:14

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch-plugins_Makefile.am
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20021219/18da2275/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: check_tcp_ping.c
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20021219/18da2275/attachment.c>


More information about the Devel mailing list