Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> My 10 liner alert log monitoring WORKING shell Script !!! Comments Please !!!!
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
![]() |
![]() |