JMX 对象和属性列表?
我正在尝试实现一个 nagios 插件,这样做需要我具体知道我想要监视的对象和属性。问题是,我无法在任何地方找到标准系统 jmx 对象和属性的列表。有人能指出我正确的方向吗?我需要监视内存池、堆大小等内容。
I am trying to implement a nagios plugin, and doing so requires that I know specifically what object and attribute I want to monitor. The thing is, I haven't been able to find a listing anywhere of the standard system jmx objects and attributes. Can anyone point me in the right direction? I need to monitor things like memory pools, heap size, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用
这将写入所有对象名称及其属性...
You can use
This will write all the object names and their attributes...
您始终可以使用 mBeanServer.queryNames(null, null); 用于获取在某个 MBeanServer 上注册的所有 MBean(其中
mBeanServer
是您在本地或远程获取的MBeanServerConnection
)。然而,在实现您自己的 Nagios 插件之前,为什么不使用已经存在的插件呢?例如 jmx4perl 的
check_jmx4perl
附带了用于探索 JMX 的工具命名空间(例如用于列出所有 JMX MBean 及其属性和操作的jmx4perllist
或j4psh
基于 readline 的 JMX shell,具有上下文相关的命令行完成功能)。You can always use mBeanServer.queryNames(null, null); for getting to all MBeans registered at a certain MBeanServer (where
mBeanServer
is theMBeanServerConnection
which you obtained either locally or remotely).However, before implementing your own Nagios Plugins, why not using an already exisiting one ? E.g. jmx4perl's
check_jmx4perl
which comes with tools for exploring the JMX namespace (likejmx4perl <url> list
for listing all JMX MBeans with their attributes and operations orj4psh
a readline based JMX shell with context sensitive command line completion).从系统管理员的角度来看,我完全理解这个问题的基础。标准 JMX 文档,或者在尝试浏览 JMX 对象树时可能遇到的对象,可能会令人不知所措且令人困惑。
我发现这篇Op5 知识库文章在提供像样的解决方案方面非常有用JBoss 感兴趣的 JMX 对象概述。
显然,需要进行调整以适应他们实际使用的监控系统,但示例中的内容足以满足正在使用的任何基于 nagios 的监控系统。
From a sysadmin point of view, I fully understand the bases for the question. The standard JMX documentation, or the objects one can encounter while trying to browse JMX object trees, can be overwhelming and confusing.
I have found this Op5 KB article quite useful in providing a decent overview of JMX objects of interest for JBoss.
Obviously, one needs to adjust to fit with the monitoring system they are actually using, but there is enough in the examples for whatever nagios-based monitoring system is being used.
您是否正在寻找 JVM 平台 MBean 文档 ?
那里有获取 MBean 并询问它们的示例,例如
Are you looking for the JVM platform MBean docs?
There are examples there on to get the MBeans and interrogate them e.g.
查看 MC4J 或 JConsole - 使用它们都很简单。
Check out MC4J or JConsole - it's trivial to get going with both of 'em.