Take the 2-minute tour ×

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

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.

share|improve this question
Try running check_http -H with the FQDN which is what nagios will apply. –  mdpc Aug 7 '13 at 16:20
@mdpc check_http -H stargaze.skails.home. the FQDN is just an internal domain name. I hope this is what you were seeking ?:) –  nass Aug 7 '13 at 17:31
it respons just like before... –  nass Aug 7 '13 at 17:41
Is the nagios host the SAME as your http host? You have to be running the test from the nagios host. –  mdpc Aug 7 '13 at 17:42
and where's the service definition? if you don't know what ARG1 is, you need to read nagios.sourceforge.net/docs/3_0/macros.html –  Keith Aug 8 '13 at 20:38

3 Answers 3

up vote 1 down vote accepted

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.)

share|improve this answer

The check_http plugin just does the equivalent of trying to load a webpage from an external IP. Check to make sure that you can load the webpage in your browser, and that the plugin works on the command line with the exact same host definition you've specified in the configuration files (FQDN or IP number).

If you're really checking localhost, try it with, and also try to use something like wget to check that localhost is really allowed to load webpages from itself (wget This will also work for other sites (wget http://www.yourdomain.com).

share|improve this answer
ok I tried wget http://xxx.xxx, where xxx.xxx is the following. works fine (=downloads index.html), localhost: works and dls fine index.html, stargaze.skails.home: again works and dls index.html, stargaze, the same. the same... –  nass Aug 7 '13 at 17:39
OK, then you probably need to check your definitions. But double check with check_http -H stargaze.skails.home and if that succeeds, there's possibly something wrong with your definitions--possibly host, or the check_http defaults. –  Katherine Villyard Aug 7 '13 at 18:57

The variables you ask $HOSTADDRESS$ $HOSTNAME$ and so on is like asking for the field ADDRESS of the HOST definition, same for $SERVICEXXXX$. The $ARG1$ is what it expect after the ! in your command definition as already stated.

In this particular case:

check_command                   check_http!-N -p 80 -t 1

$ARG1$ = -N -p 80 -t 1 //-p 80 is not necesary as 80 is the default for http.

Hope this help you to understand Nagios Macros.

share|improve this answer

Your Answer


