I have a Java app running on Tomcat, and I would like to monitor counters using Windows Performance Monitor. Is this possible using a JMX adapter for the Java MBeans or by some other means?
5 Answers
The following tutorial might be of use: http://www.developer.com/java/ent/article.php/3087741/Hooking-to-PerfMon-from-Java.htm
It shows how a Java application defines a custom counter that can be monitored in Perfmon. It basically boils down to using an extension DLL to the performance monitor and communicating with that via a memory mapped file. You could then hook your JMX counters into a similar mechanism so that they can be monitored from Perfmon.
Since you tagged this with JMX and MBeans, I assume your counters are accessible from a Java MBean. If so you could use jconsole, provided with the Java SDK, to monitor the counters. Once you find your MBean in the MBeans tab, double click on the value and it will draw a nice line graph for easy monitoring.
See JConsole Guide for more info.

- 2,141
- 5
- 25
- 36
-
Yes, the counters are accessible from the MBean. I am hoping to be able to view the counters in Performance Monitor since that is what our NOC already uses to monitor other counters and is familiar with. Adding in a new console for monitoring an app would be a large undertaking. Thanks, Jon – Dec 12 '08 at 18:30
This seems to be exactly what you're looking for, but it's not free: http://www.adventnet.com/products/snmpadaptor/faqs/general.html

- 342,105
- 78
- 482
- 720
-
This adapter makes the MBeans accessible via SNMP. I am looking through the site, but I don't see a way to have them viewed directly in the Windows Performance Monitor. Thanks! Jon – Dec 12 '08 at 18:28
If you want to do this programatically, you can create a JMXConnection to the machine, then accessing the MBeans from there. We did this ourselves for a function test that involved keeping track of the number of threads in the application, which there's a counter for that you can access through JMX. If you want nice graphs and things like that I suggest using JConsole, as mentioned above. There's also a program called JProfiler that works like JConsole on steroids, basically. There's a free trial so you can try it out.

- 3,445
- 3
- 23
- 29