Why and when to perform this task
You can use the command line to enable performance monitoring services.Steps for this task
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:
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
wsadmin>$AdminControl invoke $perfName getInstrumentationLevelString
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
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]
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 setInstrumentationLevel $params $sigs
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.
wsadmin>set jvmName [$AdminControl completeObjectName type=JVM,*]
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]
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 getStatsString $params $sigs
{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.
wsadmin>set mySrvName [$AdminControl completeObjectName type=Server,name=server1, node=wenjianpc,*]
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]
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
wsadmin>$AdminControl invoke_jmx $perfOName getStatsString $params $sigs
Note that this method is used to get stats data for the PMI modules that do not have direct MBean mappings.
Invoke listStatMemberNames operation
wsadmin>set mySrvName [$AdminControl completeObjectName type=Server,name=server1, node=wenjianpc,*]
wsadmin>set params [java::new {java.lang.Object[]} 1] wsadmin>$params set 0 [$AdminControl makeObjectName $mySrvName]
wsadmin>set sigs [java::new {java.lang.String[]} 1] wsadmin>$sigs set 0 javax.management.ObjectName wsadmin>$AdminControlinvoke_jmx $perfOName listStatMemberNames $params $sigs
beanModule connectionPoolModule j2cModule servletSessionsModule threadPoolModule webAppModule