从命令行访问 JVM 属性

发布于 2024-11-18 00:04:29 字数 504 浏览 4 评论 0原文

我有一些 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

物价感观 2024-11-25 00:04:29

解决方案是使用jstat

jstat -gccapacity -t 4994 5s

该行每 5 秒打印出垃圾收集器容量信息,以及进程 4994 的时间戳。

您需要成为正确的用户才能访问虚拟机,因此对我来说,必须运行上述命令sudo -u jboss jstat ...

文档页面上有更多信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文