Skip to main content

Heartbeat Monitoring

Heartbeat monitors work in reverse compared to regular monitors. Instead of Sentro checking your service, your service pings Sentro at expected intervals. If a ping is missed beyond a grace period, Sentro creates an incident and sends alerts.

This is designed for processes that run on their own schedule:

  • Cron jobs -- Nightly backups, hourly reports, data syncs.
  • Background workers -- Queue processors, async job runners.
  • Batch processes -- ETL pipelines, data imports/exports.
  • Scheduled tasks -- Anything that should run at predictable intervals.

How it works​

  1. Create a heartbeat in the dashboard or via the API. You get a unique ping URL.
  2. Add a ping call to the end of your job -- a simple HTTP request to the ping URL.
  3. Sentro watches for pings. If one does not arrive within the expected interval plus the grace period, an incident is created and your alert channels are notified.
  4. When pings resume, the incident is automatically resolved.

Configuration​

SettingDescriptionRange
NameA descriptive name for the heartbeat.1-100 characters
Expected intervalHow often the ping should arrive, in seconds.30s - 86,400s (24h)
Grace periodExtra time before marking the ping as missed, in seconds.0s - 3,600s (1h)

Example: A nightly backup runs at 2 AM. Set the expected interval to 86,400 seconds (24 hours) and the grace period to 300 seconds (5 minutes). If the backup finishes at 2:04 AM, the ping arrives within the grace window and everything is fine. If no ping arrives by 2:05 AM the next night, an incident is created.

Sending pings​

The ping URL looks like:

https://app.sentro.dev/api/heartbeat/{slug}/ping

Any HTTP method works (GET, POST, HEAD). The response is always:

{
"ok": true,
"heartbeat": "Nightly Database Backup",
"receivedAt": "2025-01-15T02:05:12.000Z"
}

From a cron job​

0 2 * * * /usr/local/bin/backup.sh && curl -fsS --retry 3 https://app.sentro.dev/api/heartbeat/nightly-backup-a1b2c3/ping

The && ensures the ping is only sent if the script exits successfully. Use --retry 3 to handle transient network issues.

From a Node.js worker​

const HEARTBEAT_URL = 'https://app.sentro.dev/api/heartbeat/queue-worker-x9y8z7/ping';

async function processQueue() {
while (true) {
const jobs = await queue.drain();
await fetch(HEARTBEAT_URL, { method: 'POST' }).catch(() => {});
await sleep(60_000);
}
}

From a Python script​

import requests

def run_etl_pipeline():
extract_data()
transform_data()
load_data()
requests.get(
"https://app.sentro.dev/api/heartbeat/etl-pipeline-k3m4n5/ping",
timeout=10
)

Heartbeat statuses​

StatusMeaning
HealthyPings are arriving on time.
OverdueThe expected time has passed but the grace period has not expired yet.
DownThe grace period has expired. An incident has been created.
PausedMonitoring is paused. Missed pings are ignored.

Alerting on missed heartbeats​

Create an alert rule with the HEARTBEAT_MISSED trigger type. This fires when a heartbeat transitions from healthy to down. You can route heartbeat alerts to different channels than your monitor alerts -- for example, sending cron job failures to a dedicated Slack channel.

Plan limits​

PlanHeartbeat limit
Free2
Starter10
Pro50
MaxUnlimited