August 5th, 2013

Recently I’ve needed to get information from running Cassandra processes, in order to determine which parameters to monitor. jconsole can be used for this, however if you’re using a host on AWS, or in a bandwidth-limited environment, you might find that it takes way too long, especially if all you want to do for the moment is get a list of all beans and their attributes. jmxterm is a good solution for this – a command line interface to your jmx port. So here’s a couple of utility scripts that you can use to get all the beans and each of their attributes using jmxterm. You may need to change $jar, $host, and $port in the perl script to fit your environment, and also maybe change the domains in the bash script. Then you should be able to simply run the bash script to get a list of each bean and its attributes. I found this useful when looking for the correct syntax to set up some nagios monitoring for cassandra. For example, here is a snippet of the output:

And I was able to figure out the syntax for a nagios check:

Hopefully, these scripts might be useful to someone else trying to query cassandra (or any java process that uses jmx).