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
}
Best Answer
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:
But in your config file, you're running:
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.