check_http with pattern matching

Andreoni Antonella andreoni at ksolutions.it
Wed Feb 11 12:35:06 CET 2004


Hi all,

I need to check the content of a web page
the web page is the result of a jsp and it may contain the "OK" string or the "ERROR" string depends on the jsp can connect to a DB or not
if it contains "OK" then Nagios status for the service must be "Normal" 
if it contains "ERROR" then Nagios status for the service must be "Critical" 

iI tested the check_http plugin by command line
[nagios at develop3 libexec]$ ./check_http -H my.host.domain -u /Sil/test-monitor.jsp -e 200 -s "Database: Status: OK"
HTTP ok: HTTP/1.1 200 OK -   0.074 second response time |time=  0.074
and it works fine
in the services.cgf  I put this line
       check_command                   check_http!my.host.domain !/Sil/test-monitor.jsp!200!"Database: Status: OK"
in the checkcommands.cfg there is the following definition
# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -H $HOSTADDRESS$
        }
My check_command returns Normal, but when the DB was down the check still returns normal (DB down but web server UP)
instead the check_http executed by command line returns CRITICAL...
Then I defined a customized check for http and I defined "check_idol_http" that use check_http with the parameters I need to use (-u, -e. -s)
# 'check_idol_http' command definition
define command{
        command_name    check_idol_http
        command_line    $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$ -e $ARG2$ -s $ARG3$
        }
and changed the services.cfg in
check_command                   check_idol_http!my.host.domain !/Sil/test-monitor.jsp!200!"Database: Status: OK"
But when the DB is down (and web server up) the check returns CRITICAL Invalid HTTP response received from host
instead of  "HTTP CRITICAL: string not found|time=  0.073"
(when the web server is down too the same check returns "CRITICAL Connection refused by host")


Any suggestion about the use of the check_http plugin?
Could you help me please?

thanks

Antonella

--------------------------------------------- 
Antonella Andreoni 
System Engineer 
KSOLUTIONS S.p.A. 
Via Lenin, 132/26 
56017 San Martino Ulmiano (PI) - Italy 
Tel. +39 50 898111 
Fax +39 50 861200 
E-mail: andreoni at ksolutions.it 
http://www.ksolutions.it
---------------------------------------------

















-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list