-
-
Save anjilinux/78468ece4df5eeffc9d30a0c7c5a2688 to your computer and use it in GitHub Desktop.
Revisions
-
tedheich revised this gist
Oct 26, 2009 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ADMIN="adminEmail@yourDomain.com" # set alert-level 90 % standard ALERT=10 df -h | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 }' | while read output; 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g') THRESHOLD=90 if [ "$CURRENT" -gt "$THRESHOLD" ] ; then mail -s 'Disk Space Alert' sysadmin@yourdomain.com << EOF Your root partition remaining free space is critically low. Used: $CURRENT% EOF fi -
tedheich created this gist
Oct 26, 2009 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ ADMIN="[email protected]" # set alert-level 90 % standard ALERT=10 df -h | 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 echo "space low on \"$partition ($usep%)\", on server $(hostname) at $(date)" | mail -s "Alert: Free space low, $usep % used on $partition" $ADMIN fi done 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ #!/bin/bash CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g') THRESHOLD=90 if [ "$CURRENT" -gt "$THRESHOLD" ] ; then mail -s 'Disk Space Alert' [email protected] << EOF Your root partition remaining free space is critically low. Used: $CURRENT% EOF fi