Monitoring Wordpress with Nagios



I recently set up Nagois to monitor our Dreamhost sites in support of Communications Tool & Die.  I ran into a mysterious problem, however.  When I would set the nagios check_http to point to the blog URL it would always return a status of 301 (permanent redirect) and say everything was OK.  When I updated the check options to include -f follow it would complain about reaching the maximum number of redirects and bailing out.

After looking into the problem I realized that the issue is that the Apache server is listing the port in the virtual host address in the HTTP header.  For whatever reason, the version of check_http that is bundled in the nagios plugins 1.4.12 release can't handle that and bombs out.  A bug has already been filed and the version in the subversion repository trunk/ has the patch to fix it.  So the solution was to check out the subversion copy and build my own version of check_http.  This should be fixed in the next bundled release of the nagios plugins package, but if you can't wait that long all you have to do is recompile from source.