WLST Script to Monitor Throughput and HeapSize of Weblogic Server

In this simple example ill demonstrate how to browse to ThreadPoolRuntime and JVMRuntime Mbeans of Weblogic Server and monitor their attributes. We get a lot of useful runtime date from this Mbeans which we can store for later reference.

cd(“/ServerRuntimes/AdminServer/ThreadPoolRuntime/ThreadPoolRuntime”)

-r– HealthState State: HEALTH_OK,ReasonCode:[]
-r– HoggingThreadCount 0
-r– MinThreadsConstraintsCompleted 20485
-r– MinThreadsConstraintsPending 0
-r– Name ThreadPoolRuntime
-r– PendingUserRequestCount 0
-r– QueueLength 0
-r– SharedCapacityForWorkManagers 65536
-r– StandbyThreadCount 4
-r– Suspended false
-r– Throughput 49.25373134328358
-r– Type ThreadPoolRuntime

cd(“/ServerRuntimes/AdminServer/JVMRuntime/AdminServer”)

-r– HeapFreeCurrent 201978672
-r– HeapFreePercent 75
-r– HeapSizeCurrent 267583488
-r– HeapSizeMax 535166976
-r– JavaVMVendor Sun Microsystems Inc.
-r– JavaVendor Sun Microsystems Inc.
-r– JavaVersion 1.5.0_12
-r– Name AdminServer
-r– OSName SunOS
-r– OSVersion 5.10
-r– Type JVMRuntime
-r– Uptime 19589860

SCRIPT

def serverStatus(server):
cd(‘/ServerLifeCycleRuntimes/’+server)
return cmo.getState()

def getServerNames():
domainConfig()
return cmo.getServers()

def printThreadDetails():
connect(“weblogic”,”weblogic”,”t3://localhost:7001?)
serverNames=getServerNames()
domainRuntime()

for name in serverNames:
serverState = serverStatus(name.getName())

if serverState != “SHUTDOWN”:
cd(“/ServerRuntimes/”+name.getName()+”/ThreadPoolRuntime/ThreadPoolRuntime”)
tput=cmo.getThroughput()
cd(“/ServerRuntimes/” + name.getName() + “/JVMRuntime/” + name.getName())
heapSize=cmo.getHeapSizeCurrent()
print name.getName()
print ” Throughput:”,tput
print ” HeapSize:”,heapSize
print “\n”

if __name__== “main”:
printThreadDetails()

OUTPUT

AdminServer
Throughput: 55.72139303482587
HeapSize: 267583488

MS2
Throughput: 0.9950248756218906
HeapSize: 92995584

Latest Comments

  1. Rahul Gupta November 19, 2010
  2. Loukas Rougkalas November 23, 2010
  3. Kapil December 19, 2011
    • Administrator February 3, 2012
  4. Anonymous October 21, 2013

Leave a Reply