Home/Answers/Notify when disk space is low
Answer

How do I get a notification when disk space is low?

Run a bash df check on cron that POSTs to Lert past your threshold. Download the app, copy your link, and let a scheduled script buzz your phone before the disk fills up. No account, no API keys, no SDK.

A full disk takes down services quietly, so the fix is to be warned early. The recipe is a one-liner: read the used-percentage from df, compare it to a threshold, and if you're over it, send a push. Because your Lert link is the credential, the alert is a single curl — no agent to install, no monitoring account, no key on the server.

The entire setup — under 30 seconds

  1. Download the app. Open it once. There's no account to create, and your private link is waiting on screen.
  2. Copy your link. One tap copies something like https://lert.dev/p/your-id.
  3. Add the df check to cron. Read disk usage on a schedule; POST to your link when it's over your limit.

Then your phone buzzes — instantly, even locked in your pocket.

The disk-space script

bash
#!/usr/bin/env bash
LERT="https://lert.dev/p/your-id"
LIMIT=90   # alert when % used crosses this

used=$(df / | awk 'NR==2 {gsub("%","",$5); print $5}')

if [ "$used" -ge "$LIMIT" ]; then
  curl -s -X POST "$LERT" \
    -H "Content-Type: application/json" \
    -d "{\"title\":\"Disk almost full\",\"body\":\"Root is ${used}% used on $(hostname)\",\"tag\":\"disk\"}"
fi

Schedule it with */15 * * * * /path/to/disk.sh to check every fifteen minutes. Change df / to any mount point you care about, and set LIMIT to give yourself enough runway to clear space before it matters.

Tip: the same shape works for CPU load, memory pressure, or a growing log directory. Compute a number in the shell, compare it, and finish with one POST to Lert.

Related things people automate

It's free for one channel and 50 notifications a day; Lert Pro is $2.99/month for unlimited. See the docs for the full API, or the answers index for more recipes.

Send your first one in 30 seconds.

Download Lert, copy your link, POST to it. Your phone buzzes.

Get the app iOS