Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Monitor Script

RE: Monitor Script

From: Smith, Ron L. <rlsmith_at_kmg.com>
Date: Mon, 10 Jul 2000 15:29:37 -0500
Message-Id: <10554.111604@fatcity.com>


Here is a simple one that uses the Unix 'ps' command. I am using courier mail but you could use elm.    

-
# cd to the monitoring script directory

. $HOME/cdmonitoring.sh  

PATH=/usr/local/bin:$PATH:.
export PATH  

DATABASE=$1
DBA=$2
EMAIL=$3
SERVER=`uname -a | cut -d " " -f2`
export SERVER  

# Check to see if an error file exists. If it does get out.
 

if [ -r database_$DATABASE.err ]
then echo "File database_$DATABASE.err exists - will exit now"

        exit
fi  

linecount=0
linecount=`ps -ef | grep ora_pmon_$DATABASE | sed /grep/d | wc -l`  

# If linecount ne 1 then the database is not up
 

if [ $linecount -ne 1 ]

        then echo "-DBA- Database $DATABASE is down on server $SERVER" > database_$DATABASE.err

        ATCNT=`echo $DBA | grep @ |  wc -l`
        if [ "$ATCNT" -gt "0" ] 
                then
                echo "email sent"
                couriermail -s "-DBA- Warning! $DATABASE is down on server
$SERVER" $DBA < database_$DATABASE.err
                else
                echo "page sent"
                pager $DBA "`cat database_$DATABASE.err`"
        fi

fi      

 ----Original Message-----
From: Pafumi, Diego [mailto:Diego.Pafumi_at_xpedior.com] Sent: Monday, July 10, 2000 3:35 PM
To: Multiple recipients of list ORACLE-L Subject: Monitor Script

Hi to all,  

Does anybody has a UNIX script to monitor the DB and receive an e-mail if something is wrong?  

Thanks   

Diego
Oracle DBA Received on Mon Jul 10 2000 - 15:29:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US