CLI heartbeat examples
Ping an ilert heartbeat monitor from a shell, a backup script, or a cron job, so that only a successful run counts as a sign of life.
A ping is a single HTTP request, so every example here is one line of curl. What varies is when you send it.
All of them need the monitor's integration URL: open Alerting → Heartbeat monitors, click the monitor's row, and copy Integration URL. Replace YOUR_INTEGRATION_KEY below with the key from that URL.
Ping once
curl -fsS https://beat.ilert.com/api/pings/YOUR_INTEGRATION_KEY-f makes curl exit non-zero on an HTTP error instead of printing the error body and reporting success, and -sS keeps it quiet while still showing real failures. Without -f, a mistyped key looks exactly like a working one.
Ping only when the job succeeded
This is the useful shape. && runs the ping only if the script exited 0, so a backup that fails silently stops the heartbeat and pages someone:
run_backup.sh && curl -fsS https://beat.ilert.com/api/pings/YOUR_INTEGRATION_KEYPutting the ping on its own line instead would report success for a job that failed — which is worse than no monitoring, because now the silence is guaranteed never to arrive.
Report the outcome with the ping
Add a message query parameter and the text appears as Last message in the monitor's details:
run_backup.sh && curl -fsS "https://beat.ilert.com/api/pings/YOUR_INTEGRATION_KEY?message=backup+ok"Quote the URL. Unquoted, zsh treats the ? as a glob and refuses to run the command at all (no matches found), while bash lets a ? through but splits the line at an &, backgrounding the first half and dropping every parameter after it.
From cron
Cron runs with a minimal PATH and no shell profile, so use an absolute path to curl. Keep the key out of the crontab itself — a crontab is world-readable on many systems — by sourcing it from a file only the job's owner can read:
Set the monitor's interval to comfortably more than the schedule — for a nightly job, 25 hours rather than 24 — or a run that starts a few minutes late raises an alert on its own.
Verify it worked
After the first ping, the monitor's status turns from Waiting for first ping to Healthy, and Last ping received shows the time it arrived. If it does not, run the ping without -s and read the response:
A 400 with Provided key is not a valid ilert large scale heartbeat key means the key never reached the URL intact — usually shell expansion, a truncated copy, or the key of a legacy heartbeat alert source, which pings a different address.
Last updated
Was this helpful?