Send email when disk reaches certain usage
Frequently run the following script via cron
1
2
3
4
5
6
7
8
9
10
11
12
| #!/bin/bash
MAX=90
EMAIL=admin@example.com
PART=sda1
USE=`df -h | grep $PART | awk '{ print $5 }' | cut -d'%' -f1`
HOST=`hostname`
if [ $USE -gt $MAX ]; then
echo "Percent used: $USE" | mail -s "Host $HOST running out of disk space" $EMAIL
fi
|