Opsgenie Alerts for Cron Jobs
Fire Opsgenie alerts on cron failures with full incident lifecycle: severity, owner team routing, tag-based filtering, and auto-close on recovery.
1. Create the API integration
- In Opsgenie, go to Settings → Integrations → Add Integration.
- Search for and select API. Name it "crond.io".
- Optionally assign a default Responder Team — every alert from this integration will route to them unless overridden per-alert.
- Click Save Integration. Copy the resulting API Key (a UUID).
2. Wire it up in crond.io
Note the GenieKey auth scheme — Opsgenie expects this exact prefix on the Authorization header. For EU customers, swap the URL host to api.eu.opsgenie.com.
Severity, tags, and responders
The opsgenie payload template maps crond.io monitor state to Opsgenie priority:
| Monitor state | Opsgenie priority |
|---|---|
| down | P1 |
| late | P3 |
Override per-monitor with the alert config:
Tags drive filtering in Opsgenie's alert list and feed into routing rules. We recommend at minimum a service tag (cron) and an environment tag (production).
Auto-close on recovery
When the monitored job recovers, crond.io sends a close request to Opsgenie with the same alias (derived from the monitor ID). The alert closes automatically. No manual ack needed for transient failures that self-recover.
Troubleshooting
- 202 response but no alert in Opsgenie:Opsgenie accepts async — check the integration's log tab in Opsgenie for the processing result.
- 401 Unauthorized: wrong API key, or you copied the team API key instead of the integration API key. Re-check under Settings → Integrations → API.
- Alerts not auto-closing: verify the alias matches between the trigger and close requests. If you renamed the monitor, the alias changed too.