Skip to content
BENIBIX Learn

Heartbeat Monitoring

Infrastructure📈 Monitoring & ObservabilityMonitoring Basics

Also known as Dead Man's Switch, Cron Job Monitoring, Heartbeat Check, Check-In Monitoring

An alert that fires when a job stops checking in. It catches silent failures.

Think of it like

Think of it like a friend who calls you if you do not text them each night.

Example

Lucy's backup script pings a heartbeat address after each nightly run. One night the disk is full and the script never starts, and the missing ping wakes her up.

Why it matters

A job that never runs writes no error. Without a heartbeat, a broken backup can stay hidden for months.

Definition

Heartbeat monitoring waits for a job to check in on time, and raises an alert when it goes quiet. The job sends a small ping each time it finishes, such as after a nightly backup. The monitor knows when the next ping is due. If none arrives, something stopped, even though nothing reported an error. It catches the failures that make no noise at all.

Example code

bash
0 2 * * * /usr/local/bin/backup.sh && curl -fsS https://hc.example.com/ping/backup
The ping is sent only if the backup worked. No ping by morning means an alert.
At the bottom right, a nightly job pings the monitor. When the ping does not come, the monitor raises the alarm.

Common mistake

Sending the ping at the start of the job. Then a job that crashes halfway still looks fine, so ping at the end.

Key takeaways

  1. 1
    Expect a ping. Each run checks in when it is done.
  2. 2
    Silence is the alarm. No ping means something stopped.
  3. 3
    For quiet jobs. Backups, timed jobs and queues.

Compare