Java app performance counters viewed in Perfmon

那年仲夏 提交于 2019-12-01 17:29:06

问题


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?


回答1:


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:


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.




回答3:


This seems to be exactly what you're looking for, but it's not free: http://www.adventnet.com/products/snmpadaptor/faqs/general.html




回答4:


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.




回答5:


This article outlines how to access Windows PerfMon stats from Java and expose them as MBean attributes through JMX.



来源:https://stackoverflow.com/questions/358129/java-app-performance-counters-viewed-in-perfmon

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!