From philippe.nguyen@cetelem.fr Thu, 03 May 2001 08:44:45 -0700 From: "NGUYEN Philippe (Cetelem)" Date: Thu, 03 May 2001 08:44:45 -0700 Subject: RE: monitoring listener.log Message-ID: MIME-Version: 1.0 Content-Type: text/plain Title: monitoring listener.log Hi and thanks to " Danisment Gazi Unal (what does it mean ?)" Here is the script : #!/bin/sh # This script make 2 things : # 1- archive alert files # 2- search "ORA-" in alert.log file # if error is found , send an email to adresses passed in parameters # # Entry parameters : # 1- SID # 2- list of emails separated by a space # Ex : % ALTERTCHECK ORCL user1@company.com user2@company.com # --------------------------------------------------------------- SCRIPT_DIR=/home/ORCL/script ORACLE_SID=$1 shift EMAIL=$* # Set ALERT_DIR and ALERT_FILE # ------------------------------------------ ALERT_DIR=/app/oracle/admin/$ORACLE_SID/bdump ALERT_FILE=alert_$ORACLE_SID.log ALERT_LOG=$ALERT_DIR/$ALERT_FILE ERRFILE=$SCRIPT_DIR/ALERT_ERRORS.TXT SUBJECT="Error in alert file of $ORACLE_SID" # Remove the alert file #30 # ------------------------------------------------ if [ -f $ALERT_LOG.30 ] then /bin/rm $ALERT_LOG.30 fi # Renanme the alert file, ex: 29 to 30, 28 to 29, .., 01 to 02, etc. # ------------------------------------------------------ i=29 while [ $i -ge 1 ] ; do j=`expr $i + 1` if [ -f $ALERT_LOG.$i ] then mv $ALERT_LOG.$i $ALERT_LOG.$j fi i=`expr $i - 1` done   # Rename the current alert log file to #1 # ------------------------- if [ -f $ALERT_LOG ] then mv $ALERT_LOG $ALERT_LOG.1 fi # Create a new alert file, not mandotory (Oracle will do this) # -------------------------------------------- touch $ALERT_LOG chmod 777 $ALERT_LOG # Remove the error file # --------------------------- if [ -f $ERRFILE ] then /bin/rm $ERRFILE fi   # Searching for ORA- in the alert log #1 # if error, send mail to adresses in parameters # ------------------------------------------------------- cat $ALERT_LOG.1 |grep '\ORA-' > $ERRFILE if [ -s $ERRFILE ] then cat $ERRFILE | mailx -s "$SUBJECT" $EMAIL fi -----Message d'origine-----De: Saurabh Sharma [mailto:saurabhs@fcsltd.com]Date: vendredi 27 avril 2001 12:12Ą: Multiple recipients of list ORACLE-LObjet: Re: monitoring listener.log hey can u elaborate how do u scan each log file, and convert it in email msg. how do u do this..   saurabh sharma dba  
----- Original Message -----
From: NGUYEN Philippe (Cetelem) To: Multiple recipients of list ORACLE-L Sent: Wednesday, April 25, 2001 9:10 PM Subject: monitoring listener.log Hi list, We have a script wich monitor the alert.log for each database. This script scan the alert.log file and send an email if an ORA-xxx error occured Now, we want to write a script monitoring the listener.log file : wich kind of message or variable indicate a network  problem (ORA-xxx, ...) ? ...then we 'll have the same question for the log file made by OEM ! TIA