Weblogic admin script for command line monitoring

Problem

You want to be able to view BEA Weblogic Server status from the command line.



Solution

Works beautifully with weblogic 6.1 and wlintegration 2.1 on Solaris – untested with Weblogic 7 or 8, etc.



Example


If your setenv.sh is different, update to correct path – same with password and port (7001).
To obtain the JVM stats, just run it like this:

./wladmin GET -pretty -type JVMRuntime
===================    wladmin script ==========================
#!/bin/zsh

# script to run command line weblogic stuff

[ $# -eq 0 ] && {

echo "
Usage: $0 Command

Examples:

$0 HELP
$0 GET -pretty -type Server
$0 GET -pretty -type Server
$0 GET -pretty -type Security
$0 GET -pretty -type WebAppComponent
$0 GET -pretty -type WebAppComponent Runtime -property Status
$0 GET -pretty -type Application
$0 GET -pretty -type Realm
$0 GET -pretty -type ServletRuntime
$0 GET -pretty -type JVMRuntime
$0 GET -pretty -type JDBCConnectionPool
$0 GET -pretty -type JDBCConnectionPoolRuntime
$0 GET -pretty -type Machine
$0 GET -pretty -type Cluster
$0 GET -pretty -type ClusterRuntime
$0 GET -pretty -type JTA
$0 GET -pretty -type JTARuntime
$0 GET -pretty -type ExecuteQueue
$0 GET -pretty -type ExecuteQueueRuntime

"
exit 1

}

. /opt/bea/wlserver6.1/setenv.sh > /dev/null


java -cp $CLASSPATH weblogic.Admin -url localhost:7001 -username system -password YOUR_PASSWORD $*

exit 0
===================    wladmin script ==========================

The HeapFreeCurrent is the value of interest.

Capture can then be automated with a script run by cron, that additionally pumps out the date to correlate timings with stats.



Reference



Leave a Reply

Your email address will not be published. Required fields are marked *