Enable PMI using wsadmin

 

+

Search Tips   |   Advanced Search

 

Procedure

  1. Enable PMI .

  2. Enable PMI data by invoking setInstrumentationLevel operation on PerfMBean.

  3. Start wsadmin.

    Using wsadmin, one can invoke operations on Perf Mbean to...

    • Obtain PMI data
    • Set or obtain PMI monitoring levels
    • Enable data counters.

 

Perf MBean Operations

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

/** Get performance data information for stats */

public void getConfig (ObjectName mbean);


/** Returns 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);


/** Returns 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 
    separated 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 6.0
 */

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

public String getInstrumentationLevelString();     


/** Return the PMI data in String 
    NOTE: This method is deprecated in 6.0
 */     

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

public String getStatsString(ObjectName on, String submoduleName, Boolean recursive);


/** Return the submodule names if any for the MBean      
    NOTE: This method is deprecated in 6.0   
 */

public String listStatMemberNames(ObjectName on);

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

  • DynaCache
  • EJBModule
  • EntityBean
  • JDBCProvider
  • J2CResourceAdapter
  • JVM
  • MessageDrivenBean
  • ORB
  • Server
  • SessionManager
  • StatefulSessionBean
  • StatelessSessionBean
  • SystemMetrics
  • ThreadPool
  • TransactionService
  • WebModule
  • Servlet
  • WLMAppServer
  • WebServicesService
  • WSGW

 

Example

The following are sample commands in wsadmin use 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 JVM run time.

    {name=UpTime, ID=4, type=CountStatistic, description=The amount of 
time (in seconds) that the JVM 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 JVM 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 JVM 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 JVM 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 JVM 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 JVM run time.,
    unit=KILOBYTE,
    type=CountStatistic,
    count=53509
    name=UsedMemory,
    ID=3,
    description=The amount of used memory (in KBytes) in 
the JVM run time.,
    unit=KILOBYTE,
    type=CountStatistic, count=209528
    name=UpTime,
    ID=4,
    description=The amount of time (in seconds) that the JVM 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

Note: 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

  • sSet parameters ("pmi=l" is the simple way to set all modules to the low level)

    wsadmin>set params [java::new {java.lang.Object[]} 2] 
    
    

    wsadmin>$params set 0 [java::new java.lang.String pmi=l] 
        wsadmin>$params set 1 [java::new java.lang.Boolean true]
    

  • Set signatures

    wsadmin>set sigs  [java::new {java.lang.String[]} 2] 
    
    

    wsadmin>$sigs set 0 java.lang.String
        wsadmin>$sigs set 1 java.lang.Boolean
    

  • Invoke the method. Use invoke_jmx, because it has a parameter

    wsadmin>$AdminControl invoke_jmx $perfOName 
    setInstrumentationLevel $params $sigs
    

This command does not return anything.

Note: 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, one can invoke the method by passing the right parameters. As an example, JVM MBean is used here.

  • Get MBean query string. For example, JVM MBean

     wsadmin>set jvmName [$AdminControl completeObjectName 
    type=JVM,*]
    

  • Set parameters

    wsadmin>set params [java::new {java.lang.Object[]} 2]
    
    

    wsadmin>$params set 0 [$AdminControl makeObjectName $jvmName]
    wsadmin>$params set 1 [java::new java.lang.Boolean true]
    

  • Set signatures

    wsadmin>set sigs  [java::new {java.lang.String[]} 2]
        wsadmin>$sigs set 0 javax.management.ObjectName wsadmin>$sigs 
        set 1 java.lang.Boolean
    

  • Invoke method

     wsadmin>$AdminControl invoke_jmx $perfOName getStatsString 
    $params $sigs
    

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 EJBs, but there is no MBean for beanModule. Therefore, you can pass server MBean ObjectName and a String (beanModule) to get PMI data in beanModule.

  • Get MBean query string. For example, server MBean
    wsadmin>set mySrvName [$AdminControl completeObjectName 
        type=Server,name=server1,
        node=wenjianpc,*]
    

  • Set parameters

    wsadmin>set params [java::new {java.lang.Object[]} 3]
    
    

    wsadmin>$params set 0 [$AdminControl makeObjectName $mySrvName]
    
    

    wsadmin>$params set 1 [java::new java.lang.String beanModule]
        wsadmin>$params set 2 [java::new java.lang.Boolean true]
    

  • Set signatures

    wsadmin>set sigs  [java::new {java.lang.String[]} 3]
    
    

    wsadmin>$sigs set 0 javax.management.ObjectName
    
    

    wsadmin>$sigs set 1 java.lang.String
        wsadmin>$sigs set 2 java.lang.Boolean
    

  • Invoke method

    wsadmin>$AdminControl invoke_jmx $perfOName getStatsString 
    $params $sigs
    

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

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

 

 

Invoke listStatMemberNames operation

  • Get MBean queryString. For example, Server

    wsadmin>set mySrvName [$AdminControl completeObjectName 
        type=Server,name=server1,
        
    

    node=wenjianpc,*]
    
    

  • Set parameter

    wsadmin>set params [java::new {java.lang.Object[]} 1]
    wsadmin>$params set 0 [$AdminControl makeObjectName 
    $mySrvName]
    

  • Set signatures

    wsadmin>set sigs  [java::new {java.lang.String[]} 1]
    wsadmin>$sigs set 0 javax.management.ObjectName
        wsadmin>$AdminControlinvoke_jmx $perfOName 
        listStatMemberNames $params $sigs
    

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

beanModule connectionPoolModule j2cModule servletSessionsModule 
threadPoolModule 
webAppModule


 

Related Tasks


Enabling PMI using the administrative console
Monitoring performance with Tivoli Performance Viewer (TPV)
Starting the wsadmin scripting client

 

See Also


Wsadmin tool

 



 

 

Tivoli is a trademark of the IBM Corporation in the United States, other countries, or both.