DOCS

First heartbeat

Monitor your cron jobs and background workers with a heartbeat check.

What is a heartbeat?

A heartbeat monitor is the inverse of an HTTP monitor. Instead of the platform calling your service, your service calls the platform. At the end of each scheduled job, your script sends an HTTP ping to a unique heartbeat URL. If no ping arrives within the expected window, an incident is triggered.

DAILY BACKUP JOB
UP
Next check in 4h 51m

Use heartbeats for:

  • Cron jobs (backups, report generation, data sync)
  • Background workers (queue consumers, scheduled tasks)
  • Any process that should run on a schedule

Create a heartbeat

  1. In the sidebar, click Heartbeats.
  2. Click + New Heartbeat.
  3. Fill in the fields:
FieldExampleNotes
NameDaily DB backupHuman-readable label
Expected interval24hHow often the job runs
Grace period10mExtra time before alerting
  1. Click Save.
  2. Copy the generated ping URL — you will add it to your script.

Send the ping from your script

At the end of your job (after successful completion), send an HTTP POST to the ping URL:

# Basic curl ping
curl -sS -X POST https://api.example.com/api/v1/hb/YOUR_HEARTBEAT_ID

Only ping when the job completes successfully. If the job errors, skip the ping — the platform will alert you automatically when the grace period expires.


Integration examples

Crontab

# Add || true so cron itself does not fail if the ping fails
*/60 * * * * /path/to/backup.sh && curl -sS -X POST https://api.example.com/api/v1/hb/YOUR_HEARTBEAT_ID || true

systemd timer

[Service]
ExecStart=/path/to/worker.sh
ExecStartPost=curl -sS -X POST https://api.example.com/api/v1/hb/YOUR_HEARTBEAT_ID

Node.js

// At the end of your scheduled job
await fetch('https://api.example.com/api/v1/hb/YOUR_HEARTBEAT_ID', { method: 'POST' })
  .catch(() => console.warn('Heartbeat ping failed'));

Python

import requests

def run_job():
    # ... your job logic ...
    requests.post('https://api.example.com/api/v1/hb/YOUR_HEARTBEAT_ID', timeout=5)

if __name__ == '__main__':
    run_job()

Grace period

The grace period is extra time beyond the expected interval before the platform considers the job late.

Example: interval = 5 minutes, grace period = 2 minutes. The platform triggers an incident at T+7 min if no ping is received. Use a grace period when your job has variable runtime.


Heartbeat statuses

StatusMeaning
UpLast ping received within interval + grace period
LateInterval exceeded but within grace period
DownGrace period exceeded — incident opened, alert sent
NewNo pings received yet since creation

What's next

Was this page helpful?