Hi, first of all thank you for this amazing tool. it was a huge help for me in the last weeks, much more than existing and commercial tools.
Now my question:
Is there a way I can enquiry MBean objects on a running java process ? In a similar way like on VisualVm + MBean plugin installed...
If not already feasible with the help of OGNL syntax, would it be possible/ are you interested in adding this feature ?
There is a plan to support JMX: https://github.com/alibaba/arthas/issues/367
Use the ognl command to get MBean object:
ognl '@java.lang.management.ManagementFactory@getOperatingSystemMXBean().getSystemLoadAverage()'
Some OGNL statements that might be useful to others :
1. List all active Mbeans
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().queryNames(null, null)'
_OR_
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().queryMBeans(null, null)'
2. Get all attributes available for a specific MBean
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().getMBeanInfo(@javax.management.ObjectName@getInstance("com.zaxxer.hikari:type=Pool (myds1)")).getAttributes()'
3. Inspect a MBean attribute value
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().getAttribute(@javax.management.ObjectName@getInstance("com.zaxxer.hikari:type=Pool (myds1)"), "ActiveConnections")'
Most helpful comment
Some OGNL statements that might be useful to others :
1. List all active Mbeans
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().queryNames(null, null)'
_OR_
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().queryMBeans(null, null)'
2. Get all attributes available for a specific MBean
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().getMBeanInfo(@javax.management.ObjectName@getInstance("com.zaxxer.hikari:type=Pool (myds1)")).getAttributes()'
3. Inspect a MBean attribute value
ognl '@java.lang.management.ManagementFactory@getPlatformMBeanServer().getAttribute(@javax.management.ObjectName@getInstance("com.zaxxer.hikari:type=Pool (myds1)"), "ActiveConnections")'