Uptime checks with Healthchecks.io pings
Healthchecks.io alerts you when a ping doesn't arrive on time. Put a ping after a check in a cronservices job: when the check fails, the job stops before the ping, and Healthchecks alerts you by email, SMS, Slack, or any of its integrations.
Example: alert when your API is down
json
{
"name": "API heartbeat",
"cron": { "expression": "* * * * *" },
"nodes": [
{ "id": "health", "request": { "method": "GET", "endpoint": "https://api.acme.com/health" } },
{ "id": "ping", "healthchecks_ping": { "ping_url": "https://hc-ping.com/5f3c9a1e-8b2d-4c6f-9e7a-1d2b3c4d5e6f" } }
]
}Set the check's period to 1 minute and its grace time to a few minutes, so a single slow response doesn't page anyone.
Example: watch a nightly job
Ping only when your backup endpoint confirms the last backup is fresh:
json
{
"name": "Backup freshness",
"cron": { "expression": "0 7 * * *", "time_zone": "Europe/Berlin" },
"nodes": [
{ "id": "fresh", "request": { "method": "GET", "endpoint": "https://backup.example.com/api/fresh?max_age_hours=26", "credential_id": "YOUR_BACKUP_TOKEN_ID" } },
{ "id": "ping", "healthchecks_ping": { "ping_url": "https://hc-ping.com/5f3c9a1e-8b2d-4c6f-9e7a-1d2b3c4d5e6f", "body": "Last backup {{ $.finished_at }}" } }
]
}Set up
Create a check in Healthchecks.io, copy its ping URL into ping_url, and set the period to match the job's schedule. Self-hosted Healthchecks servers work too.
Reference
Ping a Healthchecks check: healthchecks_ping
Sends POST the ping URL, or <ping_url>/fail or /start. Output for the next step: The text OK.
| Field | Type | Notes |
|---|---|---|
ping_url |
string, required | The check’s ping URL, ending in its UUID, on hc-ping.com or your own server. |
signal |
string | Omit to report success. fail reports a failure and start starts a timer. |
body |
string | A log line stored with the ping, up to 10,000 characters. Placeholders allowed. |