Backup monitoring with heartbeat checks
A backup that stopped running looks exactly like one that works, until the day you need to restore it. A heartbeat check turns that silence into an alert: your backup script pings QuickStatus.dev after the upload finishes, and if the ping doesn't arrive on time, you get an email or a Telegram message.
A backup script that reports in
- In QuickStatus.dev, click Add check, then Heartbeat. Name it, for example “Postgres nightly backup”.
- Pick 1 day for Expected every for a nightly backup.
- Pick a Grace a bit longer than the longest normal backup, for example 1 hour. (It starts at the same value as Expected every, which would mean hearing about a missed backup a day late.)
- Copy the ping URL. It's shown only once.
#!/usr/bin/env bash
set -euo pipefail
PING_URL="<ping URL>"
trap 'curl -fsS -m 10 --retry 3 "$PING_URL/fail" >/dev/null || true' ERR
FILE="/var/backups/app-$(date +%F).sql.gz"
pg_dump "$DATABASE_URL" | gzip > "$FILE"
test -s "$FILE"
aws s3 cp "$FILE" "s3://acme-backups/postgres/"
trap - ERR
curl -fsS -m 10 --retry 3 "$PING_URL" >/dev/null
Then schedule it:
30 2 * * * /usr/local/bin/backup.sh
How it works:
set -euo pipefailstops the script at the first failed command, including a failedpg_dumpinside the pipe.- The
trapsends/failwhen any command fails, so a broken run is reported, not just a missing one. test -sfails if the dump file is empty.trap - ERRturns the failure report off once the upload worked, so a network blip on the last ping can't report a good backup as failed.- The success ping is the last line, after the upload. A dump that never left the server doesn't count.
Using mysqldump, restic, borg or rclone instead? Keep the same shape: the commands, then the ping on the last line.
What it catches
- A server that was off at 2:30, or never restarted cron after a reboot
- A database password or S3 key that expired
- A full disk that left an empty or partial dump
- An upload that failed after the dump worked
- A crontab line that was removed during a migration
- A backup that hangs and never finishes
What it doesn't catch: a backup that uploads fine but can't be restored. Test restores on a schedule too, and you can give that job its own heartbeat.
Pricing
The Free plan gives you 10 checks of any type, heartbeats included, plus email and Telegram alerts (2 chats) and 14 days of results, with no card needed. Pro is $15 a month for 25 checks, a 1-minute minimum for Expected every, 90 days of results, and Slack, Discord, PagerDuty, Pushover, webhook and unlimited Telegram alerts. See pricing
Running backups from Kubernetes or GitHub Actions? See Kubernetes CronJob monitoring and GitHub Actions cron monitoring, or start at cron job monitoring. Check your schedule with the cron expression generator.
Backup monitoring FAQ
How do I know if my backup ran last night?
Have the backup script ping a heartbeat URL as its last step. If no ping arrives within Expected every plus Grace, QuickStatus.dev alerts you.
Should the ping go at the start or the end of the script?
At the end, after the upload. A ping at the start only proves the script began.
Can the script report a failure straight away?
Yes. Call the ping URL with /fail added, as the trap line in the example does.
What if I take the database down for maintenance?
Add the heartbeat to a maintenance window. A heartbeat inside a window isn't marked late, and it gets a full Expected every plus Grace after the window ends.
Can I monitor a weekly backup?
Not yet. Expected every goes up to 1 day, so heartbeat checks fit backups that run at least once a day.