Enable performance monitoring services using the command line

 

Overview

Use the command line to enable performance monitoring services.

  1. Enable PMI services and then restart the appserver.

  2. Enable PMI data by invoking setInstrumentationLevel on Perf MBean.

  3. Run wsadmin.sh and invoke operations on Perf Mbean to obtain the PMI data, set or obtain PMI monitoring levels and enable data counters.

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

 

Usage scenario

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} 
        {Module jvmRuntimeModule} 
        {Name jvmRuntimeModule} 
        {Type MODULE}
    }
} 
{Level 7} 
{Data 
    {
        {
            {Id 4} 
            {Descriptor 
                {
                    {Node wenjianpc} 
                    {Server server} 
                    {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 server} 
                {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} 
            }
        } 
    {
        {Id 2} 
        {Descriptor 
        { 
        {Node wenjianpc} 
    {Server server} 
    {Module jvmRuntimeModule} 
    {Name 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 server} 
    {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} 
    {HighWaterMark 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...

beanModule connectionPoolModule j2cModule servletSessionsModule threadPoolModule 
webAppModule

 

Enabling performance monitoring services using the console Starting the Tivoli Performance Viewer Launching scripting clients wsadmin.sh