[Nagiosplug-help] Use of check_by_ssh
Ralph.Grothe at itdz-berlin.de
Ralph.Grothe at itdz-berlin.de
Fri Jul 29 05:19:09 CEST 2005
Hi,
I have a bastion host in a dmz that serves HTTP(S) to the
internet.
I must monitor the webserver by pulling a certain CGI URI and see
if the Webserver returns a 200.
Unfortunately I don't get another port (e.g. 5666/tcp for NRPE)
opened by the firewall gang.
I only have access from our LAN to the bastion host via SSH.
Thus I wrote a short shell script that resides on the webserver
and GETs the HEAD of this URI
through wget (with -S, -C off, --spider).
It's called check_dmz_www.sh
So far this script isn't doing any parsing of the output from the
GET.
I thought to leave this part to a Nagios check_* plug-in.
In the libexec dir I discovered check_by_ssh.
Unfortunately, as most distributed plug-ins, the documentation is
a bit too terse.
>From the --help screen I can't see the use of this plug-in,
as it doesn't do anything more (i.e. return code parsing logic
etc.) than vanilla ssh client does.
E.g. I would call check_by_ssh from the Nagios server like this
$ /opt/sw/nagios/libexec/check_by_ssh -1 -H $hostaddress -l www
-i ~nagios/.ssh/id_rsa1_dmz_www -C
/usr/local/sbin/check_dmz_www.sh
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response...
1 HTTP/1.1 200 OK
2 Date: Fri, 29 Jul 2005 11:58:47 GMT
3 Server: Apache/1.3.22 (Unix) mod_ssl/2.8.5 OpenSSL/0.9.6b
4 Keep-Alive: timeout=25, max=100
5 Connection: Keep-Alive
6 Content-Type: text/html
200 OK
But where's the point in using this plug-in?
For that I could as well just call the ssh client.
I would want check_by_ssh to recognise just the last line from
the wget output to retrieve the webserver's return code whereon
to decide whether to submit an OK, WARNING, or CRITICAL to
nagios.
Rgds.
Ralph
More information about the Help
mailing list