The task of monitoring all vhosts on a web-server in addition to the host and service statuses is necessary because vhosts can fail at the application level where the web-server is operational. In a web development shop like Radical Designs vhosts come up and are taken down all of the time, SLAs mandate that operations staff need to make sure certain HTTP response codes are returned and pages appropriately redirected when new redirects are added. Operations staff need to make sure specific vhosts and urls on those vhosts return specific content and assure all of these do not overwhelm the target web servers or Nagios. At Radical Designs we wanted the update status of web applications associated with vhosts integrated into nagios.

nagios_vhost.pl is capable of polling web servers for their current list of vhosts, vhost alias, comments that act as monitoring directives, and web application type (WordPress and Drupal) and update status. Each host that is configured to have its vhosts monitored will have its own process associated with the checks to help control the rate of requests per server. Its written in Perl. With this in place the following reports across all servers in the farm are always available via the Nagios interface: Vhost status report, and available web application updates (further broken down in web application type).

Add a new server to have its vhosts and urls monitored

radicaldesigns@puppet:~/$ /usr/bin/perl /home/radicaldesigns/src/nagios_vhost/nagios_vhost.pl –verbose –add-web-servers newwebserver.radicaldesigns.org
# Get the ssh key for the puppet host on newwebserver.radicaldesigns.org and configure ssh key authentication for the root user
# then load the vhosts from the new webserver as above

Why are there vhosts getting checked with "meow" as the subdomain?

Often a vhost config in apache will look something like this:

ServerName radicaldesigns.org
ServerAlias *.radicaldesigns.org

This is so that the stanza that configures radicaldesigns.org will handle all subdomains for radicaldesigns.org. In this instance we check to make sure that the subdomain ''meow.radicaldesigns.org'' is handled because it is a highly unlikely subdomain to actually exist, and this is what we have decided to check for whenever we come across a wild card in the ServerAlias directive.

Update nagios with the web application update status across our farm

The web application status is scheduled to be updated every day from cron on puppet at midnight. You can manually run this process with: