Webhook Example for PagerDuty

Contributors netapp-alavoie Download PDF of this page

Webhooks allow users to send alert notifications to various applications using a customized webhook channel. This page provides an example for setting up webhooks for PagerDuty.

This page refers to third-party instructions, which could be subject to change. Refer to the PagerDuty documentation for the most up-to-date information.

PagerDuty Setup:

  1. In PagerDuty, navigate to Services > Service Directory and click on the +New Service button​

  2. Enter in a Name and select Use our API directly. Click on Add Service.

    Pagerduty screen

  3. Click on the Integrations tab to see the Integration Key. You will need this key when you create the Cloud Insights webhook below.

  1. Go to Incidents or Services to view Alerts.

    Pagerduty Screen

Create Cloud Insights Webhook:

  1. In Cloud Insights, navigate to Admin > Notifications and select the Webhooks tab. Click +Webhook to create a new webhook.

  2. Give the webhook a meaningful Name, such as "PagerDuty Trigger". You will use this webhook for critical- and warning-level events.

  3. In the Template Type drop-down, select PagerDuty.

  1. Create a custom parameter secret named routingKey and set the value to the PagerDuty Integration Key value from above.

    Setting the Routing Key

Repeat these steps to create a "PagerDuty Resolve" webhook for resolved events.

PagerDuty to Cloud Insights Field Mapping

The following table and image show the mapping of fields between PagerDuty and Cloud insights:

PagerDuty Cloud Insights

Alert Key

Alert ID

Source

Triggered On

Component

Metric Name

Group

Object Type

Class

Monitor Name

PagerDuty Fields in CI

Notifications via Webhook

To notify on events via webhook, in Cloud Insights navigate to Alerts > Monitors and click +Monitor to create a new monitor.

  • Select a metric and define the monitor’s conditions.

  • Under _Set up team notification(s), choose the Webhook Delivery Method.

  • Choose the "PagerDuty Trigger" webhook for Critical- and Warning-level events.

  • Choose the "PagerDuty Resolve" for resolved events.

    Webhook Notifications

Setting separate notifications for trigger events versus resolved events is a best practice, since PagerDuty handles trigger events differently than resolved events.