Understanding WebLogic Server MBeans 2-9
2.5.2 Using the Platform MBean Server
In this release of WebLogic Server, the WebLogic Server Runtime MBean Server is configured by default to contain the platform MXBeans for the corresponding server.
The Domain Runtime MBean Server contains the platform MXBeans for all of the servers in the domain. The MBean object names for the platform MXBeans will be the
same as those provided by the JVM except they will have the additional Location=servername
key property. The WLST script in
Example 2–3 illustrates using platform MXBeans to monitor the
resources of a running domain.
Example 2–3 Using Platform MXBeans
This WLST script demonstrates how to use the Platform MXBeans to monitor the resources of a running WLS domain. It uses the domainCustom command
to retrieve the memory usage for 2 servers in the domain. For information on the available platform MXBeans, refer to the following link:
http:download.oracle.comjavase6docsapijavalangmanagementpacka ge-summary.html
connect domainCustom
cd java.lang monitor heap and thread usage once a minute for 5 minutes
x = 0 while x 5:
Admin Server cd java.lang:Location=AdminServer,type=Memory
huAdmin = getHeapMemoryUsage cd ..
cd java.lang:Location=AdminServer,type=Threading numThreadsAdmin = getThreadCount
print Admin server memory usage = , huAdmin.getmax, number threads: , numThreadsAdmin
cd .. m1 server
cd java.lang:Location=m1,type=Memory huM1 = getHeapMemoryUsage
cd .. cd java.lang:Location=m1,type=Threading
numThreadM1 = getThreadCount cd ..
print M1 server memory usage = , huM1.getmax, number threads: , numThreadM1
Thread.sleep60000 x = x + 1
Using the platform MBean server for the Runtime MBean Server is controlled by the PlatformMBeanServerUsed
attribute in the JMX MBean. In previous releases, the default value for the PlatformMBeanServerUsed attribute was false so the
platform MBean server was not used unless explicitly enabled. In this release of WebLogic Server, the default value for the PlatformMBeanServerUsed attribute is
true for domains that are at version 10.3.3.0 or higher. For more information, see the
PlatformMBeanServerEnabled attribute.
2-10 Developing Custom Management Utilities With JMX for Oracle WebLogic Server
If desired, you can configure WebLogic Server to create a separate MBean Server and use it instead of the platform MBean server by setting the
PlatformMBeanServerEnabled attribute value to false with either the WebLogic
Server Administration Console or WLST. Using the Console, navigate to the Domain Configuration
General page Advanced options and deselect the Platform
MBean Server Used check box. In WLST, start an edit session, navigate to the JMX
directory for the domain, use cmo.setPlatformMBeanServerUsedfalse to change the value, and then activate the changes.
For more information on the Platform MBean Server and Platform MXBean, see the following JAVA SDK documentation:
■
http:download.oracle.comjavase6docstechnotesguidesmanag ementmxbeans.html
■
http:download.oracle.comjavase6docsapijavalangmanageme ntpackage-summary.html
2.5.3 Service MBeans