Page 1 of 1

Nagios plugins: check_http

Posted: Tue Oct 28, 2014 1:36 pm
by n3t4dm1n
I have a problem with plugin check_http, when i run manually

/usr/lib/nagios/plugins$ ./check_http -H server.com -u /bla/bla/bla.jsp -s "wordtosearch"
HTTP OK: HTTP/1.1 200 OK - 26784 bytes en 0,561 segundo tiempo de respuesta |time=0,561292s;;;0,000000 size=26784B;;;0

but when i define as service:

define service {
use generic-service
host_name server.com
service_description server.com
check_command check_http! -H server.com -u /bla/bla/bla.jsp -s "wordtosearch" (or check_http! -u /bla/bla/bla.jsp -s "wordtosearch")
}

the result is:

HTTP WARNING: HTTP/1.1 404 Not Found

Re: Nagios plugins: check_http

Posted: Tue Oct 28, 2014 9:07 pm
by Box293
Your service is check command is not going to work if you are using the built in check_http command.
This is because the check_http defined in commands.cfg is defined as:

Code: Select all

command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
Which does not match up with the command you tested with (for example you haven't used the -I argument).

You should define a custom command to run the check you want:

Code: Select all

define command{
        command_name    check_http_custom
        command_line    $USER1$/check_http -H $ARG1$ $ARG2$
        }
And your service definition needs to be defined as:

Code: Select all

check_command check_http_custom!server.com!-u /bla/bla/bla.jsp -s "wordtosearch"
Does this make sense?

Re: Nagios plugins: check_http

Posted: Wed Oct 29, 2014 6:57 am
by n3t4dm1n
Thanks Box293, now i understand and it works!
Regards

Re: Nagios plugins: check_http

Posted: Wed Oct 29, 2014 9:28 am
by cmerchant
Glad that worked. I'm locking the thread now. Thanks.