Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We're using Nagios to monitor our site (and a bunch of other stuff.) For some odd reason, when I test out the command

/usr/lib/nagios/plugins/check_http -H ''

the response that comes back is HTTP/1.1 200 OK but when I set up the service to do it:

# Check that domain is running
define service {
    hostgroup_name                  hostgroup
    service_description             host site
    check_command                   check_httpname!
    use                             generic-service
    notification_interval           1; set > 0 if you want to be renotified

the response that comes back is HTTP/1.1 503 Service Unavailable.

Does anyone know why this would be happening?

share|improve this question
Can you post the command definition of check_httpname? – EEAA Jun 11 '10 at 19:35
up vote 1 down vote accepted

Not sure why I can't add a comment but can you might want to verify your address and host_name in the host definition. I've been stuck in situations where the command line check script works but the GUI is telling me something else. Usually it's a typo in the address field.

share|improve this answer
Might be a typo in the check_httpname command definition in command.cfg too, per ErikA's question above. – gareth_bowles Jun 11 '10 at 23:54
It was in fact the host_name and address. I was trying to get localhost to use a different hostname. Just went through and added a new host and therefore a new host_name. Thanks! – Michael T. Smith Jun 14 '10 at 18:19

Heres how to fix this!

You have to edit the /usr/local/nagios/etc/objects/commands.cfg and change the https arument "-I" to "-H"

This will tell it to lookup hostname instead of an dip-address specified in your http_check block in server config: /usr/local/nagios/etc/servers/yourserver.cfg


    # 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$


    # 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
share|improve this answer

Your Answer


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.