How can i get the state of weblogic server

Hi, all

Now i want write a shell to get the state of weblogic server,and when the Managed Server's state is not ok, after 3 times checking, i will send msg to the system administrator by sms.

BTW, my environment is :

Linux ,Redhat 5.4 64bit
weblogic version: 10.3.3
the count number of Managed server is 4

How can i write the shell ? I am unfamiliar with shell.

Thanks.

WLST and python are probably the most common ways to do this.

Example code:
WLST My Experiments: Server State using WLST

Write python code that displays the status. Use the above example. Assume you choose UP and DOWN as your personal interpretation of the weblogic status codes. That means we get either "UP" or "DOWN" from your python code.
Let's call it WLST.py

The shell to do this is simple. First create a file (call it email_addr) that has email/SMS addesses. SMS email address is a phone number with the carrier name:

5555555555@verizon.com \
[put as many email addresses as you need, one to a line followed by [space]\ ]
jsmith@mycompany.com

casll the script WLST.shl

#!/bin/bash
# script: WLST.shl check weblogic status
. /etc/profile 
[ -r  ~/.profile ] && .  ~/.profile   # execute login script
email_addr=$( cat  /path/to/email_addr)
cnt=0

for i in 1 2 3
do
    result=$( /path/to/WLST.py  )
    # result should only be "UP" or "DOWN"
    [ $result = "DOWN" ]  && cnt=$(( $cnt + 1 ))
    sleep 10
done
if [ $cnt -eq 3 ]; then
  echo "weblogic is down $(date)" | mailx  -s 'WARN weblogic down'  $email_addr
fi

set the script file to execute:

chmod +x WLST.shl

Finally add this to your crontab (use crontab -e )

* * * * * /path/to/my/WLST.shl  > /path/to/WLST.log 2&>1   

Save the crontab entry.

This will run the script every minute, every day and with three failures you get email/TEXT.

read the crontab man page because getting a text message every minute may not be very helpful - change the runs to be every 5 minutes if you want.