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

df alert when space is over than 95%

Status
Not open for further replies.

aixer007

Vendor
Mar 18, 2006
6
0
0
MA
Dear friends,

Did someone have a script wich run periodically "df" command and if a filesystem is big than 95% send a notification to root or to an email ?

Thank's a lot.
Best regards.
 
Code:
df -k | awk '! /proc|Filesystem/{print $4,$7}' | tr -d '%' | while read used fs
do
  if [ "${used}" -gt 95 ] ; then
      echo "${fs} is ${used}% FULL!" | mail -s "Filesystem Size Alert" user@domain.com
  fi
done

Regards,
Chuck
 
Another way would be to do:

Code:
df -k | tr -d '%' | awk '! /Filesystem|proc/{if ($4>95) print $7" is at "$4"%"}' | mail -s "Filesystem Size Alert" user@domain.com

Regards,
Chuck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top