Simple disk space alert

We had a need to get alerts in case we are close to running out of disk space on multiple servers but we didn’t want to over complicate it with heavy processes and monitoring. My solution:

CURRENT=$(df /u01 | grep /u01 | awk '{ print $4}' | sed 's/%//g')
TO=\ \

if [ "$CURRENT" -lt "$THRESHOLD" ] ; then
mail -s 'Disk Space Alert' $TO << EOF
/u01 partition is running low on disk space. $CURRENT bytes left.

Drop that bad boy in /etc/cron.hourly and you got yourself a heartbeat baby!