Category Archives: Education

Monitoring Drupal with Icinga

Overview:

Monitoring one or two Drupal sites can be done by logging into the status report every few days and reviewing settings, looking at your watchdog log, and reading the emails the sites send you. However, as you run more and more sites that process becomes overwhelming and can take up a large amount of time. A few services exist to help monitor all of your sites in one place, Droptor, Drupal Monitor, and Acquia all provide really slick solutions. However, if you want to roll your own due to cost, corporate security, etc… the Drupal community has developed several tools leveraging Nagios.

I wanted to set this up to monitor the sites I manage and chose to use Icinga, a fork of Nagios and openSUSE 12.2 as that is consistent with our environment. Currently I am doing this as a proof of concept project and it is running inside of VirtualBox on an older Mac. The Drupal projects that I am using are the following:

These two modules first let us talk with our Nagios server but also provide most of the stats you can find in the paid services. On initial install the results are not all that pretty to look at but I believe there are ways to fix that and I would rather have comprehensive than pretty any day.

Installation was inspired by the post at awebfactory. There is currently no write-ups on how to do the install if you are using Icinga but since it is a fork of Nagios all of the steps are quite similar. I still know very little about Nagios so if you see a goofy config file please improve upon it. The readme file that accompanies the Nagios Monitoring module is fairly comprehensive and if using Icinga use the Nagios 3 style configuration options. Here are four tips that I wish I had known while setting this up.

4 Tips

  1. You must define a host in your .cfg file you create for monitoring the Drupal sites. The README assumes you have done this already but if you are creating a monitoring server from scratch this is news. Add the following at the top of the hostgroups.cfg file the instructions ask you to create.
    define host{
            use                     linux-server
            host_name               domainname.edu
            alias                   DevVM ; You will see what you put here in Icinga
            }
  2. The unique string you generate for use in the module and within Icinga goes where the instructions have the words unique identifier.
  3. Initially my Drupal check was not returning any results. I got an error “Service Check Timed Out.” My dev server is a little pokey so I needed to edit the service_check_timeout line in icinga.cfg from 60 to 600. I chose 600 because this article uses it, very scientific, I know.
  4. The SUSE Icinga package places Icinga in /etc/icinga, /etc/init.d/icinga check_verbose checks your settings in the .cfg files you have edited/created and /etc/init.d/icinga restart restarts the service.

Installing Icinga

Thankfully there is a package for Icinga in the openSUSE repositories. I installed this using the GUI tools but if I move out of a proof of concept phase I would do this with an openSUSE box run level 3 so I will try to show the command line install options rather than how to use Yast. This generally just involves following the documentation at http://docs.icinga.org/latest/en/quickstart-icinga.html.

Install the dependencies:

$ zypper install gd gd-devel libjpeg libjpeg-devel libpng libpng-devel
$ zypper install net-snmp net-snmp-devel perl-Net-SNMP

Create a user named icinga, please follow the instructions at the link above.

$ zypper install thttpd
$ sudo vi /etc/icinga/etc/objects/contacts.cfg

Change the email address associated with icingaadmin to one that you can receive email at. ESC : wq ENTER to exit.
Set the password for icingaadmin
$ htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
$ sudo /etc/init.d/apache2 reload

Make sure Icinga starts when you boot.

$ chkconfig --add icinga
$ chkconfig icinga on
Verify everything is good with your initial configuration.
$ sudo /etc/init.d/icinga check_verbose

Start Icinga

$ sudo /etc/init.d/icinga start

Navigate to http://localhost/icinga/ and login with icingaadmin and the password you set earlier.

Install the Nagios Drupal Check service

The steps in the README file are correct for openSUSE. Just use the Nagios 3.x version of the commands and follow tip number 1 from above.

Final Result

Drupal Nagios Alert
A nagios alert showing issues with a site I have in dev.

I started monitoring a site I have on my devVM and it shows me a boatload of issues. Core is out of date, stuff is turned on that shouldn’t be for a production site, modules need to be updated, etc… The beauty of this is that I simply need to turn the module on for each site I want to monitor, update my hostgroup definition in hostgroups.cfg and I have instant monitoring. I hope to provide further details such as NRPE on the remote host, selective alerts, and a prettier interface.

Thank you to everyone I have linked to in this article and to the developers of the fantastic Icinga, Nagios, and Drupal modules. On a happy note, Acquia itself uses Nagios to monitor their sites in the Acquia cloud.

MLK Day at WCC Highlights

A few minutes before I head to class today I want to share some highlights from the MLK Conference I attended on Saturday. The keynote speakers were James Bible, Gerald Hankerson, and Jeff Shaw. I would like to share their quotes with you. If my transcription is incorrect please do let me know.

“The right time, is when it is the right thing to do.” – James Bible

“Get busy living or get busy dying.” – Gerald Hankerson

“Nobody ever asked me my side of the story.” – Gerald Hankerson

“If you open a school door, you close the door of a prison.” – Victor Hugo/Jeff Shaw

“The roots of crime lie in poverty and despair.” – Jeff Shaw

In addition to the keynote speeches there were fascinating workshops to attend. Two of the ones I attended were the “Day in the life of an ESL student,” and Partnering with Youth. The ESL workshop placed us in a content classroom where instruction was mainly in Spanish. The instructor shared teaching techniques that make it a little less of a struggle. It was an enlightening experience. ┬áPartnering with Youth was a great discussion with the youth in our community that participate in these programs. I even spoke for a few moments with two students I worked with last year at Sterling Meadows Homework Club.

If you can attend next year, please do.

Martin Luther King Day Event at WCC

All Rights Reserved Princeton University
All Rights Reserved Princeton University

This a reminder to everyone in Whatcom County and those who are active with the Whatcom Human Rights Task Force that this Saturday, January 16th, at Whatcom Community College, there is the annual MLK Workshop. I have gone for the past two years and it is always a very motivating experience. Many individuals working towards one form or another of justice will be there. Remember, the entire event is free. For more information please go to the website of the Whatcom Human Rights Task Force. I hope to attend the sessions on Latinos in Action, Partnering for Youth, and Creating a Community of Educators for Social Justice.

I will see you all there at the morning keynote which is at 10am in the Syre Center.