Skip to content

Heartbeat Checks

Heartbeat monitors work in reverse compared to other monitor types. Instead of YipYap reaching out to your service, your service sends a ping to YipYap on a schedule. If the ping does not arrive within the grace period, the monitor fires an alert.

FieldDescriptionDefault
Grace Period (grace_period_seconds)The longest YipYap waits after the last ping before it marks the monitor Down. Set it longer than the time between your job’s runs.300 seconds
Interval (interval_seconds)How often YipYap checks whether the grace period has run out. A shorter interval reports a missed ping sooner.60 seconds

When you create a heartbeat monitor, YipYap generates a ping URL that carries a secret token:

https://console.yipyap.run/api/v1/heartbeat/<monitor-id>?token=<heartbeat-token>

On a self-hosted install the URL starts with your own YipYap address instead of https://console.yipyap.run. The detail page builds it from the address you opened the console on.

Copy the full URL from the Ping URL card on the monitor’s detail page (open Monitors and select the monitor). The card has a Copy button, and cURL and cron examples under Usage examples. For scheduled jobs, use the -fsS --retry 3 flags from Integration Example instead: they retry a failed ping and make the job report it rather than hide it. If you call the API instead, GET /api/v1/monitors/<monitor-id> returns the token in the heartbeat_token field.

Your service sends an HTTP POST to this URL each time it completes a run. A request without the correct token gets 401 invalid heartbeat token, and the ping is not recorded.

  1. Your service sends a POST to the ping URL after each successful execution.
  2. YipYap records the time of each ping.
  3. If no ping arrives within the grace period after the last one, the monitor transitions to Down and fires an alert. A new monitor that has never received a ping is also Down, so send one ping by hand right after you create it.
  4. When the next ping arrives, the monitor recovers automatically.
  • Monitoring cron jobs (e.g. database backups, report generation).
  • Verifying that a queue worker is processing jobs on schedule.
  • Checking that a periodic data sync is completing successfully.

Add a curl call at the end of your cron script. Quote the URL: the ? in it is a glob character in most shells.

#!/bin/bash
set -euo pipefail
# Run the backup. With set -e the script stops here if it fails,
# so YipYap only hears from a successful run.
pg_dump mydb > /backups/mydb.sql
# Signal success to YipYap. YIPYAP_HEARTBEAT_URL holds the full ping URL,
# token included, and is set outside this script.
curl -fsS --retry 3 -X POST "$YIPYAP_HEARTBEAT_URL"

The same ping as a crontab entry, with the URL written out:

*/15 * * * * /usr/local/bin/backup.sh && curl -fsS --retry 3 -X POST "https://console.yipyap.run/api/v1/heartbeat/<monitor-id>?token=<heartbeat-token>"

-f makes curl exit non-zero on an HTTP error such as 401, -sS hides the progress bar but still prints errors, and --retry 3 retries transient failures.

The ping endpoint allows 60 requests per minute from each source IP address. If many jobs ping from one host or NAT gateway, keep their combined rate under that limit.

  • Set the grace period longer than the time between runs plus the job’s typical duration. A job that runs every 15 minutes and takes up to 5 needs a grace period of more than 20 minutes (1200 seconds) to avoid false alerts.
  • If your job can fail silently, only send the ping after verifying the job succeeded.
  • For jobs that run infrequently (e.g. once per day), set the grace period to cover the full schedule, for example 25 hours (90000 seconds) for a daily job.