Your Daily Geekery

jmx and munin

ops

The jmx2munin projects exposes JMX MBean attributes to Munin. There are other plugins out there that claim to do the same. But jmx2munin

  • strictly complies to the plugin format
  • exposes collection types like Lists, Maps and Sets
  • can map String values to numbers

Just call it manually to see what attributes are exposed.

java -jar jmx2munin.jar \
     -url service:jmx:rmi:///jndi/rmi://localhost:8080/jmxrmi \
     -query "org.apache.cassandra.*:*"

Then you can link the script to gather the individual attributes

/etc/munin/plugins$ ls -la cassandra_*
lrwxrwxrwx 1 root root 37 2011-04-07 19:58 cassandra_nodes_in_cluster -> /usr/share/munin/plugins/jmx2munin.sh

In the plugin configuration you point to the graph definition

[cassandra_*]
env.query org.apache.cassandra.*:*

[cassandra_nodes_in_cluster]
env.config cassandra/nodes_in_cluster

which defines what is shown in munin.

graph_title Number of Nodes in Cluster
graph_vlabel org_apache_cassandra_db_storageservice_livenodes_size
org_apache_cassandra_db_storageservice_livenodes_size.label number of nodes

For more advanced usage you can even map certain String values of attributes and turn them into an enumeration value. See the project documentation for more details.