Heartbeat monitors for cron jobs and scheduled tasks

A regular monitor calls your website or API. A heartbeat monitor works the other way round: your cron job, backup or scheduled task calls Odown each time it runs, and Odown alerts you when a call doesn't arrive on time. Use it for anything that runs on a schedule and has no URL to check.

Create a heartbeat monitor

  1. Click New Monitor, then Create a heartbeat monitor under the page title.
  2. Give it a name, for example "Nightly database backup".
  3. Choose Expected every: how often your job runs and calls the ping URL. Options go from every minute to every day (every hour by default).
  4. Choose a Grace time: how late a call may be before you are alerted, from 1 minute to 12 hours (5 minutes by default). Give jobs whose run time varies a longer grace time.
  5. Under Alert channels, choose where to send an alert when a call is missed and when calls start again.
  6. Click Create heartbeat.

Call the ping URL from your job

The monitor's page shows its ping URL. Call it with GET, POST or HEAD each time your job finishes. For example, in a crontab:

0 * * * * /path/to/job.sh && curl -fsS -m 10 --retry 3 <your ping URL> > /dev/null

The && means the ping is only sent when the job succeeds, so a job that fails is reported as well as one that doesn't run. The monitor page shows ready-to-paste examples with your URL and a schedule that matches the heartbeat. For systemd timers, Kubernetes CronJobs and scripts, see our guide to cron job monitoring.

Keep the ping URL private: anyone who has it can report your job as running. It is never shown on status pages or in alerts.

How a heartbeat is checked

Nothing is checked until the first call arrives. The monitor page then shows when the last call came in, when the next one is due, and one of these states:

  • Calls arriving on time: the monitor is up.
  • Late: within the grace time: the call is overdue, but the grace time hasn't run out yet.
  • Missed: no call received in time: no call arrived within the expected interval plus the grace time. The monitor goes down and you get a failure alert. When calls start again, it recovers and you get a recovery alert.

Pausing a heartbeat monitor stops it being checked. Edit a heartbeat from its page to change its interval, grace time or alert channels.