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.

I'm trying to configure a http_check using the -u parameter to check a specific URL, but while this works fine from the command line, the nagios check only returns Temporary failure in name resolution

# /usr/lib/nagios/plugins/check_http -H 176.67.169.157 -u http://dolicapax.org/
HTTP OK: HTTP/1.1 200 OK - 10960 bytes in 0.360 second response time |time=0.359959s;;;0.000000 size=10960B;;;0

Here's the command and service definitions

# 'check_http_url' command definition
define command{
        command_name    check_http_url
        command_line    /usr/lib/nagios/plugins/check_http -I '$HOSTADDRESS' -u '$ARG1$'
}


define service {
        host_name               frank.olsenit.no
        service_description     HTTP-wiki
        check_command           check_http_url!http://dolicapax.org/
        ...
}

Any ideas?

share|improve this question
    
Found it .. simple typo - needs another $ in $HOSTADDRESS$ –  Roy Mar 24 '13 at 15:03

2 Answers 2

up vote 1 down vote accepted

Try just this

/usr/lib/nagios/plugins/check_http -H 176.67.169.157 -u /

If you need to put a host in use

/usr/lib/nagios/plugins/check_http -H dolicapax.org -I 176.67.169.157 -u /

Check to make sure you can resolve on the host also

nslookup dolicapax.org
share|improve this answer
    
Thanks, I didn't consider that way of doing it. Will it work with virtual hosts? –  Roy Mar 24 '13 at 15:06
    
yes it will. That's the same setup i use to check vhosts –  Mike Mar 24 '13 at 16:09
    
Lovely, I noticed this way http_check does a HTTP/1.1 request instead of HTTP/1.0. Much better this way, thanks again. –  Roy Mar 24 '13 at 19:37
    
right cause in 1.1 the host header is needed.. 1.0 it isn't –  Mike Mar 25 '13 at 3:35

Try to change the check_command in your commands.cfg with:

service {
        host_name               frank.olsenit.no
        service_description     HTTP-wiki
        check_command           check_http_url!176.67.169.157!http://dolicapax.org/
}

Check your files:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart nagios and check your nagios site.

share|improve this answer
    
I don't think this will work without changing the command definition, will it? Anyway, I found the typo in my configuration, it just needed an extra dollar sign in $HOSTADDRESS$ –  Roy Mar 24 '13 at 17:50

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.