After you get the PerfMBean(s) in the application server from
which you want to get PMI data, you can invoke the following operations
on the PerfMBean through AdminClient API:
- setStatisticSet: Enable PMI data using the pre-defined statistic sets.
Object[] params = new Object[] { com.ibm.websphere.pmi.stat.StatConstants.STATISTIC_SET_EXTENDED};
String[] signature = new String[] {"java.lang.String"};
ac.invoke (perfOName, "setStatisticSet", params, signature);
- getStatisticSet: Returns the current statistic set.
String setname = (String) ac.invoke (perfOName, "getStatisticSet", null, null);
- setCustomSetString: Customizing PMI data that is enabled using fine-grained control.
This method allows to enable or disable statistics selectively. The format of the custom
set specification string is STATS_NAME=ID1,ID2,ID3 seperated by ':', where STATS_NAME
and IDs are defined in WS*Stat interfaces in com.ibm.websphere.pmi.stat package.
params[0] = new String (WSJVMStats.NAME + "=" + WSJVMStats.HeapSize);
params[1] = new Boolean (false);
signature = new String[] {"java.lang.String", "java.lang.Boolean"};
ac.invoke (perfOName, "setCustomSetString", params, signature);
Note: Statistics that are not listed in the set string are not changed.
- getCustomSetString: Returns the current custom set specification as a string
String setstring = (String) ac.invoke (perfOName, "getCustomSetString", null, null);
- setInstrumentationLevel: set the instrumentation level
params[0] = new MBeanLevelSpec(objectName, new int[]{WSJVMStats.HEAPSIZE});
params[1] = new Boolean(true);
signature= new String[]{ "com.ibm.websphere.pmi.stat.MBeanLevelSpec",
"java.lang.Boolean"};
ac.invoke(perfOName, "setInstrumentationLevel", params, signature);
- getInstrumentationLevel: get the instrumentation level
params[0] = objectName;
params[1] = new Boolean(recursive);
String[] signature= new String[]{
"javax.management.ObjectName", "java.lang.Boolean"};
MBeanLevelSpec[] mlss = (MBeanLevelSpec[])ac.invoke(perfOName,
"getInstrumentationLevel", params, signature);
- setInstrumentationLevel: set the instrumentation level (deprecated in V6.0)
params[0] = new MBeanLevelSpec(objectName, optionalSD, level);
params[1] = new Boolean(true);
signature= new String[]{ "com.ibm.websphere.pmi.stat.MBeanLevelSpec",
"java.lang.Boolean"};
ac.invoke(perfOName, "setInstrumentationLevel", params, signature);
- getInstrumentationLevel: get the instrumentation level (deprecated in V6.0)
Object[] params = new Object[2];
params[0] = new MBeanStatDescriptor(objectName, optionalSD);
params[1] = new Boolean(recursive);
String[] signature= new String[]{
"com.ibm.websphere.pmi.stat.MBeanStatDescriptor", "java.lang.Boolean"};
MBeanLevelSpec[] mlss = (MBeanLevelSpec[])ac.invoke(perfOName,
"getInstrumentationLevel", params, signature);
- getConfigs: get PMI static config info for all the MBeans
configs = (PmiModuleConfig[])ac.invoke(perfOName, "getConfigs", null, null);
- getConfig: get PMI static config info for a specific MBean
ObjectName[] params = {objectName};
String[] signature= { "javax.management.ObjectName" };
config = (PmiModuleConfig)ac.invoke(perfOName, "getConfig", params,
signature);
- getStatsObject: you can use either ObjectName or MBeanStatDescriptor
Object[] params = new Object[2];
params[0] = objectName; // either ObjectName or or MBeanStatDescriptor
params[1] = new Boolean(recursive);
String[] signature = new String[] { "javax.management.ObjectName",
"java.lang.Boolean"};
Stats stats = (Stats)ac.invoke(perfOName, "getStatsObject", params,
signature);
Note: The returned data only have dynamic information (value and time stamp).
See PmiJmxTest.java for additional code to link the configuration information with the
returned data.
- getStatsArray: you can use either ObjectName or MBeanStatDescriptor
ObjectName[] onames = new ObjectName[]{objectName1, objectName2};
Object[] params = new Object[]{onames, new Boolean(true)};
String[] signature = new String[]{"[Ljavax.management.ObjectName;",
"java.lang.Boolean"};
Stats[] statsArray = (Stats[])ac.invoke(perfOName, "getStatsArray",
params, signature);
Note: The returned data only have dynamic information (value and time stamp).
See PmiJmxTest.java for additional code to link the configuration information with the
returned data.
- listStatMembers: navigate the PMI module trees
Object[] params = new Object[]{mName};
String[] signature= new String[]{"javax.management.ObjectName"};
MBeanStatDescriptor[] msds = (MBeanStatDescriptor[])ac.invoke(perfOName,
"listStatMembers", params, signature);
or,
Object[] params = new Object[]{mbeanSD};
String[] signature= new String[]
{"com.ibm.websphere.pmi.stat.MBeanStatDescriptor"};
MBeanStatDescriptor[] msds = (MBeanStatDescriptor[])ac.invoke
(perfOName, "listStatMembers", params, signature);
Refer the API documentation for deprecated classes