Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Not sure what the problem is here, but I'm setting a test for two virtual hosts that are both ran on the same web server. I just want to make sure a GET on / is coming back with an HTTP 200. When I run this on the command line, no problem:

st:/etc/nagios3# /usr/lib/nagios/plugins/check_http www.example.com
HTTP OK: HTTP/1.1 200 OK - 14144 bytes in 0.055 second response time   |time=0.055208s;;;0.000000 size=14144B;;;0

as soon as I pop this into the configs though, I get a WARNING, 404 alert:

in my commands.cfg:

define command {
    command_name check_http
    command_line $USER1$/check_http -H $HOSTNAME$
}

and in my services.cfg:

define service {
 use generic-service
 host_name myhost
 service_description HTTP-WWW
 check_command check_httpname!www.example.com
}
share|improve this question

2 Answers 2

As a general note you should probably be looking in your Apache log files to see what's happening on the server side.

The command you're running on the command line is not the same as the command you have in your config file. On the command line you're running:

check_http host.example.com

But in your config file, you're running:

check_http -H host.example.com

These do two distinctly different things! Read the documentation for more information. If you are using name-based virtual hosts, these two commands are sending requests to different virtual servers.

share|improve this answer

I think you might have a typo:

define command {
    command_name check_http
    command_line $USER1$/check_http -H $HOSTNAME$
}

Maybe you meant:

define command {
    command_name check_httpname
    command_line $USER1$/check_http -H $HOSTNAME$
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.