“You got no eyes, you got no ears, you got nothing but assumptions!”
— The Negotiator, 1998
On the plus side, a lot of Java-based software has been instrumented using JMX. On the con side, it's easily so much that it becomes impossible to navigate. Because of the sheer number of MBeans, attributes and operations, it becomes really hard to find the things you need; it's probably tucked away somewhere, but since it's burried deep under loads of stuff you don't need, it's impossible to locate it quickly.
That's when you build your own dashboard, displaying just the things you really want to display. The other week, I played a little with different approaches to put something together quickly. It turns out creating a web dashboard can actually be done with just a couple of lines, so I figured I'd share it here.
Jolokia — It assumes the target system has Jolokia bundled. Jolokia is a HTTP-JMX bridge, that exposes all MBeans as restful(ish) resources.
scripttags, and then bind the variables inside these templates to data you pass in with just a single line of code.
HAML — A lot of people seem to hate XML-based markup languages. I'm not one of them. But I am totally in love with HAML and Jade. It's just so much better than HTML, especially as a template language: it's way more compact, and much easier to parse for humans.
So, behold, the JMX console, currently displaying heap attributes only: