About Cassandra & Nagios
The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together Dynamo's fully distributed design and Bigtable's ColumnFamily-based data model. Cassandra was open sourced by Facebook in 2008, and is now developed by Apache committers and contributors from many companies. http://cassandra.apache.org/
Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers. http://www.nagios.org/about
How it Works
This tutorial will show you how to start monitoring 'HeapMemoryUsage' in Nagios using a plugin called check_jmxhttp://exchange.nagios.org/directory/Plugins/Java-Applications-and-Servers/check_jmx/details aka jmxquery. Basically Java Management Extensions (JMX) allow us to monitor the JVMs running on a Cassandra cluster via port 8080 (in this case).
Step 1: Install Java
In order for the Nagios Server to talk to Cassandra you need to install Java. You can do so from the ports collection
$ cd /usr/ports/java/diablo-jre16 && make install clean
Step 2: Install the JMX Nagios Plugin
Download:
$ fetch http://downloads.sourceforge.net/project/nagioscheckjmx/nagioscheckjmx/1.0/check_jmx.tar.gzhttp://sourceforge.net/projects/nagioscheckjmx/files/
Untar:
$ tar -xvfz check_jmx.tar.gz
Move:
$ mv check_jmx /usr/local/libexec/nagios
Step 3: Test the Plugin
Before you get crazy test the plugin in a command prompt. Assuming your IP address 10.10.0.5
$ ./check_jmx -U service:jmx:rmi:///jndi/rmi://10.10.0.5:8080/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 10737418240 -c 20401094656
If all goes well you should see:
$ JMX OK - HeapMemoryUsage.used = 1739604488 | 'HeapMemoryUsage used'=1739604488;10737418240;20401094656;;
Step 4: Edit Command & Service .cfg
Add this to your commands.cfg file:
define command {
command_name check_jmx
command_line $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://$HOSTADDRESS$:8080/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 19327352832 -c 20401094656
}
Add this to your services.cfg file:
define service{
use local-service
hostgroup_name cas-servers
service_description JMX
check_command check_jmx
contact_groups admins
}
Reload Nagios
$ /usr/local/etc/rc.d/nagios reload