What is a dead man's switch?

On this page

A dead man's switch acts when a signal stops, not when something goes wrong. A train driver holds a lever down; if the hand lets go, the brakes apply. In monitoring, a job reports on a schedule, and a missing report is the alarm.

How does a dead man's switch work in monitoring?

The job sends a short message every time it runs, usually an HTTPS request to a unique URL. The monitor knows how often to expect it. When a message is late by more than a grace time, the monitor sends an alert. Nothing has to inspect the job, and nothing inside the job has to be alive to complain.

That is the property that matters. A monitor that waits for errors cannot see a job that never started, a server that lost power, a cron daemon that stopped, or a schedule someone deleted. All of those produce silence, and silence is exactly what a dead man's switch watches for.

What goes wrong without one?

  • A backup stops running after a server move and nobody notices until a restore is needed.
  • A scheduled invoice run is skipped when a scheduler is disabled after inactivity.
  • A job starts but hangs on a lock, and no error is ever logged.
  • An alert rule exists, but the error it watches for is never produced because the job is not running.

How does CronMissed implement it?

Each job gets a check with its own ping URL. The check holds an expected schedule, either a fixed period or a cron expression, and a grace time. The job requests the URL when it finishes, and optionally when it starts or fails:

crontab
15 3 * * * /usr/local/bin/backup.sh && curl -fsS --retry 5 https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10

If the ping does not arrive by the scheduled time plus the grace, the check goes down and the alert goes out to every channel assigned to it. When the next ping arrives, a recovery alert follows. Read how heartbeats work for the states in between.

Questions and answers

Is a dead man's switch the same as heartbeat monitoring?
For software they are two names for one idea. "Heartbeat" stresses the regular signal; "dead man's switch" stresses that the alarm fires when the signal stops.
What if the job runs but does the wrong thing?
Ping only after the work succeeds, and report failures with /fail or the exit status. The switch then covers both a job that did not run and a job that ran and failed.
Know the moment a job goes quiet

Create a check, add one curl to the job, and CronMissed alerts you when a ping is late or reports a failure.

Start monitoring