Connect an incident source

Connect PagerDuty so its incidents appear in Wardn on the deployments they affect, "Platform on-call" means whoever is on call right now, and rules that count incidents wait when PagerDuty cannot be read.

The situation

The shop team pages through PagerDuty: a Checkout service for the storefront and a Platform schedule for the people on call. When checkout breaks at night, the question is always the same: what shipped just before? You want a PagerDuty incident to show up in Wardn on web-production, next to the snapshot it was running and the release that put it there. You also want the right to bypass a guardrail to belong to whoever is on call now, and to move at each handover with nobody editing a list.

Wardn connects one incident tool: PagerDuty. Incidents and on-call are mirrored from it; Wardn does not page, acknowledge or resolve anything there (PagerDuty, Incidents).

Other tools

Sentry and Opsgenie are not connected today, so an alert from them cannot become a Wardn incident. If your alerts reach PagerDuty first, they arrive in Wardn as PagerDuty incidents. Without PagerDuty, Wardn still raises its own incidents when a release wave fails or a production deployment drifts.

What you need

PieceSetting
Permissionintegration:manage (Owners and Admins) to connect and map; team:manage to create the on-call group.
The serverWARDN_SECRET_MASTER_KEY set, because Wardn keeps the API key in its secret store.
PagerDutyA read-only REST API key (Integrations, API Access Keys). A key that can also add notes lets people share an agent's summary on an incident later; it is optional.
IdsThe PagerDuty service id (PABC123) and schedule id (PSCHED1), from their URLs in PagerDuty. In Wardn, the ids of the deployments the service runs.

Settings

Connect the account

api() { curl -fsS -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' "$@"; }

api -X PUT "$WARDN_API_URL/api/v1/pagerduty" -d '{"token":"…"}' | jq '{webhookPath, webhookSecret, connectedAt}'
# An EU account adds "baseUrl": "https://api.eu.pagerduty.com"

Wardn checks the key with PagerDuty before it keeps anything; a key PagerDuty refuses is an error and nothing is stored. The first connection also returns a webhookSecret once. Keep it: connecting again keeps the same address and secret, but it is not shown a second time.

Add the webhook

The periodic read already works (every minute). A webhook makes a new incident show up in seconds. In PagerDuty add a v3 webhook subscription for incident events with:

  • the address https://<your-wardn> plus the webhookPath from above (/api/v1/webhooks/pagerduty/<id>), and
  • the webhookSecret as its signing secret.

A webhook only names an incident; Wardn then reads it from PagerDuty itself. A forged or replayed delivery can cost one read and cannot change what Wardn believes.

Map services to deployments

Tell Wardn what each PagerDuty service runs. Find the deployment ids first:

api "$WARDN_API_URL/api/v1/deployments" | jq -r '.items[] | "\(.id)  \(.name)"'

api -X PUT "$WARDN_API_URL/api/v1/pagerduty/services" -d '{
  "links": [
    {"serviceId": "PABC123", "serviceName": "Checkout", "deploymentIds": ["'"$WEB_PRODUCTION_ID"'"]}
  ]
}'

An incident on a mapped service is linked to those deployments, with the snapshot each was running when it was linked. Remapping moves its incidents the next time they are read. Map every service you care about: an incident on a service with no mapping affects no deployment, so it is not on any team's pages and only people who hold incident:read on the whole organization see it.

Fill an on-call group from a schedule

Create an on-call group and map the schedule to it. There is no web screen for creating groups yet, so use the API:

GROUP_ID=$(api -X POST "$WARDN_API_URL/api/v1/groups" -d '{"name":"Platform on-call","kind":"onCall"}' | jq -r .id)

api -X PUT "$WARDN_API_URL/api/v1/pagerduty/schedules" -d '{
  "links": [{"scheduleId": "PSCHED1", "scheduleName": "Platform", "groupId": "'"$GROUP_ID"'"}]
}'

Then give the group the role you want the person on call to hold, for example a custom role with restore:bypass, using a grant to the group on the place (Roles and grants). Wardn fills the group with whoever PagerDuty says is on call now, matched by email to a member whose address is verified. Someone whose address is not a member's, or not verified here, matches nobody. A group is filled by one schedule.

Check that it worked

Read the integration back. standing is ok once a read has worked:

api "$WARDN_API_URL/api/v1/pagerduty" | jq '{standing, syncedAt, syncError, services, schedules: [.schedules[] | {scheduleName, known, onCall, until}]}'
api -X POST "$WARDN_API_URL/api/v1/pagerduty/sync" > /dev/null    # read now instead of waiting a minute
api -X POST "$WARDN_API_URL/api/v1/integrations/pagerduty/test" | jq   # one real call; says how long it took

Then:

  1. A schedule is known: true with onCall naming a member, and until is the end of the shift Wardn read. If onCall is empty while PagerDuty has someone on call, their email is not a verified member's: emails shows what PagerDuty named.
  2. The group. GET /groups shows Platform on-call with that person as its only member, and a grant on the group gives them its roles.
  3. An incident. In PagerDuty, trigger a test incident on the Checkout service. Open Incidents in Wardn: it appears under From PagerDuty, with the commander (the person it is assigned to, matched by email) and Affects web-production. Its page shows the deployment and the snapshot it ran. Open in PagerDuty goes to the incident there.
  4. Severity and status. A P1 or SEV-1 priority is Sev 1, down to P5 as Sev 4; with no priority, a high urgency is Sev 2 and anything else Sev 3. Triggered and acknowledged are open, resolved is resolved. A Sev 1 or 2 incident also puts an Incident notice in the inbox of the teams that own web-production (Notifications).
  5. Resolve it in PagerDuty. The Wardn incident resolves at the next read. Marking one mitigated or resolved in Wardn changes it in Wardn only, and the mirror never undoes what a person did here.
  6. Integrations. Settings › Integrations shows PagerDuty as Connected, with the incidents and groups that depend on it (Integration health).

When PagerDuty cannot be read

Wardn fails closed. When PagerDuty is down, slow, refusing the key, paused, or has not been read for five minutes:

  • the incident facts incident.open_count and incident.recent_count are unknown, so a pipeline stage or guardrail that needs no open incident waits instead of passing on a count that may be missing the one that matters;
  • every mapped schedule is unknown and its on-call group is emptied: nobody is believed on call, and what the group's roles allowed stops with it. It is never the person whose shift just ended;
  • the incidents already mirrored stay visible, but they are not believed to be complete.

GET /pagerduty says standing: stale with the error, and the Integrations page shows Degraded (or Down after five failed calls in a row, which also tells the people who may manage integrations). Fix the key or the network, then POST /pagerduty/sync.

Keep a human path for the middle of the night

An emptied on-call group means that the right to bypass a guardrail held by "whoever is on call" is held by nobody until PagerDuty answers. Keep at least one person who holds the duty directly, so a PagerDuty outage cannot leave nobody able to restore past a guardrail (Restore safely during an incident).

Next

Related: Integration health, Guardrails.

On this page