Access JVM properties from command line
I have some JBoss 5.1.0 instances running on JDK1.6 on RHEL5. I would like to access heap/permgen/etc information from their VMs.
The JBoss configuration has not explicitly enabled JMX on the JVM for remote access with JConsole/JVisualVM.
I can access JBoss-related information through Twiddle, and, if I had a GUI on this machine, I would be able to access this information by running JCo开发者_如何学Cnsole/JVisualVM (JDK 1.6 allows the connection of these clients after the app has been started, even without the com.sun.management
options).
Is there a way to access this information without restarting these VMs?
The ways I can envisage doing it are:
- Using Twiddle to access this information through JBoss' JMX console - if this is possible, what should I be passing in to find the information?
- Using a command line client to connect to the running JDK in the same way that JConsole can. I am aware of cmdline-jmxclient but I don't know if it is capable of this.
The solution is to use jstat
:
jstat -gccapacity -t 4994 5s
This line prints out the Garbage Collector capacity information, plus a timestamp for process 4994 every 5 seconds.
You need to be the correct user to gain access to the VM, so for me the above command had to be run sudo -u jboss jstat ...
.
There's lots more information on the documentation page.
精彩评论