Heartbeat Monitors
Cron job and backup monitoring
A job that stops running makes no noise. There is no error and no email, only a backup that is not there on the day you need it. Give the job a heartbeat: one line at the end of the job calls You Up? each time it succeeds. When a call does not come in time, you get an alert.
Questions before then: support@uup.dev
How it works
-
Create a Heartbeat Monitor. Name it, say how often the job runs, and how late it may be.
-
Call its address when the job succeeds. Put the call after
&&, so it runs only when the job worked:0 3 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 https://api.uup.dev/hb/your-token -
We wait. When no call comes by the time it is due, and its Grace after that, the Monitor is down, and the alert says the job has not checked in.
The job’s next call ends the Incident. One call is enough, because only your job can make it.
Late is not the same as failed
A job never runs to the second. It starts a little late, or takes longer on a busy night. The Grace is how late a call may be before we tell you, so a slow backup does not wake you. Left empty, it is a tenth of how often the job runs.
For a job that does not run on a fixed period, such as weekdays at 09:00 or the first of each month, give the Monitor the job’s cron schedule instead.
Anything that can call an address
Cron, systemd timers, Kubernetes CronJobs, GitHub Actions or a script on a backup server: if it can call an address when it finishes, it can check in. The Docs have a line to copy for each of them, and for Node, Python, Go, Ruby and PHP.
Heartbeat examples for crontab, systemd, GitHub Actions and moreQuestions
What if the job runs but fails?
Call the address only when the job succeeded, for example after &&. A run that failed then looks like a missing call, and you are alerted.
How many heartbeats do I get?
5 on Free, 10 on Small, 50 on Medium, 150 on Large and 500 on Extra Large.
Someone saw the address. Can I change it?
Yes. Rotate it on the Monitor’s Checks card. The old address stops working at once, so put the new one in your job before its next call is due.
What if You Up? cannot take the call?
Your job’s call tries again a few times, so a short break on our side does not fail it. We never count a call against your job when we could not take it: a job that kept running does not alert because of our outage.
Can I create the Monitor before the job runs?
Yes. A new Heartbeat Monitor waits for its first call, and nothing can be late until then.
How Heartbeat Monitors work, in the Docs