You are here

Monitoring NuoDB with Nagios and Python

Monitoring NuoDB using a common tool like Nagios presents an interesting challenge. Unlike many other applications, with NuoDB there isn’t a single process or a single host that you can check  to ensure that the system is working. However, using any of several tools that are a part of NuoDB, you can connect directly to NuoDB and get all kinds of information that you can then use to configure your Nagios monitor.

I’ve chosen the Python driver as a reliable tool to create a Nagios plugin for NuoDB.

The approach follows the methodology and logic that is part of what makes Nagios so popular to begin with, but adapted for a multi-tenant, distributed database. The plugin is designed to check the state of a given NuoDB Domain by connecting to a specified broker and checking that there are databases running, and that each database has at leaset one Transaction Engine (TE) and one Storage Manager (SM) associated with it, since that’s the minimum needed for a transactional, durable database.

While this approach can be accomplished with the NuoDB manager (NuoDB Manager Doc) from the command line, the Python driver allows more direct access to the NuoDB Domain, making it slightly more efficient, and as NuoDB improves, will allow for more powerful techniques to be used in monitoring. So let’s take a quick look at some of the Python code used for this.

Connecting to a Domain still requires having a broker, domain user, and password, and this script assumes you want to input those as parameters in the check. To use this plugin, you’ll need three things: Python 2.7, the NuoDB Python Driver, and the plugin itself, check_nuodb_domain.py.

  • I’m running on CentOS 6, so I had to add the ius repo to get Python 2.7, but it’s readily available for most Linux distributions via their internal package handlers.
  • The NuoDB Python driver is available via git, with details in the tech blog article by Jacob Getto.
  • Now you just need the plugin itself, which is up on the Nagios Exchange, which should be saved to your Nagios plugins directory on the machine running your NuoDB broker.

You can then invoke the check directly on the machine running your broker in /etc/nagios/nrpe.cfg:

 command[check_nuodb]=/usr/lib64/nagios/plugins/check_nuodb_domain.py -b localhost -d domain -p bird
 

Then all you have to do is add the check for the appropriate host in your Nagios core configurations:

<span style="color:rgb(0, 0, 0); font-family:inherit; font-size:inherit">
 define service {
 use generic-service
 host_name monitor
 service_description NuoDB
 check_command check_nrpe!check_nuodb
 }
</span> 

Once you’ve added the plugin to your Nagios install and given it access to your NuoDB Domain, you’ll start seeing something like this:

nagios-output

The only warning you’ll get is if you don’t have any databases. Any databases that don’t have TE’s or SM’s will cause a critical state, and of course if your broker is down, that will also return critical.

Summary

Nagios is an extremely popular open-source Monitoring System that can easily be combined with the monitoring capabilities that are part of NuoDB. This combination provides a simple, yet accurate way to monitor the health of a set of distributed NuoDB databases.

Add new comment