Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitoring files

Status
Not open for further replies.

adamsd

Technical User
Jul 28, 2002
37
AU
Hello,

I have Big brother up and runnign and it monitors filesystems. Does anyone know if there is a way to monitor file sizes, we have a database file with a limitation upto 2Gb and if it goes beyond that our application crashes. I would like to monitor this file for growth.

Please HELP!!!!

Cheers
Dexter
 
Hi,

There may be a nice package for doing this but as I'm only a script hacker:

An easy way to do it would be to stick the following in a script called by crontab with a line like

0,20,40 * * * * /scriptpath/script # run script every 20 mins

This script can be varied for different thresholds and or MAX file sizes and e-mail users by changing the constants. It obviously only works if you have setup mail on the aix box.



# define constants
MAXFILE=2147483648 #2gigabytes
ALARM_THRESHOLD=90 #percentage above which you want a warning
MAIL2="root sysadmin dbadmin" #add any users you want
#
FILE=/path/DB_FILE #whatever the path to your DB file
FILESIZE=$(ls -al $FILE | awk '{print $5}')
FILE_BY_100=`expr 100 \* $FILESIZE`
PERCENT=`expr $FILE_BY_100 / $MAXFILE`
#
if [ $PERCENT -gt $ALARM_THRESHOLD ]
then
echo "$FILE has gone above warning threshold, please take action" | mail -s "$FILE too big" $MAIL2
fi


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top