Enable PMI using the wsadmin tool

 

+

Search Tips   |   Advanced Search

 

Procedure

You can run the wsadmin command to...

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


/** Get performance data information for stats */ public void getConfig (ObjectName mbean);

/** Return the current statistic set */ public void getStatisticSet ();

/** Enable PMI data using the pre-defined statistic sets.
    Valid values for the statistic set are "basic", "extended", "all", and "none" */ public void setStatisticSet (String statisticSet);

/** Return the current custom set specification as a string */ public void getCustomSetString ();

/** 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. 

    Use * to enable all the statistics in the given PMI module. 

    For example, to enable all the statistics for JVM and 
    active count, pool size for thread pool use... 

        jvmRuntimeModule=*:threadPoolModule=3,4. 

    The string jvmRuntimeModule is the value of the constant...
    
        WSJVMStats.NAME 

    ...and threadPoolModule is the value of...

        WSThreadPoolStats.NAME
 */ public void setCustomSetString (String customSpec, Boolean recursive);

/** Get stats for an MBean*/ public void getStatsObject (ObjectName mbean, Boolean recursive);

/** Set instrumentation level using String format.
    This should be used by scripting for an easy String processing. 
    The level STR is a list of moduleName=Level connected by ":".
    NOTE: This method is deprecated in V6.1
 */ public void setInstrumentationLevel(String levelStr, Boolean recursive);  


/** Get instrumentation level in String for all the top level modules. 
    This should be used by scripting for an easy String processing.
    NOTE: This method is deprecated in V6.1
 */ public String getInstrumentationLevelString();     

/** Return the PMI data in String 
    NOTE: This method is deprecated in V6.1
 */      public String getStatsString(ObjectName on, Boolean recursive);      

/** Return the PMI data in String      
    Used for PMI modules/submodules without direct MBean mappings.      
    NOTE: This method is deprecated in V6.1
 */      public String getStatsString(ObjectName on, String submoduleName, Boolean recursive);

/** Return the submodule names if any for the MBean      
    NOTE: This method is deprecated in V6.1
 */ public String listStatMemberNames(ObjectName on);

If an MBean is a StatisticProvider, and if you pass its ObjectName to getStatsObject, you 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

 wsadmin>set perfName [$AdminControl completeObjectName type=Perf,*] wsadmin>set perfOName [$AdminControl makeObjectName $perfName]

Invoke getStatisticSet operation

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

 Wsadmin> $AdminControl invoke $perfName getStatisticSet

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.

 Wsadmin> set params [java::new {java.lang.Object[]} 1] Wsadmin> $params set 0 [java::new java.lang.String extended] Wsadmin> set sigs  [java::new {java.lang.String[]} 1] Wsadmin> $sigs set 0 java.lang.String Wsadmin> $AdminControl invoke_jmx $perfOName setStatisticSet 
$params $sigs

Invoke getConfig operation

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

 Wsadmin> set jvmName [$AdminControl completeObjectName type=JVM,*]
 Wsadmin> set params [java::new {java.lang.Object[]} 1]  Wsadmin> $params set 0 [java::new javax.management.ObjectName $jvmName] Wsadmin> set sigs  [java::new {java.lang.String[]} 1] Wsadmin> $sigs set 0 javax.management.ObjectName
 Wsadmin> $AdminControl invoke_jmx $perfOName getConfig $params 
$sigs

This method returns the following:

    Stats type=jvmRuntimeModule, Description=The performance data from  the Java virtual machine run time.

    {name=UpTime, ID=4, type=CountStatistic, description=The amount of  time (in seconds) that the Java virtual machine has been running.,  unit=SECOND, level=low, statisticSet=basic, resettable=false,  aggregatable=true}

    {name=UsedMemory, ID=3, type=CountStatistic, description=The amount  of used memory (in KBytes) in the Java virtual machine run time.,  unit=KILOBYTE, level=low,
    statisticSet=basic, resettable=false, aggregatable=true}

    {name=FreeMemory, ID=2, type=CountStatistic, description=The free  memory (in KBytes) in the Java virtual machine run time.,  unit=KILOBYTE, level=low, statisticSet=all, resettable=false,  aggregatable=true}

    {name=HeapSize, ID=1, type=BoundedRangeStatistic, description=The  total memory (in KBytes) in the Java virtual machine run time.,  unit=KILOBYTE, level=high, statisticSet=basic, resettable=false,  aggregatable=true}

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:

    jvmRuntimeModule=4,3,1:systemModule=2,1:threadPoolModule=4,3:thread
PoolModule>HAManager.thread.pool=4,3:threadPoolModule>MessageListenerTh readPool=4,3:threadPoolModule>ORB.thread.pool=4,3:threadPoolModule>Serv let.Engine.Transports=4,3:threadPoolModule>TCS_DEFAULT=4,3:transactionM odule=4,19,16,18,3,7,6,1,14

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 above 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 setCustomString 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 (*).

    Wsadmin> set params [java::new {java.lang.Object[]} 2] 
    Wsadmin> $params set 0 [java::new java.lang.String  jvmRuntimeModule=1,2,3,4]
    Wsadmin> $params set 1 [java::new java.lang.Boolean false]

    Wsadmin> set sigs  [java::new {java.lang.String[]} 2]
    Wsadmin> $sigs set 0 java.lang.String
    Wsadmin> $sigs set 1 java.lang.Boolean


    Wsadmin> $AdminControl invoke_jmx $perfOName setCustomSetString 
$params $sigs



Invoke getStatsObject operation

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

    Wsadmin> set jvmName [$AdminControl completeObjectName type=JVM,*]
    Wsadmin> set params [java::new {java.lang.Object[]} 2] 
    Wsadmin> $params set 0 [java::new javax.management.ObjectName 
$jvmName]
    Wsadmin> $params set 1 [java::new java.lang.Boolean false]
    Wsadmin> set sigs  [java::new {java.lang.String[]} 2]
    Wsadmin> $sigs set 0 javax.management.ObjectName
    Wsadmin> $sigs set 1 java.lang.Boolean
    Wsadmin> $AdminControl invoke_jmx $perfOName getStatsObject $params 
$sigs

    Stats name=jvmRuntimeModule, type=jvmRuntimeModule#
    {
    name=HeapSize, ID=1, description=The total memory (in KBytes) in  the Java virtual machine run time., unit=KILOBYTE, type=BoundedRangeStatistic, lowWaterMark=51200,  highWaterMark=263038, current=263038, integral=2.494158617766E12, lowerBound
=51200, upperBound=262144

    name=FreeMemory, ID=2, description=The free memory (in KBytes) in  the Java virtual machine run time., unit=KILOBYTE, type=CountStatistic,  count=53509

    name=UsedMemory, ID=3, description=The amount of used memory (in KBytes) in  the Java virtual machine run time., unit=KILOBYTE,  type=CountStatistic, count=209528

    name=UpTime, ID=4, description=The amount of time (in seconds) that  the Java virtual machine has been running., unit=SECOND,  type=CountStatistic, count=83050
}


Invoke getInstrumentationLevelString operation

Use invoke, because it has no parameter.

 wsadmin>$AdminControl invoke $perfName  getInstrumentationLevelString

This command returns the following:

 beanModule=H:cacheModule=H:connectionPoolModule=H:j2cModule=H:jvmRu ntimeModule=H:orbPerfModule=H:servletSessionsModule=H:systemModule=
H:threadPoolModule=H:transactionModule=H:webAppModule=H

You can change the level (n, l, m, h, x) in the above 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 you know the MBean ObjectName, you can invoke the method by passing the right parameters. As an example, JVM MBean is used here.

This command returns the following:

{Description jvmRuntimeModule.desc} {Descriptor {{Node wenjianpc} 
{Server server
1} {Module jvmRuntimeModule} {Name jvmRuntimeModule} {Type 
MODULE}}} {Level 7} {
Data {{{Id 4} {Descriptor {{Node wenjianpc} {Server server1} 
{Module jvmRuntimeM odule} {Name jvmRuntimeModule} {Type DATA}}} {PmiDataInfo {{Name  jvmRuntimeModul e.upTime} {Id 4} {Description jvmRuntimeModule.upTime.desc} {Level 
1} {Comment {
The amount of time in seconds the JVM has been running}} 
{SubmoduleName null} {T
ype 2} {Unit unit.second} {Resettable false}}} {Time 1033670422282} 
{Value {Coun t 638} }} {{Id 3} {Descriptor {{Node wenjianpc} {Server server1} 
{Module jvmRunt imeModule} {Name jvmRuntimeModule} {Type DATA}}} {PmiDataInfo 
{{Name jvmRuntimeM odule.usedMemory} {Id 3} {Description  jvmRuntimeModule.usedMemory.desc} {Level 1
} {Comment {Used memory in JVM runtime}} {SubmoduleName null} {Type 
2} {Unit uni t.kbyte} {Resettable false}}} {Time 1033670422282} {Value {Count 
66239} }} {{Id
2} {Descriptor {{Node wenjianpc} {Server server1} {Module  jvmRuntimeModule} {Nam e jvmRuntimeModule} {Type DATA}}} {PmiDataInfo {{Name  jvmRuntimeModule.freeMemor
y} {Id 2} {Description jvmRuntimeModule.freeMemory.desc} {Level 1} 
{Comment {Fre e memory in JVM runtime}} {SubmoduleName null} {Type 2} {Unit  unit.kbyte} {Reset table false}}} {Time 1033670422282} {Value {Count 34356} }} {{Id 1} 
{Descriptor
{{Node wenjianpc} {Server server1} {Module jvmRuntimeModule} {Name  jvmRuntimeMod ule} {Type DATA}}} {PmiDataInfo {{Name  jvmRuntimeModule.totalMemory} {Id 1} {Des cription 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} {HighWaterM ark 100596} {MBean 38140.0} }}}}

Invoke getStatsString (ObjectName, String, Boolean) operation

This operation takes an additional 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 representing 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, you 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 seperated by a space " ". You 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 setCustomString 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"




JMX

 

Related tasks

Enable PMI using the console
Monitor performance with Tivoli Performance Viewer (TPV)
Start the wsadmin scripting client
Configure Performance Manager Infrastructure using scripting

 

Related Reference

Wsadmin tool