Just a quick and dirty post regarding the Nagios check_http plugin. found a little quirk that kept me scratching my head for some time. I added a new site to my monitoring system and ended up getting a result of
HTTP OK – HTTP/1.1 302 Moved Temporarily – 0.174 second response time |time=0.17
turned out the web hosting provider was redirecting you to the actual content but the check_http plugin does not follow the redirect by default. I corrected the issue by adding “-f follow” switch to the command. This tells the check_http plugin to follow any redirects it encounters.
HTTP OK HTTP/1.1 200 OK – 1.010 second response time |time=1.009625s;;;0.000000 size=12304B;;;0
so your entire command should look like the following:
define service{
use remote-service
host_name [hostname]
service_description HTTP
check_command check_http!-H [domanname] -f follow -s “[String to look for]”
}
The final -s switch is optional but it will help notify you of any unauthorized changes made to the site your monitoring (eg. Hacking attempt).