There has been a lot of talk about No-SQL databases recently, especially in the Drupal community. One of the most popular being MongoDB, due to its easy interface, feature-full design and speed. Use of MongoDB and No-SQL in general is only going to increase in the coming months.

At Tag1, we have been working on a few projects with MongoDB as a central infrastructure component. Due to this, we have come upon one of Mongo's problems, youth and because of youth a lack of good tools around it. Monitoring in particular is a complete vacuum. Over the next few weeks we will be releasing the first round of tools we have developed to monitor and test MongoDB, the first being a Nagios Plugin called check_mongo.


check_mongo is an extremely simple nagios plugin, based on Python and PyMongo. It uses the ServerStatus MongoDB admin command, parsing the results to check for ability to connect, a long query running (query taking longer than X seconds), query count and slave lag.

NOTE: The plugin currently requires version 1.4+ of MongoDB.

Installation Notes

Installation is similar to any other Nagios plugin, you define command sections in nagios for the various actions the plugin supports. For example:

define command{
command_name check_mongo_slave
command_line $USER1$/check_mongo -A slavelag -H $HOSTADDRESS$ -P $ARG3$ -w $ARG1$ -c $ARG2$

You can then use the check_mongo_slave check in a service definition. There is one small issue to watch for, if you install PyMongo via easy_install, it will default to a compressed egg. The check_mongo command will then try to use a tmpdir to uncompress it and this defaults to a /root dotdir. This of course won't work and the check will fail. I recommend installing PyMongo as an uncompressed egg because of this.

Getting it

This is very much a work in progress as I need to add performance counter checks to the command as well as add some more comprehensive error checks. Because of this, it is currently only available via git.

Web UI:

This work was sponsored by Examiner/ClarityDG and we thank them for their support.

Psst, Looking to Keep Your Drupal Site Secure?

Tag1 Quo is the only Drupal monitoring solution that supports Drupal 6 LTS, Drupal 7, and Drupal 8 under one dashboard.