+

Search Tips   |   Advanced Search

Enable PMI


Run the wsadmin command. Using wsadmin, we can invoke operations on Perf MBean to obtain the PMI data, set or obtain PMI monitoring levels, and enable data counters.

If PMI data is not enabled yet, we need to first enable PMI data by invoking setInstrumentationLevel operation on Perf Bean.

The following operations in Perf MBean can be used in wsadmin:

If an MBean is a StatisticProvider, and if you pass its ObjectName to getStatsObject, we get the Statistic data for that MBean. MBeans with the following MBean types are statistic providers:


Example

Use the following sample Jacl commands with the wsadmin tool to obtain PMI data:

Obtain the Perf MBean ObjectName

Invoke getStatisticSet operation

Use this method to find the statistic set that is in effect:

This method returns one of the following values: basic, extended, all, none.

Invoke setStatisticSet operation

Use this method to enable monitoring using a statistic set.

The valid statistic set values are: basic, extended, all, none.

Invoke getConfig operation

Use this method to find information about the statistics for a component.

This method returns the following:

Invoke getCustomSetString operation

This operation provides the current monitoring specification in a string format:

wsadmin> $AdminControl invoke $perfName getCustomSetString

The output looks similar to the following:

This output indicates that statistic ID's 1, 3, and 4 are enabled in the JVM component. The description of the statistic IDs can be found using the previous getConfig operation or using the API documentation. The output contains the current monitoring specification for the entire server. The individual modules are separated by a :, and > is used as a separator within the module.

Invoke setCustomSetString operation

This operation can be used to enable or disable statistics selectively. In the following command, the statistic IDs 1, 2, 3, and 4 are enabled for the JVM module. To enable all the statistic IDs, use an asterisk (*).

Invoke getStatsObject operation

This operation is used to get the statistics for an MBean. The following example gets the statistics for the JVM:

Invoke getInstrumentationLevelString operation

Use invoke because it has no parameter.

This command returns the following:

We can change the level (n, l, m, h, x) in the previous string and then pass it to setInstrumentationLevel method.

Invoke setInstrumentationLevel operation - enable/disable PMI counters

This command does not return anything.

The PMI level string can be as simple as pmi=level (where level is n, l, m, h, or x), or something like module1=level1:module2=level2:module3=level3 with the same format shown in the string returned from getInstrumentationLevelString.

Invoke getStatsString(ObjectName, Boolean) operation

If we know the MBean ObjectName, we can invoke the method by passing the correct parameters. As an example, JVM MBean is used here.

This command returns the following:

{Description jvmRuntimeModule.desc}
 {Descriptor {{Node wenjianpc} {Server server1} {Module jvmRuntimeModule}
 {Name jvmRuntimeModule} {Type MODULE}}} 
{Level 7} 
{Data {{{Id 4} {Descriptor {{Node wenjianpc} {Server server1} {Module jvmRuntimeModule}
 {Name jvmRuntimeModule} {Type DATA}}} 
{PmiDataInfo {{Name jvmRuntimeModule.upTime} {Id 4}
 {Description jvmRuntimeModule.upTime.desc} {Level 1}
 {Comment {The amount of time in seconds the JVM has been running}} 
 {SubmoduleName null} {Type 2} {Unit unit.second} {Resettable false}}} 
{Time 1033670422282} {Value {Count 638} }} 
{{Id 3} {Descriptor {{Node wenjianpc} {Server server1} {Module jvmRuntimeModule}
 {Name jvmRuntimeModule} {Type DATA}}} 
{PmiDataInfo {{Name jvmRuntimeModule.usedMemory} {Id 3}
 {Description jvmRuntimeModule.usedMemory.desc} {Level 1}
 {Comment {Used memory in JVM runtime}} {SubmoduleName null} {Type 2}
 {Unit unit.kbyte} {Resettable false}}} {Time 1033670422282}
 {Value {Count 66239} }} 
{{Id2} {Descriptor {{Node wenjianpc} {Server server1} {Module jvmRuntimeModule}
 {Name jvmRuntimeModule} {Type DATA}}} 
{PmiDataInfo {{Name jvmRuntimeModule.freeMemory} {Id 2}
 {Description jvmRuntimeModule.freeMemory.desc} {Level 1} 
 {Comment {Free memory in JVM runtime}} 
{SubmoduleName null} {Type 2} {Unit unit.kbyte} {Resettable false}}} 
{Time 1033670422282} {Value {Count 34356} }} 
{{Id 1} {Descriptor{{Node wenjianpc} {Server server1} {Module jvmRuntimeModule}
 {Name jvmRuntimeModule} {Type DATA}}} 
{PmiDataInfo {{Name jvmRuntimeModule.totalMemory} {Id 1}
 {Description jvmRuntimeModule.totalMemory.desc} {Level 7}
 {Comment {Total memory in JVM runtime}} 
 {SubmoduleName null} {Type 5} {Unit unit.kbyte} {Resettable false}}} 
{Time 1033670422282} {Value {Current 100596} {LowWaterMark 38140}
 {HighWaterMark 100596} {MBean 38140.0} }}}}

Invoke getStatsString (ObjectName, String, Boolean) operation

This operation takes an extra String parameter, and it is used for PMI modules that do not have matching MBeans. In this case, the parent MBean is used with a String name that represents the PMI module. The String names available in an MBean can be found by invoking listStatMemberNames. For example, beanModule is a logic module aggregating PMI data over all Enterprise JavaBeans, but there is no MBean for beanModule. Therefore, we can pass server MBean ObjectName and a String (beanModule) to get PMI data in beanModule.

This command returns PMI data in all the Enterprise JavaBeans within the BeanModule hierarchy because the recursive flag is set to true.

This method is used to get stats data for the PMI modules that do not have direct MBean mappings.

Invoke listStatMemberNames operation

This command returns the PMI module and submodule names, which have no direct MBean mapping. The names are separated by a space " ". We can then use the name as the String parameter in getStatsString method. For example:

beanModule connectionPoolModule j2cModule servletSessionsModule 
threadPoolModule 
webAppModule

Customize and run the following example Jython script with the wsadmin tool to obtain PMI data:

print "\n---------------------------------------------------------------------- "
print "Obtain the Perf MBean ObjectName"
print "------------------------------------------------------------------------ "
perfName = AdminControl.completeObjectName ('type=Perf,*')
perfOName = AdminControl.makeObjectName (perfName)
print perfOName
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke getStatisticSet operation "
print "------------------------------------------------------------------------ "
print AdminControl.invoke (perfName, 'getStatisticSet')
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke setStatisticSet operation"
print "------------------------------------------------------------------------ "
params = ['extended']

sigs  = ['java.lang.String']

print AdminControl.invoke_jmx (perfOName, 'setStatisticSet', params, sigs)
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke getConfig operation"
print "------------------------------------------------------------------------ "
jvmName = AdminControl.completeObjectName ('type=JVM,*')

params = [AdminControl.makeObjectName (jvmName)] 

sigs = ['javax.management.ObjectName']

print AdminControl.invoke_jmx (perfOName, 'getConfig', params, sigs)
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke getCustomSetString operation"
print "------------------------------------------------------------------------ "
print AdminControl.invoke (perfName, 'getCustomSetString')
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke setCustomSetString operation"
print "------------------------------------------------------------------------ "
params = ['jvmRuntimeModule=1,2,3,4', java.lang.Boolean ('false')] 

sigs  = ['java.lang.String', 'java.lang.Boolean']

print AdminControl.invoke_jmx (perfOName, 'setCustomSetString', params, sigs)
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke getStatsObject operation"
print "------------------------------------------------------------------------ "
jvmName = AdminControl.completeObjectName ('type=JVM,*')

params = [AdminControl.makeObjectName (jvmName), java.lang.Boolean ('false')] 

sigs = ['javax.management.ObjectName', 'java.lang.Boolean']

print AdminControl.invoke_jmx (perfOName, 'getStatsObject', params, sigs)
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke getInstrumentationLevelString operation"
print "------------------------------------------------------------------------ "
print AdminControl.invoke (perfName, 'getInstrumentationLevelString')
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke setInstrumentationLevel operation - enable/disable PMI counters "
print "------------------------------------------------------------------------ "
params = ['pmi=l', java.lang.Boolean ('true')] 

sigs = ['java.lang.String', 'java.lang.Boolean'] 

print AdminControl.invoke_jmx (perfOName, 'setInstrumentationLevel', params, sigs)
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke getStatsString(ObjectName, Boolean) operation"
print "------------------------------------------------------------------------ "
jvmName = AdminControl.completeObjectName ('type=JVM,*')

params = [AdminControl.makeObjectName (jvmName), java.lang.Boolean ('true')]

sigs = ['javax.management.ObjectName', 'java.lang.Boolean']

print AdminControl.invoke_jmx (perfOName, 'getStatsString', params, sigs)
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke getStatsString (ObjectName, String, Boolean) operation"
print "------------------------------------------------------------------------ "
mySrvName = AdminControl.completeObjectName ('type=Server,name=server1,node=wcsNode,*')

params = [AdminControl.makeObjectName (mySrvName),
          'beanModule',
          java.lang.Boolean ('true')]

sigs = ['javax.management.ObjectName',
        'java.lang.String',
        'java.lang.Boolean')

print AdminControl.invoke_jmx (perfOName, 'getStatsString', params, sigs)
print "------------------------------------------------------------------------ \n"


print "\n---------------------------------------------------------------------- "
print "Invoke listStatMemberNames operation"
print "------------------------------------------------------------------------ "
mySrvName = AdminControl.completeObjectName ('type=Server,name=server1,node=wcsNode,*')

params = [AdminControl.makeObjectName (mySrvName)]

sigs = ['javax.management.ObjectName']

print AdminControl.invoke_jmx (perfOName, 'listStatMemberNames', params, sigs)
print "------------------------------------------------------------------------ \n"

When Intelligent Management is enabled, the application server cannot disable PMI counters that the Intelligent Management requires. For information about the list of PMI counters that cannot be disabled when Intelligent Management is enabled, see Enable PMI data collection.


Related:

  • Use wsadmin scripting with JMX
  • Enable PMI
  • Monitor performance with Tivoli Performance Viewer
  • Start the wsadmin scripting client
  • Configure the Performance Monitoring Infrastructure using scripting
  • wsadmin scripting tool