Tuesday, July 2, 2013

Exporting Cassandra Metrics to Graphite

Anyone that's ever worked with Cassandra knows that metrics are crucial to being able to do any performance tuning. Out of the box, you have the following options for examining metrics in Cassandra:
  • nodetool will give you most of the basic metrics, such as read/write latency, heap usage, etc. It's very easy to use. http://wiki.apache.org/cassandra/NodeTool
  • OpsCenter - a webapp built by DataStax.
However, chances are you're already running your own monitoring system, such as Ganglia or Graphite. In that case, you may wish to export all of the metric goodness that Cassandra has to offer into your own monitoring system.

Luckily, this isn't hard. You can query JMX directly, or you can query MX4J web interface that Cassandra exposes on top of JMX. I went with the latter approach, and wrote a simply utility that grabs all the available metrics out of MX4J and pipes them into Graphite.

You can checkout the source code and usage here: https://github.com/matvey14/cassandra-utils

You should be able to easily extend the script and push metrics to Ganglia instead by invoking gmetric, if you'd like.

No comments:

Post a Comment