Nagios plugins: check_http

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
n3t4dm1n
Posts: 2
Joined: Tue Oct 28, 2014 12:48 pm

Nagios plugins: check_http

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios plugins: check_http

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
n3t4dm1n
Posts: 2
Joined: Tue Oct 28, 2014 12:48 pm

Re: Nagios plugins: check_http

Post by n3t4dm1n »

Thanks Box293, now i understand and it works!
Regards
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: Nagios plugins: check_http

Post by cmerchant »

Glad that worked. I'm locking the thread now. Thanks.
Locked