Sunday, March 6, 2011

Check the Discoverer Plus/Viewer processes are UP (Linux version)

Hi All

This script will check for you if the Discoverer processes (Discoverer plus / viewer) are Up. And if not will start it automatically.

How I did it:
1. Created the script under linux Discoverer user.
2. Scheduled in crontab every 10 min.
3. The script can send mail. Its good if you want to monitor the discoverer issues.

Here the script:

export ORACLE_HOME=<discoverer oracle home>
HTTP_Server_STAT=`$ORACLE_HOME/opmn/bin/opmnctl status |grep HTTP_Server |awk -F"|" '{print $4}'`
HTTP_Server_STAT=`echo $HTTP_Server_STAT | grep -v ^$`
echo "HTTP_Server_STAT: "$HTTP_Server_STAT > $ORACLE_HOME/disco_status.log
ServicesStatus_STAT=`$ORACLE_HOME/opmn/bin/opmnctl status |grep ServicesStatus |awk -F"|" '{print $4}'`
ServicesStatus_STAT=`echo $ServicesStatus_STAT | grep -v ^$`
echo "ServicesStatus_STAT: "$ServicesStatus_STAT >> $ORACLE_HOME/disco_status.log
PreferenceServer_STAT=`$ORACLE_HOME/opmn/bin/opmnctl status |grep PreferenceServer  |awk -F"|" '{print $4}'`
PreferenceServer_STAT=`echo $PreferenceServer_STAT | grep -v ^$`
echo "PreferenceServer_STAT: "$PreferenceServer_STAT >> $ORACLE_HOME/disco_status.log
if [ "$HTTP_Server_STAT" != "Alive" ] || [ "$ServicesStatus_STAT" != "Alive" ] || [ "$PreferenceServer_STAT" != "Alive" ]
then
echo "Discoverer may be down.Starting it right now" >> $ORACLE_HOME/disco_status.log
$ORACLE_HOME/opmn/bin/opmnctl startall
#I'm using the simple linux sendmail
mail -s "Discoverer may be down.Starting it right now" <your_mail> < $ORACLE_HOME/disco_status.log
fi

Have a good day.

No comments:

Post a Comment