Nagios – HTTP CRITICAL Socket timeout after 10/20/60 seconds

httpnagiostimeout

I just installed nagios on a server machine, only to be greeted with a critical error on the HTTP service.

the error is

HTTP CRITICAL - Socket timeout after 10 seconds 

I searched for this error and got the suggestion to run check_http with a longer timeout. so I appended -t 20 in file commands.cfg, next to "check_http" command. restarted nagios but i still get an error (for the new timeout).

Then searched some more. The error seems common, so I start thinking I may have some other problem.

I tried running check_http on my own:

root@srv$ /usr/libexec/nagios/check_http -H localhost -N -p 80 -t 1

HTTP OK: HTTP/1.1 200 OK - 846 bytes in 0.003 second response time |time=0.003080s;;;0.000000 size=846B;;;0

The response seems alright, but I know little about http.

Any clues?

EDIT: the command definition for check_http , taken from /etc/nagios/objects/commands.cfg is

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

I am not sure how to check what are the values of the variables $HOSTADDRESS$ and more importantly $ARG1$.

then the definition of the service is

define service{
    use                             local-service         ; Name of service template to use
    host_name                       localhost
    service_description             HTTP
    check_command                   check_http
    notifications_enabled           1
    }

the distribution is slackware 14.0 64bit.

Best Answer

Your check command doesn't match your manual test.

If you want Nagios to perform the check in the same way that you're testing it manually, your service definition would have to be like this due to the way your check command is defined:

define service{
    use                             local-service
    host_name                       localhost
    service_description             HTTP
    check_command                   check_http!-N -p 80 -t 1
    notifications_enabled           1
}

... and you would also have to have "localhost" as the address for this host.

(But a timeout of 1 second is kind of short.)

Related Topic