Enabling performance monitoring services using the command line

Why and when to perform this task

You can use the command line to enable performance monitoring services.

Steps for this task

  1. Enable PMI services as described inEnabling performance monitoring services in the application server through the administrative console.
    Make sure to restart the application server.
  2. Run the wsadmin command as described in Launching scripting clients.
    Using wsadmin, you can invoke operations on Perf Mbean to obtain the PMI data, set or obtain PMI monitoring levels and enable data counters.

    Note: If PMI data are not enabled yet, you need to first enable PMI data by invoking setInstrumentationLevel operation on PerfMBean.

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

    /** 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 ":".    
    */
    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 
    */
    public String getInstrumentationLevelString();     
    
    /** Return the PMI data in String      
    *      
    */     
    public String getStatsString(ObjectName on, Boolean recursive);      
    
    /** Return the PMI data in String      
    *  Used for PMI modules/submodules without direct MBean mappings.      
    */     
    public String getStatsString(ObjectName on, String submoduleName, Boolean recursive);
    
    /**      
    * Return the submodule names if any for the MBean      
    */     
    public String listStatMemberNames(ObjectName on);

    If an MBean is a StatisticProvider and if you pass its ObjectName to getStatsString, 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 you can use to obtain PMI data:

Obtain the Perf MBean ObjectName

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

Invoke getInstrumentationLevelString operation

This command returns the following:
beanModule=H:cacheModule=H:connectionPoolModule=H:j2cModule=H:jvmRuntimeModule=H 
:orbPerfModule=H:servletSessionsModule=H:systemModule=H:threadPoolModule=H
:trans actionModule=H:webAppModule=H

Note that 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.

Note that 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 a 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.

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

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


Related tasks
Enabling performance monitoring services in the application server through the administrative console
Starting the Tivoli Performance Viewer
Launching scripting clients
Related reference
Wsadmin tool



Searchable topic ID:   tprf_command
Last updated: Jun 21, 2007 4:55:42 PM CDT    WebSphere Application Server Network Deployment, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/tprf_command.html

Library | Support | Terms of Use | Feedback