Skip to content
Statance

Heartbeats

Monitor cron jobs, backups and scheduled tasks with heartbeat ping URLs.

A heartbeat monitor expects to be pinged. If a ping doesn’t arrive within interval_sec plus config.grace_sec, the monitor goes down.

Create one

curl -X POST https://api.statance.com/v1/monitors \
  -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Nightly backup","type":"heartbeat","interval_sec":86400,
       "config":{"grace_sec":1800}}'

The response’s target is the token. Your ping URL is https://api.statance.com/hb/<token>.

Ping it

# Ping only on success
0 3 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 https://api.statance.com/hb/TOKEN

# Report failure immediately
/usr/local/bin/backup.sh || curl -fsS -m 10 https://api.statance.com/hb/TOKEN/fail

GET, POST and HEAD are all accepted. A successful ping after a failure resolves the incident.

Other schedulers

  • systemd timers: add ExecStartPost=/usr/bin/curl -fsS -m 10 https://api.statance.com/hb/TOKEN
  • Kubernetes CronJobs: append && wget -qO- https://api.statance.com/hb/TOKEN to the container command
  • GitHub Actions: add a final step that curls the URL
  • Windows Task Scheduler: Invoke-WebRequest https://api.statance.com/hb/TOKEN

Next: Status pages →