The problem
A full disk kills databases, stops log rotation, and breaks deployments. Most admins find out when something else fails. A simple cron job that checks df and sends a Nerve signal catches it before the cascade.
Simple threshold check (one disk)
#!/bin/bash
# /usr/local/bin/nerve-disk-check.sh
export NERVE_DSN="nerve://TOKEN:[email protected]"
THRESHOLD=90
USAGE=$(df / --output=pcent | tail -1 | tr -d ' %')
if [ "$USAGE" -ge "$THRESHOLD" ]; then
echo "DISK ALERT: / is ${USAGE}% full on $(hostname)" | nerve send --severity critical
fi
# Cron: check every 15 minutes
*/15 * * * * /usr/local/bin/nerve-disk-check.sh
All partitions
Loop over all mounted filesystems and alert on any that exceed the threshold.
#!/bin/bash
export NERVE_DSN="nerve://TOKEN:[email protected]"
THRESHOLD=90
df -h --output=target,pcent -x tmpfs -x devtmpfs | tail -n +2 | while read -r mount pct; do
usage="${pct%%%}"
if [ "$usage" -ge "$THRESHOLD" ]; then
echo "DISK: $mount is ${usage}% on $(hostname)" | nerve send --severity critical
fi
done
With cooldown (avoid spam)
Only alert once per hour per mount point.
#!/bin/bash
export NERVE_DSN="nerve://TOKEN:[email protected]"
THRESHOLD=90
COOLDOWN_DIR="/tmp/nerve-disk-cooldown"
COOLDOWN_MINUTES=60
mkdir -p "$COOLDOWN_DIR"
df -h --output=target,pcent -x tmpfs -x devtmpfs | tail -n +2 | while read -r mount pct; do
usage="${pct%%%}"
if [ "$usage" -ge "$THRESHOLD" ]; then
LOCK="$COOLDOWN_DIR/$(echo "$mount" | tr '/' '_')"
if [ ! -f "$LOCK" ] || [ $(( $(date +%s) - $(stat -c %Y "$LOCK") )) -gt $(( COOLDOWN_MINUTES * 60 )) ]; then
echo "DISK: $mount is ${usage}% on $(hostname)" | nerve send --severity critical
touch "$LOCK"
fi
fi
done
Inode exhaustion
A disk can have free space but zero free inodes. This silently breaks writes.
INODE_USAGE=$(df -i / --output=ipcent | tail -1 | tr -d ' %')
if [ "$INODE_USAGE" -ge 90 ]; then
echo "INODE ALERT: / is ${INODE_USAGE}% inodes on $(hostname)" | nerve send --severity critical
fi
Docker volume check
# /var/lib/docker often fills up silently
DOCKER_USAGE=$(df /var/lib/docker --output=pcent 2>/dev/null | tail -1 | tr -d ' %')
if [ -n "$DOCKER_USAGE" ] && [ "$DOCKER_USAGE" -ge 85 ]; then
echo "Docker storage ${DOCKER_USAGE}% on $(hostname)" | nerve send --severity alert
fi
Quick start
go install github.com/nerve-ink/nerve-cli/cmd/nerve@latest
export NERVE_DSN="nerve://TOKEN:[email protected]"
echo "DISK: / is 94% full on prod-db-1" | nerve send --severity critical
FAQ
How do I get a phone alert when my server disk is full?
Add a cron job that checks disk usage with df and sends a Nerve signal when usage exceeds your threshold (e.g., 90%).
Can I monitor multiple disks?
Yes. Loop over all mounted filesystems with df and alert on any that exceed the threshold.
Will I get spammed with alerts?
Use the cooldown script to suppress repeated alerts for the same disk within a time window (e.g., once per hour).