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

Home -> Community -> Mailing Lists -> Oracle-L -> My 10 liner alert log monitoring WORKING shell Script !!! Comments Please !!!!

My 10 liner alert log monitoring WORKING shell Script !!! Comments Please !!!!

From: BN <bnsarma_at_gmail.com>
Date: Thu, 2 Nov 2006 12:00:42 -0500
Message-ID: <61292a9d0611020900x5388df17t589fdee7fbc5e81c@mail.gmail.com>


Greetings,

Actually its 20 lines,
I did some initial tests, seems to be working fine. Appreciate your comments and feedback, suggestions

#!/bin/ksh

ALERT_LOG="$ORACLE_BASE/admin/${ORACLE_SID}/bdump/alert_${ORACLE_SID}.log" TS_NOW=$(date '+%c')
TS_PREV=$(< last_timestamp)

TS_LAST=$(egrep '^[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[1-9]+' $ALERT_LOG |tail
-1)

if test "$TS_PREV" = "$TS_LAST"
then

   echo "\n\t$TS_NOW \n\tThis Message has already been Sent \n"    echo "\tTS_PREV=$TS_PREV \t TS_LAST=$TS_LAST\n"    exit
fi

# Add to egrep -iv the oracle error message you dont want to be alerted OERR=$(awk "/$TS_LAST/,/$TS_PREV/" $ALERT_LOG |egrep -i '^ora-'|egrep -iv 'ORA-01403|ORA-01400') echo " TS_PREV=$TS_PREV \t TS_LAST=$TS_LAST\n $OERR" # You can add sendmail(mailx) or paging feature here
echo "$TS_LAST" >last_timestamp

--

Regards & Thanks
BN

--

http://www.freelists.org/webpage/oracle-l Received on Thu Nov 02 2006 - 11:00:42 CST

Original text of this message

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