Wednesday 2 October 2013

Getting PMI metrics using wsadmin


Get a PyJavaInstance ref to the thing you want to check (In this case a JVM)
jvmO = AdminControl.makeObjectName(
    AdminControl.queryNames('type=JVM,J2EEServer=BobServerA,*'))

Check it's of type jclass org.python.core.PyJavaInstance
type(jvmO)

Now get it's PerfMBean Object
perfO =  AdminControl.makeObjectName(
    AdminControl.queryNames('type=Perf,process=BobServerA,*'))

Now run getStatObject
jvmStatsO = AdminControl.invoke_jmx(
    perfO, 
    'getStatsObject', 
    [ jvmO, java.lang.Boolean('false') ],
    [ 'javax.management.ObjectName', 'java.lang.Boolean' ]
)

Now run the getStatistic method on jvmStatsO to get stats
jvmStatsO.getStatistic('HeapSize').getCurrent()

To work out what other methods you can call either of the following
jvmStatsO.getClass().getMethods()
jvmStatsO.getStatistic('HeapSize').getClass().getMethods()


No comments:

Post a Comment