Database Backup Monitoring

Know when your database backup misses a check-in.

Keep your existing backup tool. Send a heartbeat after the dump and required upload succeed, and get alerted when the next expected check-in is overdue. Start with the backup you would restore first; test recoverability separately.

5 monitors free · Email, Slack, and Discord · No credit card

Three checks for a nightly database backup

  1. Completion

    Let the dump and required upload finish, then send the monitor’s success heartbeat.

  2. Missed check-in

    If the expected receipt is overdue beyond grace, PingCron can mark the monitor down and queue an alert.

  3. Recovery

    Separately restore into an isolated database and check the restored data. A heartbeat cannot prove recoverability.

Illustrative workflow. Use separate monitors for independently scheduled backups, and verify receipt of a test alert.

Check the backup job, the stored copy, and the restore separately.

A green scheduler entry only shows that a command ran. A backup can still be incomplete, missing from the recovery destination, or impossible to decrypt. Decide which steps must succeed before your script reports success.

PingCron watches the check-ins your job sends. It does not inspect archives or restore databases. Use missed-run monitoring alongside destination checks and isolated restore drills so each check answers a specific recovery question.

Investigate a missing backup check-in in this order:

  • Check whether the scheduler started the expected job, using its configured timezone.
  • Read the dump and upload exit codes; inspect storage capacity and access errors.
  • Confirm that the expected new archive reached the recovery destination.
  • If the work succeeded, check heartbeat delivery and the monitor’s interval and grace.

Setup

Send success after the backup reaches its destination

Define the dump, transfer, and verification steps your recovery process requires. Only report success when all required steps complete.

Before

0 2 * * * /scripts/backup-and-upload.sh

After

0 2 * * * sh /scripts/postgres-backup.sh

Use the runnable PostgreSQL-to-S3 example below. Configure the scheduler environment, download the script, and report once after the dump and required upload. A heartbeat delivery warning preserves backup success. Verify restoration separately.

Verify your first monitored database backup

Define what a completed backup means before adding its heartbeat. If recovery depends on an offsite copy, send success after both the dump and upload succeed. A local file or a successful HTTP receipt alone cannot establish recoverability.

Check the backup crontab →
  • Preserve the exit status of each dump, compression, and upload command. Avoid pipelines that hide an earlier failure.
  • Choose grace to cover normal backup duration and expected scheduler delays. Keep separate monitors for independently scheduled backups.
  • Run restore drills into an isolated destination and verify the restored data. Keep decryption keys recoverable separately from encrypted backups.

PostgreSQL to S3: a runnable backup completion example

This POSIX shell script dumps one PostgreSQL database in custom format, uploads it with AWS CLI v2, then optionally sends a bounded HTTPS heartbeat. A failed dump or upload stops the script. A failed heartbeat warns without rerunning the completed backup or changing its successful exit status.

Configure before scheduling

  • Install sh, mktemp, curl, a compatible pg_dump, and AWS CLI v2 on the job host. Provide enough private temporary disk space for the full archive. Run the downloaded file with sh /scripts/postgres-backup.sh.
  • Set PGDATABASE, PGHOST, PGPORT and PGUSER in the scheduler's environment. Use a protected PGPASSFILE or another supported libpq authentication method. Do not put passwords or heartbeat URLs in crontab, shell tracing, or logs. Cron does not automatically load your interactive shell environment.
  • Set S3_PREFIX to your existing private bucket and optional prefix, for example s3://your-private-bucket/postgres/daily. Configure AWS credentials with permission to upload there. Configure bucket encryption, retention/lifecycle, access controls and restore access separately. Each run creates a unique object; this script does not expire old backups.
  • Optionally set PINGCRON_URL to your monitor's secret HTTPS success URL. Install the script once, then schedule it directly, for example 0 2 * * * sh /scripts/postgres-backup.sh. Do not append a second heartbeat command. Choose grace to cover dump and upload duration.
Download postgres-backup.sh
#!/bin/sh
# Run with sh postgres-backup.sh. Do not enable shell tracing: the URL is secret.
# Required: PGDATABASE plus libpq connection/authentication settings, S3_PREFIX.
# Prerequisites: compatible pg_dump, AWS CLI v2 with credentials, curl, mktemp.
# Example S3_PREFIX: s3://your-private-bucket/postgres/daily
set -eu
umask 077
: "${PGDATABASE:?Set PGDATABASE and libpq connection settings}"
: "${S3_PREFIX:?Set S3_PREFIX to an S3 bucket and optional prefix}"
case "$S3_PREFIX" in
  s3://?*) ;;
  *) printf '%s\n' 'S3_PREFIX must start with s3:// and a bucket.' >&2; exit 2 ;;
esac
scratch=$(mktemp -d "${TMPDIR:-/tmp}/postgres-backup.XXXXXXXX")
trap 'rm -rf -- "$scratch"' EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
archive="$scratch/backup.dump"
# These are separate commands: neither failure is hidden by a pipeline.
pg_dump --no-password --format=custom --file="$archive"
key="$(date -u +%Y%m%dT%H%M%SZ)-${scratch##*/}.dump"
aws s3 cp "$archive" "${S3_PREFIX%/}/$key" --only-show-errors
# Monitoring is optional and cannot change the completed backup's exit status.
if [ -n "${PINGCRON_URL:-}" ]; then
  case "$PINGCRON_URL" in
    https://?*) valid=1 ;;
    *) valid=0 ;;
  esac
  case "$PINGCRON_URL" in *[[:space:]]*) valid=0 ;; esac
  if [ "$valid" = 1 ]; then
    status=$(curl --disable --proto '=https' --connect-timeout 3 --max-time 10 \
      --silent --output /dev/null --write-out '%{http_code}' \
      --request POST --url "$PINGCRON_URL" 2>/dev/null) || status=000
    case "$status" in
      2[0-9][0-9]) ;;
      *) printf '%s\n' 'Backup uploaded; heartbeat delivery failed. Check monitoring separately.' >&2 ;;
    esac
  else
    printf '%s\n' 'Backup uploaded; invalid heartbeat configuration. Check monitoring separately.' >&2
  fi
fi
exit 0

Use the scheduler's failure logs for dump and upload errors. Check a heartbeat warning separately from backup success. Do not automatically retry the entire backup because monitoring delivery failed.

Validation, October 30, 2026: this script was run with PostgreSQL 17.11 on disposable synthetic data, restored into an empty isolated database, and checked against two expected records. The transfer used a local filesystem adapter, not real AWS S3. Heartbeat failure boundaries used command adapters, not live monitoring delivery.

Verify a restore into an empty isolated database

  1. Use a separate disposable PostgreSQL instance with no production access. Create a new empty isolated database there and confirm the host, port and database name before proceeding. Set RESTORE_DB to that isolated database's connection string. Never reuse your source connection.
  2. Download only your own trusted archive: restoring a dump can execute code supplied by its source. Set BACKUP_OBJECT to the exact uploaded object's full S3 URI. Use a new private temporary directory for ARCHIVE so a stale local file cannot substitute for a failed download. A successful upload alone does not establish that the retained object can be fetched and restored.
set -eu
umask 077
: "${BACKUP_OBJECT:?Set the exact trusted S3 object URI}"
: "${RESTORE_DB:?Set the empty isolated destination connection}"
RESTORE_DIR=$(mktemp -d)
ARCHIVE="$RESTORE_DIR/backup.dump"
aws s3 cp "$BACKUP_OBJECT" "$ARCHIVE" --only-show-errors &&
  pg_restore --exit-on-error --no-owner --no-privileges --dbname="$RESTORE_DB" "$ARCHIVE"

Run this block in a fresh shell configured for the isolated destination. Proceed only if both commands exit zero. Then run a meaningful application-level assertion against the restored database: check a known business record and its related rows, expected counts or totals, and an application read path. Use a read-only account for assertions. Record the object key, PostgreSQL versions, restore result and assertion result. Listing archive contents with pg_restore --list does not execute a restore. After the drill, remove only the temporary directory and isolated resources you created.

This example covers one logical database. It does not include cluster roles, tablespaces, point-in-time recovery (PITR), or prove comprehensive recovery readiness. The no-owner and no-privileges options suit this isolated drill; separately verify the ownership, grants, extensions and secrets your application requires. Run drills on your recovery schedule and after material schema or backup changes.

References: pg_dump, pg_restore, libpq settings, and AWS CLI S3 cp.

Before relying on alerts

  1. Review the monitor’s schedule, timezone, and grace period against the deployed job.
  2. Save your alert destination in Settings, send a labeled test, and confirm that you received it. Set up and verify an alert destination.
  3. Run the actual workload through its scheduler and confirm its first successful heartbeat in PingCron. Copying the URL does not install monitoring.

A successful receipt records what the job reported; it does not prove the output is correct. Detection and delivery timing depend on the schedule, grace period, and alert provider.

Start with one backup. Add coverage when you need it.

Free includes 5 monitors, 7-day receipt history, and email, Slack, and Discord alerts. No credit card is required.

Pro is $9.99/month for up to 50 monitors, 30-day receipt history, and custom webhooks for one account owner. Upgrade when you need more than five monitors, longer retained history, or webhooks. Shared account access starts on Team.

Use a separate monitor for each independently scheduled backup. More monitors do not verify archive contents or replace a restore drill.

Read the official PostgreSQL backup documentation

Backup jobs to monitor.

Any scheduled backup that needs to keep running.

PostgreSQL backups

Nightly pg_dump or pg_basebackup jobs.

MySQL backups

Daily mysqldump or Percona xtrabackup runs.

MongoDB backups

mongodump exports to disk or cloud.

SQLite backups

Sqlite3 .backup or file copies.

S3 upload jobs

Sync local backups to S3 or other object storage.

Offsite backup syncs

rclone, rsync, restic to remote destinations.

Daily snapshots

LVM snapshots, ZFS snapshots, EBS snapshots.

Client backup scripts

Per-tenant or per-customer backup workflows.

How it works

Review the backup, install monitoring, and verify completion.

01

Review the expectation

Match the deployed schedule and timezone, then choose grace for legitimate runtime and delay.

02

Create and install the monitor

Keep its actual heartbeat URL private and send success only after the required work finishes.

03

Verify the setup

Confirm the first successful heartbeat and receipt of an alert-destination test.

Alerts where you'll actually see them.

Save alert destinations for the owning account. Email, Slack, and Discord are included on every plan; custom webhooks require Pro or above.

Email

HTML alerts with monitor details and direct links.

Slack

Post to any Slack channel via incoming webhook.

Discord

Native Discord webhook integration.

Custom webhooks

POST alerts to any endpoint with full payload.

FAQ

Backup monitoring checks whether recurring backup work completes and whether the evidence you need for recovery is present. PingCron covers scheduled check-ins: your script reports success after its required steps, and a missing check-in triggers the configured missed-run alert.
Send it after every step required for that backup to count as complete. If recovery depends on an offsite copy, wait for the upload to succeed. Make the script exit nonzero on a failed dump or transfer, and keep the heartbeat URL in your secret configuration.
No. It records that your script reported success. Verify archive integrity, retention, access to decryption keys, and restoration into an isolated destination separately. Check the restored data and application behavior before relying on the recovery process.
Yes. A job that can make an HTTP request can send a check-in. Use your database’s supported backup method and preserve each required command’s exit status. PingCron does not create, store, or inspect the backup.
Match the expected interval to the deployed schedule and allow grace for normal runtime and scheduler delay. Investigate repeated delays before increasing grace; a wider window also postpones detection of a missing run.
PingCron Free includes 5 monitors, email, Slack and Discord alerts, and 7 days of history. Pro is $9.99/month for 50 monitors, 30-day history, and custom webhooks. Team is $29/month for 200 monitors, 90-day history, and up to 10 team members. Start with one verified backup job before choosing a larger plan.

Related monitoring guides

Verify one backup job before adding the rest.

Start free, confirm its first successful check-in and alert destination, then add the jobs your recovery process depends on.

Monitor one backup free

5 monitors free · Email, Slack, and Discord · No credit card