The new Alertmanager has integrations to a variety of popular notification mechanisms, one of those is PagerDuty. Let's see how easy it is to hook it in.

PagerDuty Setup

First we need to create a service in PagerDuty, and obtain an integration key.

Go to the "Services" page in PagerDuty:

Click "+ Add New Service":

Add a new service that integrates with the API directly, specifying the Escalation Policy to use:

Note down the Integration Key:

Alertmanager Setup

Let's download, configure and run an Alertmanger:

INTEGRATION_KEY=XXXX  # Substitute in your integration key here.
tar -xzf alertmanager-0.8.0.linux-amd64.tar.gz
cd alertmanager-*

cat <<EOF > alertmanager.yml
 group_by: [cluster]
 # If an alert isn't caught by a route, send it to the pager.
 receiver: team-pager
  # Send severity=page alerts to the pager.
  - match:
      severity: page
    receiver: team-pager

- name: team-pager
  - service_key: $INTEGRATION_KEY
./alertmanager &

That's all now setup.

To test it out we'll cheat a bit and rather than using Prometheus to send the alert like you're meant to, instead do it by hand:

curl -d '[{"labels": {"alertname": "PagerDutyDemo"}}]' :9093/api/v1/alerts

You'll see it as a triggered incident, which will be resolved by the Alertmanager as it's not continuing to fire:

The flexibility the Prometheus Alertmanager offers means that each team can have it's own PagerDuty service for its own alerts, all routed based on alert labels!