Jonathan Jonathan - 1 year ago 93
Java Question

Can jconsole data be retrieved from the command line?

I am currently using

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

The data in
top -p PID -b -n 1
doesn't quite cut it.


Answer Source

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 package for more info

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download