Blog

Heartbeat Monitoring Explained: Catching the Cron Jobs That Die in Silence

· HTTP monitors can't see inside your cron jobs. Heartbeat monitoring catches silent failures in background tasks, backups, and scheduled scripts before they become disasters.

Your website is up. The HTTP monitor checks it every minute and reports green. You're sleeping soundly.

But somewhere on your server, a nightly backup script has been silently failing for three weeks. The database hasn't been backed up. If something goes wrong tonight, you won't know until you need that backup — and it's not there.

This is the gap that heartbeat monitoring fills.

What Heartbeat Monitoring Actually Is

An HTTP monitor checks from outside — it sends a request to your URL and verifies the response. It can only detect problems that manifest as an HTTP failure.

A heartbeat monitor works the other way around: your system sends a ping to the monitor on a regular schedule. If the ping stops coming, the monitor fires an alert.

This flips the failure detection model entirely. Instead of checking if your website responds, you're checking whether your background processes are running.

What Fails Silently Without Heartbeat Monitoring

Cron jobs: The most common use case. A cron job runs once a night. If it fails — due to a permission error, out-of-memory crash, or a syntax error after a deployment — nothing in your HTTP monitoring will catch it.

Database backups: Your backup script might finish with an error code, log a stack trace nobody reads, and leave your backup directory empty. Without a heartbeat, you find out when you need a restore.

Scheduled email sends: Marketing newsletters, invoice generation, payment reminder emails — all of these are typically cron-driven. A silent cron failure means customers stop receiving communications with no external indication.

Data sync jobs: APIs that sync orders, inventory, customer data, or analytics. A sync that stopped running two weeks ago means your dashboard is showing stale data — and every decision made from it is wrong.

Watchdog processes: Services that are supposed to restart crashed processes. If the watchdog itself dies, nothing restarts anything.

How to Set Up a Heartbeat Monitor

In ndelog, go to + New Monitor → Heartbeat Monitor. Give it a name (e.g. "Nightly DB Backup") and set an expected ping interval — how often your script should check in.

ndelog gives you a unique URL like:

https://app.ndelog.com/heartbeat/abc123xyz

At the end of your script or cron job, add a curl to that URL:

# Nightly backup cron
0 2 * * * /usr/local/bin/backup.sh && curl -s https://app.ndelog.com/heartbeat/abc123xyz

The && is important: the curl only runs if backup.sh exits with a success code. If the backup fails, the ping doesn't happen, and ndelog fires your WhatsApp alert within the configured grace period.

For a Python script:

import requests
import subprocess

result = subprocess.run(['/usr/local/bin/backup.sh'])
if result.returncode == 0:
    requests.get('https://app.ndelog.com/heartbeat/abc123xyz')
# If returncode != 0, no ping is sent → ndelog alerts you

Setting the Right Grace Period

The grace period is how long ndelog waits after an expected ping before firing an alert. Set it to slightly longer than your normal job runtime.

Example: Your backup script usually takes 8–12 minutes. Set the grace period to 20 minutes. If no ping arrives within 20 minutes of the expected schedule, you get alerted.

Don't set it too tight — jobs that occasionally run slow will create false alarms.

The Free Plan Includes One Heartbeat

ndelog's Spark (free) plan includes 1 heartbeat monitor. Watchman adds 3. Warden gives you 10, which is enough to cover all critical background jobs for most solo developers and small teams.

If you manage 10+ client sites each with their own backup jobs, Warden's 10 heartbeats and Pamong's 50 become relevant quickly.

The Most Common Heartbeat Setup: Backup Verification

For freelancers managing client WordPress or Laravel sites on shared hosting or a VPS, the absolute minimum heartbeat setup is:

  1. Nightly database backup — ping on success
  2. Weekly full file backup — ping on success

If you ever need those backups and they're not there, no amount of uptime monitoring elsewhere will save you. A WhatsApp alert when a backup script silently dies is worth its weight in restored databases.

→ Add heartbeat monitoring to your stack — free on Spark plan