Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am currently using jconsole to monitor performance metrics of my Java application and would like to script this data acquisition.

Is there a way to retrieve these VM metrics (heap memory usage, thread count, CPU usage etc.) to STDOUT?
The data in top -p PID -b -n 1 doesn't quite cut it.

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
207 views
Welcome To Ask or Share your Answers For Others

1 Answer

jconsole just provides a wrapper around the JMX MBeans that are in the platform MBeanServer.

You can write a program to connect to your VM using the Attach API which would then query the MBeans.

Or you can expose the platform MBeanServer over RMI and query the MBeans that way.

See the java.lang.management package for more info


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...