Created
November 26, 2012 14:42
-
-
Save mcnemesis/4148557 to your computer and use it in GitHub Desktop.
linux : mail-report on low disk-space in one line!
This file contains 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
df -h | grep -e "/home$" | awk '{print $5}' | tr '%' ' ' | xargs -n 1 -I{} echo {} | xargs -n1 -I_percent -- sh -c '[ _percent -ge 70 ] && echo "Low Space on server:/home (_percent% full)" | mail -s "Disk Space Alert" johndoe@site.com' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that this one monitors just one partition (/home in this case), and then also alerts on the >=70% full condition only. So, you might want to customize those params, and also specify your own custom message and destination email address.