Created
September 10, 2015 13:57
-
-
Save mick-shaw/c1d87f18d73e30ff86e3 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
| #!/bin/bash | |
| # set recipient Address | |
| ADMIN="recipient@mail.com" | |
| # set alert-level to 90% | |
| ALERT=10 | |
| df -P | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 }' | while read output; | |
| do | |
| usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) | |
| partition=$(echo $output | awk '{ print $2 }' ) | |
| if [ $usep -ge $ALERT ]; then | |
| /usr/sbin/sendmail "$ADMIN" <<EOF | |
| From: sender@mail.com | |
| Subject: Storage Alert ($usep% Utilization) | |
| All Concerned, | |
| The $partition partition on $HOSTNAME has reached $usep% at $(date). | |
| EOF | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment