Friday, December 22, 2006

Enable PMI(Custom) for websphere application server with wsadmin


I am putting a sample code to
1 enable the PMI for websphere.
2 Enable "custom" statisticsLevel
3 Enable all the parameters for JVM settings. Hope this will help you.

//------------enable the PMI for the server-------------

set s1 [$AdminConfig getid /Node:Default01Node/Server:server1/]

set pmis1 [$AdminConfig list PMIService $s1]

set sts1 [$AdminConfig list StatisticsProvider $s1]

$AdminConfig modify $pmis1 {{enable true}{statisticSet custom}{initialSpecLevel beanModule=H}}

//-----set the statistics type as custom------------------------

set perfName [$AdminControl completeObjectName type=Perf,*]

set perfOName [$AdminControl makeObjectName $perfName]

$AdminControl invoke $perfName getStatisticSet

set params [java::new {java.lang.Object[]} 1]

$params set 0 [java::new java.lang.String custom]

set sigs [java::new {java.lang.String[]} 1]

$sigs set 0 java.lang.String

$AdminControl invoke_jmx $perfOName setStatisticSet $params $sigs

//----------------get all the parameters for JVM----------------

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

set params [java::new {java.lang.Object[]} 1]

$params set 0 [java::new $jvmName]

set sigs [java::new {java.lang.String[]} 1]

$sigs set 0

$AdminControl invoke_jmx $perfOName getConfig $params $sigs

//----------------Try to enable all the parameters for JVM ---------

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

$params set 0 [java::new java.lang.String jvmRuntimeModule=*]

$params set 1 [java::new java.lang.Boolean false]

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

$sigs set 0 java.lang.String

$sigs set 1 java.lang.Boolean

$AdminControl invoke_jmx $perfOName setCustomSetString $params $sigs

//--------------------save the configuration ------------------------

$AdminControl invoke $perfName savePMIConfiguration

$AdminConfig save

No comments: