Quick Tip: Resolve a Local HTTP 403 Forbidden Warning in a Nagios Installation

After installing Nagios some weeks ago to monitor my local infrastructure, all was well with the exception of a persistent warning logged by Nagios against the local HTTP service.  Specifically, I was seeing a 403 Forbidden warning being returned by Apache (pictured below).

I found the warning quite perplexing as I was using the Nagios web administration interface to view the warning and the administration interface, itself, was being served by Apache. Once I verified Apache was running as expected and serving CGI content from the correct location on the server, I started thinking about what the check_http plugin was actually looking for and began researching the issue. As it turns out the check_http plugin expects to find an index.html in the Apache DocumentRoot directory and, by default, Apache installed on CentOS serves noindex.html from /var/www/error when no content is present in the DocumentRoot (A.K.A. /var/www/html). With this knowledge the fix quickly became apparent, create an index.html in the DocumentRoot. To create the file and resolve the warning simply run the following two commands. Create index.html in the correct location:

[code]touch /var/www/html/index.html[/code]

Restart Apache and Nagios:

[bash]service httpd restart;service nagios restart[/bash]

Once you’ve created the file and restarted the necessary services you may have to wait up to five minutes (depending on the value of your retry_check_interval directive) for Nagios to make another pass and change the state of local HTTP service from Warning to OK.

Leave a Reply

Your email address will not be published. Required fields are marked *