[英]MBean nested object name in JMX
I've noticed that some MBeans have nested keys;我注意到一些 MBean 有嵌套的键; how do I make the query to get that key?
我如何进行查询以获取该密钥?
The image below shows an example:下图显示了一个示例:
Normally, the MBean query is like this: "org.apache.cassandra.metrics:type=CQL,name=RegularStatementsExecuted"
通常,MBean 查询是这样的:
"org.apache.cassandra.metrics:type=CQL,name=RegularStatementsExecuted"
How do I add the additional folder to that query?如何将附加文件夹添加到该查询? I've tried the following:
我尝试了以下方法:
"org.apache.cassandra.metrics:type=Cache,CounterCache,name=Capacity"
"org.apache.cassandra.metrics:type=Cache.CounterCache,name=Capacity"
"org.apache.cassandra.metrics:type=Cache,type=CounterCache,name=Capacity"
Any ideas?有任何想法吗?
I looked over Java Management Extensions (JMX) Best Practices and it doesn't mention anything about nested keys.我查看了Java 管理扩展 (JMX) 最佳实践,它没有提到任何关于嵌套键的内容。
I noticed that I could add scope to the property list when I looked at jconsole
:我注意到当我查看
jconsole
时,我可以将范围添加到属性列表中:
So, what I used was:所以,我使用的是:
"org.apache.cassandra.metrics:type=Cache,scope=CounterCache,name=HitRate"
It's nice to know that it's not documented anywhere...很高兴知道它没有记录在任何地方......
To get all session ids of tomcat using JConsole which can be found at :-要使用JConsole获取 tomcat 的所有会话 ID,可以在以下位置找到:-
Catalina > Manager > localhost > /##07 ( > Operations > listSessionIds ) Catalina > Manager > localhost > /##07 ( > Operations > listSessionIds )
To get the MBean object name of /##07 just click on it on JConsole and it will show the name.(As shown below)要获取/##07 的MBean 对象名称,只需在JConsole 上单击它,它就会显示名称。(如下所示)
Java code to fetch all the session Ids:获取所有会话 ID 的 Java 代码:
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi");
JMXConnector jmxConn = JMXConnectorFactory.connect(url, null);
// Connecting to the MBeanServer
MBeanServerConnection mbsConn = jmxConn.getMBeanServerConnection();
Object sessionIds = mbsConn.invoke(new ObjectName("Catalina:type=Manager,host=localhost,context=/##07"), "listSessionIds", null, null);
System.out.println(sessionIds.toString());
//close jmx connection
jmxConn.close();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.