#!/bin/ksh # Program: monitor_db # Purpose: This script gathers database information and then # displays the information to the user. # Author: Adam Backman # Date Written: 03/09/98 # # Setup the environment SCRIPTS=${SCRIPTS-/u3/users/adamb/scripts} TMP=$SCRIPTS/tmp/tmp.mon # Setup database specific variables . $SCRIPTS/live/read_registry $1 case $? in 2) echo "Database $1 is not in database registry" exit 1 ;; 3) echo "Database $1 is on $HOST not on this host" exit 1 ;; esac # Check to see if the database is up or down proutil $DB_DIR/$DB -C busy 2>/dev/null >/dev/null if [ $? -eq 0 ] then echo "The database is not running - Cannot monitor" exit 1 else promon $DB_DIR/$DB << $END$ > $TMP 2>/dev/null 3 1 q 5 q 7 q q $END$ fi # Establish DB requests (18-26) and DB reads (27-35) echo echo "Monitor information for database : " $DB_DIR/$DB echo echo " Date : \c " date echo X=`cat $TMP | grep TOTAL | cut -c 18-28` echo " Total number of database request: " $X echo Y=`cat $TMP | grep TOTAL | cut -c 29-38` echo " Total number of database reads : " $Y echo Z=`echo $Y $X| awk '{printf "%6f", 100-$1/$2}'` echo " Buffer hit Rate in % : " $Z echo X=`cat $TMP | grep Flushed | cut -c 58-65` echo " Buffers flushed at checkpoint : " $X echo Y=`cat $TMP | grep "Total number of database blocks:" | cut -c 34-50` echo " Total Number of database blocks : " $Y echo Z=`cat $TMP | grep "Database blocks high water mark:" | cut -c 34-50` echo " Database blocks high water mark : " $Z echo X=`expr $Y - $Z` echo " Empty available space : " $X echo # #### There needs to be a calculation of empty space here #### # echo rm $TMP