Disk Space and Resource Management
Disk Space and Resource Management
Alerting when disk usage exceeds safety thresholds:
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read -r output; do
usage=$(echo "$output" | awk '{ print $1}' | cut -d'%' -f1)
partition=$(echo "$output" | awk '{ print $2 }')
if [ "$usage" -ge 90 ]; then
echo "CRITICAL: Partition $partition is at ${usage}% capacity!" >&2
fi
done