Alert on a disk filling up
Logs or backup files eat /var; in 24 hours the server falls over. A basic df check every 10 minutes saves a 2 AM incident.
Recipe
#!/usr/bin/env bash
# /etc/cron.d/disk-watch — */10 * * * * root /opt/disk-watch.sh
THRESHOLD=${THRESHOLD:-85}
while read -r FS USED MOUNT; do
USED=${USED%\%}
if [ "$USED" -ge "$THRESHOLD" ]; then
curl -X POST "$SLACK_WEBHOOK" \
--data "{\"text\":\"$(hostname): $MOUNT at ${USED}% (was ≥ $THRESHOLD)\"}"
fi
done < <(df -P -x tmpfs -x devtmpfs | awk 'NR>1 {print $1, $5, $6}')
Same thing in Enterno.io
The cron job itself should ping an Enterno heartbeat — if your script silently dies before checking the disk, Enterno still alerts because the ping never arrived.
Related recipes
logrotate stopped (config syntax error on last edit, or the systemd timer was disabled) — the main log file grows. Nobody notices until the disk fills.
Your cron silently stopped running. Need an alert when the script misses its window.
A container OOM-kills, the restart policy revives it — no external signal until users complain.