#!/bin/ksh # This script is used to verify periodically if other servers are up # check_server.sh # Biju Thomas # whostname=`hostname` for wserver in server1 server2 server3 server4 server5 do if test $wserver != $whostname then # If 100% packet loss returned, inform dba on call if [ `/etc/ping $wserver -n 1 | grep -c "100% packet loss"` -ne 0 ] then # Check if this server down information was reported earlier # If yes, don't send page again if test ! -f /home/oracle/.alerts/$wserver then # New alert, Page DBA, set marker file MESSAGE="$wserver NOT RESPONDING (Could Not Ping)... PLEASE CHECK IF SERVER IS DOWN." # echo $MESSAGE /usr/local/bin/qpage -s page -p dba_on_call $MESSAGE touch /home/oracle/.alerts/$wserver # Log pages sent date >> /home/oracle/.alerts/page.log echo $MESSAGE >> /home/oracle/.alerts/page.log fi else # Check if the server was down earlier and is up now # If yes, remove marker file if test -f /home/oracle/.alerts/$wserver then rm -f /home/oracle/.alerts/$wserver MESSAGE="$wserver IS UP... PLEASE VERIFY IF ALL ORACLE INSTANCES ARE OK." /usr/local/bin/qpage -s page -p dba_on_call $MESSAGE # Log pages sent date >> /home/oracle/.alerts/page.log echo $MESSAGE >> /home/oracle/.alerts/page.log fi fi fi done # # End of Script - Biju Thomas - 06/05/1998