I am a computer science student currently doing an internship. My boss has asked me to write a simple tool to monitor a Tomcat server. I am just starting this project so I’m basically just playing around to see how things work. I would like to create a simple jsp page that displays the results of some basic JMX queries. I am using the Eclipse IDE. Can someone give me some tips to get started?
Share
You definitely don’t have to re-invent the wheel, here. You can start with
jconsole, which ships with your JDK: just runjconsole [pid]andjconsolewill connect to the (locally) running process and let you observe everything via JMX.If you want remote access to JMX-exposed information, you can use Tomcat’s
managerwebapp along with the includedjmxproxyservlet which allows you to remotely perform simple queries to get (and set) JMX properties.There are other more fully-featured projects such as Jolokia ( http://www.jolokia.org/) that do similar kinds of things.
Assuming that you are using something like Nagios to automatically observe your Tomcat instance, something you definitely don’t want to do it spin-up a JVM and make a remote (or even local) JMX connection to inspect a single JMX property (and then do that 5 times to observe 5 different properties, then do those 5 samples every 5 minutes, or 1 minute, or whatever). Instead, you probably want to use a proxy like one described above.
We’ve had great success coupling Nagios with the Tomcat manager’s
jmxproxyservlet. It will likely meet your needs for quite a while.