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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi if my filesystem is more than 75% i want to send email to my box?

Status
Not open for further replies.

CALYAN

Programmer
Apr 23, 2001
39
US
Filesystem kbytes used avail %used Mounted on
/dev/root 307200 43611 247155 15% /
/dev/vg00/lvol1 199381 45434 134008 25% /stand
/dev/vg00/lvol8 1048576 851994 184774 82% /var
/dev/vg00/lvol7 1048576 484374 528950 48% /usr
/dev/vg03/informix 1048576 531904 484387 52% /usr/informix

if my file system exceed 75% i want send email to
calyanram@hotmail.com how to do it.

regards
s.kalyan
 
Here is a little something I have cron'd, which seems to do the trick (though I'm sure it could be done better!):

#!/bin/ksh
#-------------------------------------------------------------------------
# Check for filesystems that are 85+% full
#-------------------------------------------------------------------------
export OUTPUT=/scripts/output/filespace.$$
bdf | grep ^/| sed 's/\%//g' | awk '{if ($5 > 84) {print $6","$5"%"}}' >>$OUTPUT
fs_count="`cat $OUTPUT | wc -l`"
if [ $fs_count -gt 0 ]
then
for a in `cat /scripts/mail_list |awk '{ if (length($0) >1) {print $0}}'`
do
mailx -s &quot;Diskspace issue `uname -n`&quot; $a <<EOD
`echo &quot;The following filesystems are at or above 85% capacity:&quot;`
`echo`
`cat $OUTPUT | awk '{FS=&quot;,&quot;;print $1&quot; -- &quot;$2}'`
EOD
done
fi
rm $OUTPUT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top