Created
July 16, 2014 16:20
-
-
Save c0bra/d2bfefd0b58a960fcaf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ADMIN="your-email@you.com" | |
| # set alert level 90% is default | |
| ALERT=90 | |
| df -H | grep -vE '^Filesystem|tmpfs|cdrom|^//|/mnt' | awk '{ print $5 " " $1 }' | while read output; | |
| do | |
| #echo $output | |
| usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) | |
| partition=$(echo $output | awk '{ print $2 }' ) | |
| if [ $usep -ge $ALERT ]; then | |
| echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" | | |
| mail -s "ALERT: Almost out of disk space $usep" $ADMIN | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment