What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How can I use the PagerDuty Events API v2 with notifications in PRTG?

Votes:

0

Your Vote:

Up

Down

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?

api execute-program notifications pagerduty prtg

Created on Apr 28, 2021 7:38:49 AM by  Maike Guba [Paessler Support]

Last change on Apr 28, 2021 9:20:09 AM by  Maike Guba [Paessler Support]



7 Replies

Accepted Answer

Votes:

0

Your Vote:

Up

Down

This article applies as of PRTG 21

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

Step 1: Configure PagerDuty

  1. Sign in to the PagerDuty portal and click the Services tab.
    PagerDuty Services tab
    Click to enlarge.
  2. Click New Service.
    New Service button
    Click to enlarge.
  3. Provide a name and an optional description for the service. Under Integration Type, select Use our API directly, then select Events API v2 from the dropdown list. Click Add Service.
    Add a Service dialog
    Click to enlarge.
  4. PagerDuty now displays the settings for the newly defined service. The URL bar shows the path to the service in the format https://youraccountname.pagerduty.com/service-directory/XXXXXXXX XXXXXXX is a random alphanumeric string. This is the Service ID. Note down the string.
  5. Click the Developer Tools button in the menu bar and select API Access.
    Developer Tools menu
    Click to enlarge.
  6. Click Create New API Key.
    New API Key button
    Click to enlarge.
  7. In the Create API Key dialog, enter a description for the new API call and click Create Key.
    Create Key button
    Click to enlarge.
  8. Note down the API key. This is the only opportunity to copy the key as PagerDuty does not show it again.
    New API Key dialog
    Click to enlarge.

Step 2: Configure PRTG

  1. Copy the file PagerDuty.ps1 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
    Click to enlarge.
  3. Click the plus button and select Add Notification Template.
    Add Notification Template button
    Click to enlarge.
  4. Enter a meaningful Template Name and select the appropriate Notification Summarization settings.
    Add Notification Template dialog
    Click to enlarge.
  5. Scroll down to the notification methods and enable Execute Program. As Program File, select PagerDuty.ps1 from the dropdown list. Then enter the following Parameters: '%device' '%name' '%status' '(%message)' '[email protected]' 'API_KEY' 'SERVICE_ID'
    Note: For [email protected], enter a valid user email address within the PagerDuty account. Replace 'API_KEY' and 'SERVICE_ID' with the values that you noted down during the PagerDuty configuration.

    Note: You need to escape each parameter with single quotes.
    Execute Program notification settings
    Click to enlarge.
  6. Click Create to add the new notification template.
  7. Add notification triggers to sensors or devices as required and use the newly created PagerDuty API notification template.

Created on Apr 28, 2021 8:21:30 AM by  Maike Guba [Paessler Support]

Last change on Apr 30, 2021 2:39:12 PM by  Maike Guba [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Why is there no reference to the URL to send the web hook to in the Notification Template setup? Shouldn't there be a part of the trigger that incorporates "https://events.pagerduty.com/v2/enqueue". I'm having no luck getting a notification into PagerDuty from PRTG

Created on Sep 23, 2021 7:27:26 AM by  Ben_Roberts_ (0)



Votes:

0

Your Vote:

Up

Down

Hello Ben
Unfortunately, the link that you provided seems not to be working on my side. Could you double-check it?
When dealing with notifications there are a lot of steps that need to be taken to properly send it out to the Vendor, in this case, Pager duty.
We need to determine how far you are getting in this process.
In other words, can you confirm the notification is actually being sent out and received at Pager duty? Can you check in Logs/System events/Notification Related, and look for any "error code" or "status ok"?
Feel free to open a support ticket to further investigate this as I believed it would be a lot faster.

Created on Sep 27, 2021 5:32:00 PM by  Luis Quesada (Paessler Technical Support)



Votes:

1

Your Vote:

Up

Down

So I get the ok status in PRTG but nothing shows up in PagerDuty. Pagerduty gives me a new URL that is not at all like whats in the script, infact the script URL returns a 404 where the pagerduty one https://events.pagerduty.com/v2/enqueue does not.

Created on Sep 30, 2021 4:02:09 PM by  cdeli (10)



Votes:

0

Your Vote:

Up

Down

step 4 not have xxxx value. pagerdut update maybe.

See https://www.screencast.com/t/HRmDStWy7ao

Created on Oct 1, 2021 10:10:14 PM by  Dorian Cosentino (10) 1



Votes:

0

Your Vote:

Up

Down

Hello Dorian
The image provided seems to be from the Pager duty page. The step you are referring to seems to be a URL. Can you confirm how the URL looks like at this step?
Let me know.
If the documentation needs to be updated,We will be happy to proceed.

Created on Oct 6, 2021 8:37:39 PM by  Luis Quesada (Paessler Technical Support)



Votes:

0

Your Vote:

Up

Down

This documentation seems to be out of date, and I can't get it to work.

1. On step 3 on the Add A Service page (now called Create a Service), there is no "Use our API directly" option. The first page only has a Name and Description field. Page 2 lets you select an escalation policy or create a new one. Page 3 lets you select an integration, however Use our API directly is not an option. One of the selectable options is named 'Events API v2' and another one (if you search) is called 'PRTG Notification For PagerDuty Events API v2' which seems promising, but not at all what this documentation describes. Incidentally if you add that integration, there's a documentation link which leads to this page.

2. On step 5, the developer tools menu is gone completely, however you can find 'API Access Keys' inside a new menu item named 'Integrations' which lets you generate an API key

3. If you examine the PagerDuty.ps1 script, it links to the URL "https://api.pagerduty.com/incidents", but the PagerDuty page lists the integration URL as "https://events.pagerduty.com/v2/enqueue" -- should we be editing the script for the URL specified in the integration or leaving it as provided?

I have tried both of the listed integration types, at both of the URLs and while I can see script running and the web queries going out (looking at it in Wireshark) so far I have not been able to see anything actually come into PagerDuty, and the return traffic from PagerDuty is [ACK, RST] like the server is saying I got your message but I'm not interested.

Created on Jan 7, 2022 3:41:52 PM by  andrewpierce (0)



Please log in or register to enter your reply.


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.