What is heartbeat monitoring
Heartbeat monitoring turns the usual uptime check around: your job or worker calls a monitor URL every time it finishes a unit of work, and the monitor alerts you when those calls stop arriving.
An HTTP uptime check asks your server a question every few minutes. That works for anything with a URL. A queue worker, a backup script, a data sync or a cron job has no URL to ask. It runs in the background, and when it dies it dies quietly: no 500, no error page, often no log line, just work that stops getting done. Heartbeat monitoring exists for that silence.
How a heartbeat check works
- The monitor gives you a unique URL. In Logdash it is a POST to api.logdash.io/ping/ followed by the monitor id, public, with no auth header and no body.
- Your process calls that URL each time it completes a pass of real work.
- The monitor keeps a window. A call inside the window means alive. An empty window means down, and the alert fires on that change.
- When the calls come back, the monitor flips to up and tells you that too.
One design rule matters more than the tool: ping after the work, not on a timer beside it. A background thread that pings every 10 seconds while the main loop is stuck on a dead database connection reports healthy for the whole outage. A ping that only happens when a pass completes cannot lie that way.
Heartbeat monitoring software in practice
Logdash push monitors use a 15-second window on the Pro plan. That makes them a fit for things that run all the time: queue consumers, pollers, sync loops, websocket servers. This is the whole integration for a worker written as a shell loop:
#!/usr/bin/env bash
# worker.sh - one pass of real work, then one heartbeat, forever.
set -euo pipefail
PING_URL="https://api.logdash.io/ping/${LOGDASH_MONITOR_ID}"
while true; do
/srv/app/bin/process-queue # a failed pass ends the loop, so the pings stop
curl -fsS -m 5 -X POST "$PING_URL" > /dev/null || true
sleep 5 # one pass plus the sleep must fit in 15 seconds
doneIf process-queue exits non-zero, set -e ends the loop, the pings stop, and the next empty window marks the monitor down. If it hangs, same result. The || true on curl means a network blip on the ping itself never kills the worker. The endpoint allows 300 calls a minute per IP, so a ping every few seconds is nowhere near the limit.
Heartbeat monitoring for cron
A cron job is the textbook heartbeat case: append a curl to the crontab line with && so only a successful run reports in. The catch is the window. An hourly job needs a monitor that knows "hourly" and adds a grace period. Logdash does not. It expects a call in every 15-second window, so an hourly job would read as down for 59 minutes of every hour and alert you twice an hour. The cron monitoring explainer shows the HTTP check that works instead.
Heartbeat check vs uptime check
Most apps need both. An uptime check asks from outside whether the front door opens. A heartbeat asks from inside whether the work gets done. Your API can return 200 all week while the worker that sends receipts has been dead since Tuesday.
Logdash push monitors vs Cronitor heartbeats
| Feature | Logdash | Cronitor |
|---|---|---|
| Expected interval | Fixed 15-second window | A schedule you set, such as every 5 minutes, plus grace seconds |
| Plan | Pro only | 5 monitors on the free plan |
| A run that fails | Reported when the next window comes up empty | Reported at once with a ?state=fail ping |
| Free alert channels | Telegram and webhook | Email and Slack |
When Cronitor is the better pick
- The job runs on a schedule. Cronitor knows it and alerts after the grace period; Logdash would alert between runs.
- You are not on Pro. Cronitor watches 5 jobs for free.
- You want a crashed run reported the moment it crashes, not one window later.
Set one up
- Create a push monitor Push monitors are on the Pro plan. Add a service in Logdash, switch its monitor to push, and copy the id from the ping URL.
- Ping after the work Export LOGDASH_MONITOR_ID, start the worker above, and the monitor goes green within one 15-second window.
- Kill the worker Stop the process. The next window comes up empty, the monitor flips to down, and a Telegram message lands on your phone naming the monitor and saying no call arrived. Start the worker again and a second message says it is back up.