Script to notify via email when low on disk space | pressku.com

Trending 3 months ago

I recovered nan beneath mentioned book connected nan internet, which notifies via email erstwhile server gets debased connected retention aliases arsenic per defined. I tally it each 5 minutes, if one americium debased connected retention it keeps notifying maine pinch email aft 5 minutes. What one request is to get only 1 email notification erstwhile retention limit group exceeds because 1 notification is enough. I will cleanable up retention and if it again exceeds one again get notified erstwhile and truthful on. one tally book pinch crontab.

#!/bin/sh # Purpose: Monitor Linux disk abstraction and nonstop an email alert to $ADMIN ALERT=90 # alert level ADMIN="[email protected]" # dev/sysadmin email ID df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ people $5 " " $1 }' | while publication -r output; do echo "$output" usep=$(echo "$output" | awk '{ people $1}' | trim -d'%' -f1 ) partition=$(echo "$output" | awk '{ people $2 }' ) if [ $usep -ge $ALERT ]; then echo "Running retired of abstraction \"$partition ($usep%)\" connected $(hostname) arsenic connected $(date)" | message -s "Alert: Almost retired of disk abstraction $usep%" "$ADMIN" fi done
More
close