Opsgenie
Open and close Wardn incidents from Opsgenie alerts, say which tags and priorities count, fill on-call groups from Opsgenie schedules, optionally open an alert when Wardn opens an incident, and what happens when Opsgenie is down.
Connect Opsgenie and three things happen.
- An alert that carries a mapped tag opens a Wardn incident in that environment, at the severity its priority says. Closing the alert resolves the incident. Resolving the incident in Wardn does not close the alert.
- An on-call group in Wardn is filled by an Opsgenie schedule: its members are whoever Opsgenie has on call now, matched by verified email, so a role bound to that group (a bypass list, for example) goes to the person on call.
- Optionally, when Wardn opens an incident on its own (a failed wave check, drift in production), it opens an Opsgenie alert for it. An incident that came from Opsgenie never opens an alert, so the two cannot feed each other.
Wardn reads Opsgenie. The one thing it writes is that optional alert.
Only what has been run against Opsgenie's documented API through test fakes is described here. No real Opsgenie account was available when this was built, so the exact shapes of Opsgenie's alert, schedule and webhook replies, and the custom header setup below, are untested against the real service.
Connect it
You need integration:manage (Owners and Admins) and a server with WARDN_SECRET_MASTER_KEY set. Create an API key in Opsgenie with read and configuration access, then:
curl -fsS -X PUT "$WARDN_API_URL/api/v1/opsgenie" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d '{"name":"Acme","region":"us","apiKey":"…","openAlerts":false}'region is us (api.opsgenie.com) or eu (api.eu.opsgenie.com); Wardn only ever calls those two addresses. Wardn checks the key before keeping anything.
Credentials are write-only. The key goes into Wardn's sealed secret store under integrations/opsgenie/<connection>/api-key. The API and the page never show it: they show where it is kept (Wardn · integrations/opsgenie/…/api-key) and whether the secret store has it (Found or Not found). Connect again with a new apiKey to change it; leave apiKey out to keep the one that is there.
The first connection returns webhookPath and, once, a signingToken (whtok_…). Afterwards only its last four characters are shown (whtok_••••3b9e). POST /api/v1/opsgenie/signing-token makes a new one and shows it once; the old one stops working at once.
Set up in Opsgenie
- Add a Webhook integration to the team or API integrations.
- Set its URL to
https://<your-wardn>/api/v1/webhooks/opsgenie/<id>(thewebhookPath) and add a custom headerX-Wardn-Tokenwith the signing token. - Send a test alert.
Webhooks
A delivery is a prompt, not a statement. It names an alert; Wardn reads that alert from Opsgenie itself and acts on what Opsgenie says, so a forged, replayed or reordered delivery can cost a read and cannot change what Wardn believes. The organization is the one the connection belongs to, never one the body names.
| Delivery | Answer |
|---|---|
| Wrong or missing token, an unknown connection, another organization's connection, a body over 1 MiB | The same 401 for all of them; Opsgenie is not asked |
| One seen in the last ten minutes | 200, ignored (replay) |
| An update more than ten minutes old, or an event that names no alert | 200, ignored (stale, event) |
| Opsgenie is paused on the Integrations page | 200, ignored (paused) |
| Opsgenie cannot be read right now | 503, so Opsgenie sends it again; the retry is not taken for a replay |
The token is compared in constant time. The route is public (there is no session), rate limited like the other public routes, and can only make Wardn read Opsgenie.
Which alerts count
curl -fsS -X PUT "$WARDN_API_URL/api/v1/opsgenie/mappings" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d '{"mappings":[{"tag":"env:prod","environment":"prod","minPriority":2}]}'An alert with the tag opens an incident in that environment (affecting its deployments) when its priority is at least minPriority: 2 means P1 and P2. P1 is Sev 1 and P5 is Sev 4. An alert with several mapped tags uses the mapping that lets it through. Each alert is listed on the page with what became of it:
| Result | Meaning |
|---|---|
| Opened incident | A mapped tag at a high enough priority |
| Closed incident | The alert closed and the incident it opened is resolved |
| Ignored, below P2 | A mapped tag, but not serious enough |
| Ignored, no environment tag | No tag of the alert is mapped |
GET /api/v1/integrations/opsgenie/signals lists them newest first, a page at a time.
On-call schedules
PUT /api/v1/opsgenie/schedules maps Opsgenie schedules to on-call groups. Schedules are read every minute. When Opsgenie cannot be read, who is on call is unknown, never "nobody": the group is emptied rather than left holding the last person, and a bypass list that depends on it falls back to the owners (fail closed). A group is filled by one schedule, from Opsgenie or PagerDuty.
When Opsgenie is down
No new incidents open from alerts, and open incidents stay open until someone resolves them in Wardn. Pause, test and disconnect work from the Integrations page. See Integration health.
Webhooks
Send Wardn's release, approval and drift events to your own systems as signed HTTP posts, check the signature, and what happens when the receiver is down.
Datadog
Use Datadog monitors and metric queries as release wave checks, post a Datadog event when a release or sync lands, what happens when Datadog is down, and what has only been tested against a fake.