Automatic Logical Log Status
Posted in 1997
Hi y'all! Well I've gone ahead and written a simple script to check up on my logical logs. I'm posting it below, in case anyone wants to use it. The script basically examines the number of logical logs that are 100.00% full and calculates the percentage of total logical logs that are full. If this value (FULLPERC) is greater than or equal to PERCMAX then email the output of tbstat -l and tbstat -u to your DBAs. Further to this, if the FULLPERC is greater than BACKUPMAX, then include a message which strongly recommends that the logical logs be backed up immediately. If you all have any other way of improving this, let me know. : # # Name : logcheck.sh # # Author : Edmund Nigel Gall # # Usage : logcheck.sh <instance name> # # Example : logcheck.sh mprod # # Description: Examines the status of the logical logs and emails DBAs # when over a specified percentage of the logs are full. # # Use 'crontab - l' (el) to determine how often this script is run. # # Set your Informix environment variables # (We have this in another script called tbconfig). OPATH=/bin:/usr/bin; export OPATH . /usr5/lbin/tbconfig $1 TMP=/tmp/logcheck.$$ PERCMAX=50 BACKUPMAX=70 LOGFILES=12 # Number of logical logs. # Get logical logs status. date >> $TMP fullogs=`tbstat -l|tail +15|grep "100\\.00"|wc -l` fullperc=`expr $fullogs \\* 100 / $LOGFILES` echo "Number of full logs: $fullogs ($fullperc %)." >> $TMP # Request logical logs be backed up if over 70% full. if [ $fullperc -ge $BACKUPMAX ] then echo >> $TMP echo "******************************************" >> $TMP echo "******************************************" >> $TMP echo "** **" >> $TMP echo "** !! Please backup logical logs now !! **" >> $TMP echo "** **" >> $TMP echo "******************************************" >> $TMP echo "******************************************" >> $TMP # Attach full logical and physical log status. echo >> $TMP tbstat -l >> $TMP # Attach list of OnLine users. echo >> $TMP tbstat -u >> $TMP else # Attach full logical and physical log status. echo >> $TMP tbstat -l >> $TMP fi # Notify DBAs or IT Support if over PERCMAX full. if [ $fullperc -ge $PERCMAX ] then (echo "Subject: LOGICAL LOGS $fullperc % FULL\\n"; cat $TMP) | \\ /usr/lib/sendmail nigelg fi # Cleanup temporary file. rm $TMP # # End of script # >Hi y'all! > >I'd like to write a script to periodically check the status of the logical logs, and send me an email alarm if the logs are 60% full. I know in ODS 7.x we have the sysmaster database, but I haven't upgraded to this yet. I'm running OnLine 5.05.UC1 on DEC AlphaServer, Digital Unix 3.0b. Can I poll one of the system catalog tables (I think not, but need confirmation), or would I have to write the awk script of my life to interpret tbstat -l? > >Thanks much. > Best regards, Nigel +--------------------------------------------------------------------+ |Name : Edmund Nigel Gall Atlantic Avenue | |Title : Information Systems Specialist Pt. Lisas Industrial Estate| |Company: Process Plant Services Ltd. Pt. Lisas, Couva | | Trinidad & Tobago, W.I. | | Business Personal | | mailto:nigelg@ppsl.com mailto:nigelg@ppsl.com | | Phone : (868) 636 3153/2878/3195 Phone : (868) 662 6611 | | Fax : (868) 679 3770 Fax : (868) 662 6611 | +------------------------ http://www.ppsl.com -----------------------+