PagerDuty

Mirror PagerDuty incidents as Wardn incidents, map services to deployments, let "Platform on-call" mean whoever PagerDuty has on call right now, and what happens when PagerDuty is down.

Connect PagerDuty and three things happen.

  1. Its incidents appear as incidents in Wardn, with the severity, the person running them and the deployments they affect.
  2. An on-call group in Wardn (such as Platform on-call) is filled by a PagerDuty schedule: its members are whoever PagerDuty has on call now, so a role bound to that group, such as the right to bypass a guardrail, goes to the person on call and changes hands at each handover.
  3. Rules that count incidents ("no open incident on this deployment") count the incidents PagerDuty has told Wardn about.

Wardn reads PagerDuty. It never acknowledges, resolves, reassigns or pages. The one thing it writes is a note on a PagerDuty incident, and only when a person asks it to share a finished agent job's summary (POST /incidents/{id}/pagerduty-notes), as that person, matched by email; the key must be allowed to add notes.

When Wardn cannot tell what PagerDuty says, because PagerDuty is down, slow, refusing Wardn's key or has not been read lately, the answer is unknown. A rule that counts incidents waits instead of passing on a count that may be missing the incident that matters, and an on-call group is emptied: it never keeps the person who was on call last. A failure is never a match.

Connect it

You need integration:manage (Owners and Admins) and a server with WARDN_SECRET_MASTER_KEY set, because Wardn keeps the API key in its secret store. Create a read-only REST API key in PagerDuty (Integrations, API Access Keys), then:

curl -fsS -X PUT "$WARDN_API_URL/api/v1/pagerduty" \
  -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
  -d '{"token":"…"}'
# EU service region: add "baseUrl":"https://api.eu.pagerduty.com"

Wardn checks the key against PagerDuty before it keeps anything. The first connection returns webhookPath and, once, a webhookSecret. The address must be https:// and cannot be a private, loopback or link-local address.

Webhooks and the periodic read

Wardn reads the account every minute: the incidents that are open and those that changed since the last read, and who is on call on each mapped schedule. A webhook makes it faster.

In PagerDuty add a v3 webhook subscription (Integrations, Generic Webhooks) for incident events, deliver it to https://<your-wardn>/api/v1/webhooks/pagerduty/<id> (the webhookPath) and give it the webhookSecret as its signing secret. Each delivery is checked against its X-PagerDuty-Signature header, an HMAC-SHA256 of the body (v1=…, several separated by commas while a secret is rotated).

A delivery is a prompt, not a statement. It names an incident and Wardn reads that incident from PagerDuty itself, so a forged, replayed or reordered delivery can cost one read and cannot change what Wardn believes.

DeliveryAnswer
Not signed with the secret, an unknown connection, a body over 1 MiBThe same 401 for all of them
One seen in the last ten minutes200, ignored (replay)
An event more than five minutes old, or one that is not about an incident200, ignored (stale, event); the next read catches up
PagerDuty is paused on the Integrations page200, ignored (paused)
PagerDuty cannot be read right now503, so PagerDuty sends it again; the retry is not taken for a replay
Two deliveries racing for one incidentOne incident; an older report never overwrites a newer one

Which deployments an incident affects

Map each PagerDuty service to the deployments it runs:

curl -fsS -X PUT "$WARDN_API_URL/api/v1/pagerduty/services" \
  -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
  -d '{"links":[{"serviceId":"PABC123","serviceName":"Checkout","deploymentIds":["…"]}]}'

An incident on a mapped service is linked to those deployments, with the snapshot each was running when it was linked and since when, so you can see what changed. Remapping a service moves its incidents the next time they are read.

Severity comes from the incident's priority: P1 or SEV-1 is Sev 1, up to P5 as Sev 4. With no priority, a high urgency is Sev 2 and anything else Sev 3. Status: triggered and acknowledged are open, resolved is resolved. Only a person in Wardn marks an incident mitigated, and the mirror never undoes what a person did here: an incident you mitigated stays mitigated while PagerDuty says it is open, and one you resolved stays resolved. The commander is the person it is assigned to, matched to a member by verified email.

On call

Create an on-call group (the web app has no screen for creating groups yet, so use the API; it needs team:manage), bind the roles you want the person on call to hold to it (Roles and grants), then map the PagerDuty schedule to the group:

curl -fsS -X POST "$WARDN_API_URL/api/v1/groups" \
  -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
  -d '{"name":"Platform on-call","kind":"onCall"}'   # the answer carries the group's id

curl -fsS -X PUT "$WARDN_API_URL/api/v1/pagerduty/schedules" \
  -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
  -d '{"links":[{"scheduleId":"PSCHED1","scheduleName":"Platform","groupId":"…"}]}'

Whoever PagerDuty says is on call now becomes the group's only members, matched by email to a member of the organization whose address is verified. An address nobody has verified here, or a person who is not a member, matches nobody. A group is filled by one schedule.

What is believed, and for how long:

  • A read of a schedule is believed for five minutes, and only until the end of the shift it read. Wardn applies what it read to the groups every 15 seconds without calling PagerDuty, so when a shift ends the group empties within seconds, even if the next read has not happened yet. At the handover nobody is believed on call until the schedule has been read again, which is at most a minute later; it is never the person whose shift just ended.
  • When PagerDuty cannot be read, every mapped schedule is unknown and its group is empty. When it can be read again, the group fills.
  • The policy engine's oncall.requester_on_call fact is whether the requester is on call for any mapped schedule. It is unknown, not false, while any schedule is unknown.

When PagerDuty is down

Each read waits at most ten seconds, calls wait their turn when many arrive together, and five failures in a row open a breaker: for 30 seconds nothing is sent. The Integrations list shows PagerDuty as degraded, GET /api/v1/pagerduty says stale with the error, and the mirrored incidents stay as they were, visible but not believed to be complete: incident.open_count and incident.recent_count are unknown until a read works, so a pipeline stage that requires no open incident waits. POST /api/v1/pagerduty/sync reads it now.

Pause PagerDuty on the Integrations page (Integration health) and Wardn stops asking it and ignores its webhooks. It is treated like a down PagerDuty: incident facts are unknown and the groups it fills are emptied, so use it only on purpose. Test connection makes one real call and says how long it took; Disconnect (or DELETE /api/v1/pagerduty) removes the key, the webhook address and what was mapped. Incidents already mirrored stay, and the groups it filled are emptied.

On this page