Below is one of many scripts we have written to monitor our Oracle
environment.  This one checks the Unix file system to see if it is getting
close to full.  If it is it sends either a page or an email, depending on
the parameter supplied.

#          DBA MONITORING SCRIPTS
# ******************************************************************
#
#     Author:         Ron Smith/Nigh Truong
#     Date:           07/08/98
#     Function:        Check to see if a filesystem is full
#
# ******************************************************************
#
#                     CHANGE HISTORY
#
#     DATE        WHO         Reason for Change
#     06/18/98    Ron Smith       New Prog
#
# ******************************************************************
#
#                     FUNCTION
#
#     This script checks to see if a particular filesystem is close
#     to being full.  This is done by issuing a bdf against the
#     server and doing a grep to find the filesystem.  The PCT Used
#     column is compared to the PCT parameter passed to the script.
#     If the PCT passed is more than the current PCT used column,
#     nothing will happen.  If PCT passed is less than the PCT
#     column from the BDF, a file will be created and the oncall
#     DBA will be paged. If an error file already exists, the
#     script exits without any action.  The DBA should delete the
#     error file when the problem is resolved.  Another script
#     should be scheduled to run daily to delete the error file so
#     the DBA is paged at least once a day if the condition
#     continues.
#
#     Three parameters are required.  The first is the filesystem.
#     The second is the maximum acceptable PCT.  The third is the
#     id of the oncall DBA.
#
#     If the id of the DBA is a Zid, a page will be sent.  If the
#     id of the DBA is an email address (determined by looking for
#     an "@" ) , an EMAIL will be sent.
#
# ******************************************************************
#
#                     PREREQUISITES
#
#     The cdmonitoring script must exist in the home/oracle
#     directory.
#
# ******************************************************************
#
#                       SYNTAX
#
#       filesys.sh (/filesystem) (PCT) (dba)
#
# ******************************************************************

# cd to the monitoring script directory
. $HOME/cdmonitoring.sh

FILESYS=$1
FILESYSN=`echo $FILESYS | sed s!/!! `
PCT=$2
DBA=$3
ATCNT=`echo $DBA | grep @ |  wc -l`
export ATCNT
PATH=/usr/local/bin:$PATH:.
export PATH
SERVER=`uname -a | cut -d " " -f2`

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

if [ -e filesys_$FILESYSN.err ]
then echo "File filesys_$FILESYSN.err exists - will exit now"
        exit
fi

# Issue a bdf command and grep for the file system

RESULT=`bdf | grep $FILESYS | awk '{print $5 }' | cut -d% -f1 `
echo $RESULT

if [ "$RESULT" -le "0" ]
        then
        echo "File system not found" > temp_$FILESYSN.txt
        exit 99
fi

# Check to see if PCT used is greater than PCT

if [ "$RESULT" -gt $PCT ]
then echo "-DBA- File system $FILESYS on Server $SERVER almost full " >
filesys_$FILESYSN.err
     if [ "$ATCNT" -gt "0" ]
             then
             echo "email sent"
             elm -s "-DBA- Warning! File system $FILESYS on Server $SERVER
almost full " $DBA < filesys_$FILESYSN.err
             else
             echo "page sent"
             pager $DBA "`cat filesys_$FILESYSN.err`"
     fi
fi

-----Original Message-----
Sent: Tuesday, January 30, 2001 10:50 PM
To: Multiple recipients of list ORACLE-L


Hello,

I need help in writing a unix script to monitor the archive log file for
archiving the redologs.

The script needs to do the following:-

1. Read the parameter, log_archive_dest in the init.ora file
2. After it has the file name, need to know whether more data can written
into the file
   or not.
3. If not, generate an email of write an alert.

If some one can provide a file monitoring script, even that also is good.
Thanks and Regards,

Raja


Get your small business started at Lycos Small Business at
http://www.lycos.com/business/mail.html
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Viraj Luthra
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Smith, Ron L.
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to