This article applies as of PRTG 24


I want to use a PowerShell script to set up a notification in PRTG to send alerts using the PagerDuty Events API v2. Which steps do I have to take?


How to use the PagerDuty Events API v2 with notifications in PRTG

This how-to guide explains how to set up a PowerShell script-based notification method Execute Program in PRTG to send alerts using the PagerDuty Events API v2. The instructions show a generic catch all service and notification, but you can adapt them to work with any defined PagerDuty service or a specific device or sensor in PRTG.


You can download the PowerShell script here: https://gitlab.com/PRTG/notification-scripts/prtg-notification-for-pagerduty-events-api-v2


Important: The Events API v2 URL differs depending on the service region of your PagerDuty account. Make sure to use to correct URL in the script in line 6.


Service RegionEvents API v2 URL
UShttps://events.pagerduty.com/v2/enqueue
EUhttps://events.eu.pagerduty.com/v2/enqueue

Step 1: Configure PagerDuty

  1. Sign in to the PagerDuty portal and click the Services tab.

    PagerDuty Services tab

  2. Click New Service.

    New Service button

  3. Enter a name and an optional description for the service and click Next.

    New service name

  4. Select Generate a new Escalation Policy or Generate a new Escalation Policy and click Next.

    New service name

  5. Select Intelligent for Alert Grouping and Auto-pause incident notifications for Transient Alerts and click Next.

    New service name

  6. Select PRTG Notification for PagerDuty Events API v2 and click Create Service.

    New service name

Step 2: Configure PRTG

  1. Copy the file PagerDutyEventsV2.ps1 from the .zip file that you downloaded earlier to the \Notifications\EXE subfolder of the PRTG program directory.
  2. Log in to the PRTG web interface and navigate to Setup | Account Settings | Notification Templates.

    PRTG Setup main menu bar

  3. Click the plus button and select Add Notification Template.

    Add Notification Template button

  4. Enter a Template Name to identify the template and select the appropriate Notification Summarization settings.

    Add Notification Template dialog

  5. Scroll down to the notification methods and enable Execute Program. In the Executable File setting, select  PagerDutyEventsV2.ps1 from the dropdown list. Then enter the following parameters:
    '%device' '%name' '%status' '%down' '%message' 'johnqpublic@company.com' 'Integration_Key'
    Execute Program notification settings

    Notes:
    • Replace johnqpublic@company.com with a valid user email address within the PagerDuty account.
    • For Integration_Key, sign in to the PagerDuty portal and click the Services tab. Select the service that you created in Step 1: Configure PagerDuty, click the Integrations tab and the icon on the right of the gear wheel on the PRTG Notification For PagerDuty Events API v2 field. You can now see the corresponding integration key for the PRTG configuration. Replace Integration_Key with this key.
    • You must escape each parameter with single quotes.
  6. Click Create to add the new notification template.
  7. Find your PagerDuty notification template and click the bell icon on the right to send a test notification.
  8. Add notification triggers to sensors or devices as required and use the newly created PagerDuty API notification template.


Disclaimer:
The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.