Multiple Domains Monitor Script in Weblogic Server

Monitor Runtime Attributes from Multiple domains

This script has been created by Suman Aluru. Suman also submitted the description that follows.

This script monitors JVM, JDBC Connection Pools, Execute Queues, JMS Queues and JMS Topics in several domains.

The script is split in two files. The file "monitor.wlsh" contains the monitoring commands. The file "readmonitor.wlsh" contains the information to connect to each domain and calls to the first script file.

To run this script, create a folder called "output" under "c:\" directory and copy these two files to "c:\wlshell\bin". These are the defaults settings, but can be customized by changing the path in the script. Edit file "readmonitor.wlsh" to customize the connection information.


This is the file "readmonitor.wlsh":


# Author: Suman Aluru

monfile = c:\wlshell\bin\monitor.wlsh
while true
# User details to connect server1 and call the monitor script.
@ server = localhost:7001
@ user = weblogic
@ password = weblogic
connect
read $monfile
disconnect

sleep 10000 # Sleep for few time.

# User Details to connect server2 and call the monitor script.

@ server = anotherhost:8001
@ user = system
@ password = abcdef
connect
read $monfile
disconnect

sleep 100000
end


This is the file "monitor.wlsh":

# Author: Suman Aluru

date
@ day = $LAST

# Get the JVM Runtime Values
type = JVMRuntime
for $s in $SERVERS
@ freejvm = get /$type/$s/HeapFreeCurrent
@ totaljvm = get /$type/$s/HeapSizeCurrent
@ usedjvm = expr($totaljvm - $freejvm)
print $s "," $day "," $totaljvm "," $usedjvm "," $freejvm >> c:\output\jvmoutput.txt
end

# This will get the list of Connection Pools into an array.

# Note: this process will be simpler in version 2.1. with the following commands:
# ls -l /JDBCConnectionPoolRuntime
# dbpools = $LAST
# where $LAST will include the name of the pool and the server where it is located

type = JDBCConnectionPoolRuntime
@ dir /$type
dbpools = $LAST

for $s in $SERVERS
for $p in $dbpools
res = $p"@"$s
if $p == get /$type/$res/Name then
@ name = get /$type/$res/Name
@ maxcap = get /$type/$res/MaxCapacity
@ conncc = get /$type/$res/ActiveConnectionsCurrentCount
@ connhc = get /$type/$res/ActiveConnectionsHighCount
@ waitse = get /$type/$res/WaitSecondsHighCount
@ waitcc = get /$type/$res/WaitingForConnectionCurrentCount
@ state = get /$type/$res/PoolState
print $s "," $name "," $day "," $maxcap "," $conncc "," $connhc "," $waitse "," $waitcc "," $state >> c:\output\dbout.txt
end
end
end

# This will look for the each individual Execute Queue Runtime values.

type = ExecuteQueueRuntime
@ dir /$type
queues = $LAST

for $s in $SERVERS
for $q in $queues
res = $q"@"$s
if $q == get /$type/$res/Name then
@ name = get /$type/$res/Name
@ tthreads = get /$type/$res/ExecuteThreadTotalCount
@ ithreads = get /$type/$res/ExecuteThreadCurrentIdleCount
@ ql = get /$type/$res/PendingRequestCurrentCount
@ througp = get /$type/$res/ServicedRequestTotalCount
print $s "," $name "," $day "," $tthreads "," $ithreads "," $ql "," $througp >> c:\output\eqout.txt
end
end
end

# This will look for the each individual JMS Queue/Topic Runtime values.

type = JMSDestinationRuntime
@ dir /$type
destinations = $LAST

for $s in $SERVERS
for $d in $destinations
res = $d"@"$s
if $d == get /$type/$res/Name then
@ name = get /$type/$res/Name
@ bcc = get /$type/$res/BytesCurrentCount
@ bpc = get /$type/$res/BytesPendingCount
@ brc = get /$type/$res/BytesReceivedCount
@ bhc = get /$type/$res/BytesHighCount
@ mcc = get /$type/$res/MessagesCurrentCount
@ mpc = get /$type/$res/MessagesPendingCount
@ mhc = get /$type/$res/MessagesHighCount
@ mrc = get /$type/$res/MessagesReceivedCount
@ ctc = get /$type/$res/ConsumersTotalCount
print $s "," $name "," $day "," $$bcc "," $bpc "," $brc "," $bhc "," $mcc "," $mpc "," $mhc "," $mrc "," $ctc >> c:\output\jmsout.txt
end
end
end

0 Response to "Multiple Domains Monitor Script in Weblogic Server"

Post a Comment

Powered by Blogger