Skip to content

Set up a heartbeat

Goal: a scheduled job pings DownBad each time it runs, and DownBad alerts you when it stops, runs late, or fails.

You need a DownBad account and a job that can make an HTTP request when it finishes. Every example below uses curl, apart from WP-Cron, which uses WordPress’s own request function.

  1. Add the heartbeat. In DownBad, press Add, then choose Heartbeat under Add Monitor.

  2. Name it and set its schedule. Give it a name you’ll recognize in an alert, such as Nightly database backup. Under Schedule:

    • Every…: pick how often the job runs under Expect a ping every, or choose Custom and enter the minutes.
    • Cron (paid plans): enter the same cron expression your job runs on, and the time zone it runs in.

    On the Free plan there is no choice to make: pick how often the job runs under Expect a ping every.

  3. Set the grace period. This is how long DownBad waits past the due time before it alerts. Make it longer than the job’s longest normal run. A backup that usually takes 10 minutes but sometimes 25 wants at least 30.

  4. Press Create monitor. The new heartbeat shows Waiting for first ping. It can’t alert until the first ping arrives.

  5. Copy the ping URL. Open the heartbeat. Under Ping URL, press the copy button. It looks like https://ping.downbad.app/ followed by a long random token. Keep it private: anyone who has it can ping this heartbeat.

  6. Add the ping to your job. Under Set it up, pick where your job runs. DownBad shows a snippet with your ping URL already filled in. Copy it and add it to the job, as the sections below explain for each scheduler.

  7. Run the job once by hand, or wait for its next run.

Within 30 seconds of the ping, the heartbeat’s page shows Up, with the time of the last ping and when the next one is due. From then on:

  • When a ping is overdue, the heartbeat shows Late. Nothing alerts yet.
  • When the grace period runs out with no ping, it shows Down, and DownBad opens an incident and alerts you.
  • When the job calls /fail, it shows Down and alerts at once.
  • The next successful ping turns it Up and closes the incident.

While a heartbeat is paused, DownBad keeps its pings but doesn’t act on them, so nothing alerts.

Each snippet sends the plain ping URL when the job succeeds and /fail when it fails. In DownBad the snippet has your own URL in place of https://ping.downbad.app/your-token. The curl options make each ping give up after 10 seconds, retry 3 times, and print nothing unless it fails, so a slow network can’t hold up your job.

Wrap the command your crontab runs. The ping goes after the job, so it reports how the job ended.

Terminal window
if /path/to/your-job; then curl -fsS -m 10 --retry 3 -o /dev/null https://ping.downbad.app/your-token; else curl -fsS -m 10 --retry 3 -o /dev/null https://ping.downbad.app/your-token/fail; fi

In a crontab, put the whole line after the schedule, or move it into a script and run that.

On a paid plan, tick Also send /start when the run begins under the snippet, and DownBad adds a ping to <ping URL>/start before the job. DownBad keeps it with the heartbeat’s pings, so you can see when each run began as well as when it ended. It doesn’t change when DownBad alerts: a run that hangs never sends its finishing ping, so the heartbeat goes Late and then Down either way. On the Free plan the option is marked Paid, and a /start ping is refused.

Every heartbeat counts as one monitor toward your plan’s monitor limit, and the Free plan allows one heartbeat. When either limit is reached, DownBad says so instead of creating the heartbeat. Delete a monitor or heartbeat you no longer need, or upgrade under Account, in the Plan section.

Cron schedules and their time zones are part of the paid plans. On the Free plan, Schedule shows Cron as Paid, and the heartbeat expects a ping at a fixed interval instead: a job that runs at 02:30 each night is 24h under Expect a ping every, with a grace period that covers how late it can start. If you move to the Free plan with a cron heartbeat already set up, it keeps its schedule but you can’t change it; press Switch to an interval schedule to edit it again.

If the heartbeat still shows Waiting for first ping after the job ran, the ping didn’t reach DownBad. Follow A ping didn’t arrive.