My Blog List

Sunday, December 28, 2008

Monitor the Peoplesoft PIA running on weblogic

####################################################################################
# SCRIPT: web-srv-tst.sh
#
# AUTHOR: Pandey, Deep Chandra
# Citagus Software Pvt. Ltd.
#
# DESCRIPTION:
#
# This script is run by crontab at scheduled intervals.
# It will monitor the Peoplesoft PIA running on weblogic
#
# FILES:
#
# REVISION HISTORY
# WHO WHEN (DD/MM/YY) WHY
#
# Pandey, Deep Chandra JUly 14, 2008
#
#
#DBA to whome mail will be sent
DBALIST="deep_pandey@citagus.com";
#####################################################################################
cwd=`pwd`
WBLOG=$cwd/webstatus.log
cd /bea/weblogic92/server/bin
source setWLSEnv.sh
java weblogic.Admin -url t3://citagus-srv8:80 -username system -password citagus04 GETSTATE PIA >> $WBLOG
java weblogic.Admin -url t3://citagus-srv8:80 -username system -password citagus04 GET -pretty -type ServerRuntime >> $WBLOG
#-------> finding any Error message in the Webstatus.log file

egrep "RUNNING" ${WBLOG} >/dev/null 2>&1
if test $? = 0 # Testing the output of previous command - egrep...
then
echo "Web serer is Up and running"
#mail -s "Alert !! Web Server is Running at [$HOSTNAME] Machine" $DBALIST < ${WBLOG}
else
echo "Web server is Down"
mail -s "Alert !! Web Server is down at [$HOSTNAME] Machine" $DBALIST < ${WBLOG}
fi
mv $cwd/webstatus.log $cwd/webstatus.log.bkp