从命令行访问 JVM 属性
我有一些 JBoss 5.1.0 实例在 RHEL5 上的 JDK1.6 上运行。我想从他们的虚拟机访问堆/permgen/等信息。
JBoss 配置未显式启用 JVM 上的 JMX,以便使用 JConsole/JVisualVM 进行远程访问。
我可以通过 Twiddle 访问 JBoss 相关信息,并且,如果我在这台机器上有 GUI,我将能够通过运行 JConsole/JVisualVM 访问此信息(JDK 1.6 允许在应用程序启动后连接这些客户端,即使没有 com.sun.management 选项)。
有没有办法在不重新启动这些虚拟机的情况下访问这些信息?
我可以设想的方法是:
- 使用 Twiddle 通过 JBoss 的 JMX 控制台访问此信息 - 如果这是可能的,我应该传递什么来查找信息?
- 使用命令行客户端以与 JConsole 相同的方式连接到正在运行的 JDK。我知道 cmdline-jmxclient 但我不知道它是否有能力做到这一点。
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 JConsole/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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是使用
jstat
:该行每 5 秒打印出垃圾收集器容量信息,以及进程 4994 的时间戳。
您需要成为正确的用户才能访问虚拟机,因此对我来说,必须运行上述命令
sudo -u jboss jstat ...
。文档页面上有更多信息。
The solution is to use
jstat
: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.