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 can I use the PagerDuty Events API v2 with notifications in PRTG?
Votes:
0
10 Replies
Votes:
0
This article applies as of PRTG 22
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 Region | Events API v2 URL |
---|---|
US | https://events.pagerduty.com/v2/enqueue |
EU | https://events.eu.pagerduty.com/v2/enqueue |
Step 1: Configure PagerDuty
- Sign in to the PagerDuty portal and click the Services tab.
Click to enlarge. - Click New Service.
Click to enlarge.- Name and Description: Provide a name and an optional description for the service and click Next.
Click to enlarge. - Assign an Escalation Policy: Select Generate a new Escalation Policy or Generate a new Escalation Policy and click Next.
Click to enlarge. - Reduce Noise: Select Intelligent for Alert Grouping and Auto-pause incident notifications for Transient Alerts and click Next.
Click to enlarge. - Integrations: Select PRTG Notification for PagerDuty Events API v2 and click Create Service.
Click to enlarge.
- Name and Description: Provide a name and an optional description for the service and click Next.
Step 2: Configure PRTG
- Copy the file PagerDutyEventsV2.ps1 from the .zip file that you have downloaded earlier to the \Notifications\EXE subfolder of the PRTG program directory.
- Log in to the PRTG web interface and navigate to Setup | Account Settings | Notification Templates.
Click to enlarge.
- Click the plus button and select Add Notification Template.
Click to enlarge.
- Enter a Template Name to identify the template and select the appropriate Notification Summarization settings.
Click to enlarge.
- Scroll down to the notification methods and enable Execute Program. As Executable File, select PagerDutyEventsV2.ps1 from the dropdown list. Then enter the following Parameters:
'%device' '%name' '%status' '%down' '%message' '[email protected]' 'Integration_Key'
Click to enlarge.
Notes:
• For [email protected], enter 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 need to escape each parameter with single quotes. - Click Create to add the new notification template.
- Find your PagerDuty notification template and click the bell icon on the right to send a test notification.
- 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]
(2,404)
●2
●1
Last change on Jan 9, 2023 8:15:06 AM by
Jacqueline Conforti [Paessler Support]
Votes:
0
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
Votes:
0
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.
Votes:
1
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.
Votes:
0
step 4 not have xxxx value. pagerdut update maybe.
Votes:
0
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.
Votes:
0
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.
Votes:
0
Hello Andrew
I'll be reporting this issue and have this KB link updated asap.
Thank you for letting us know.
Created on Feb 1, 2022 12:06:54 AM by
Luis Quesada (Paessler Technical Support)
Last change on Feb 1, 2022 12:07:32 AM by
Luis Quesada (Paessler Technical Support)
Votes:
0
Does anyone know if something with pagerduty has changed? I've tried multiple times to setup this integration multiple times and pagerduty never shows that it's received anything from PRTG even though PRTG is showing it's successfully executing the powershell script.
Votes:
0
Hello there.
Thanks for your question
Yes, the Pager duty page was recently updated with more information, The last update was done on Jan the 9th 2023.
If you are not getting any error from PRTG then it would be advised to contact Pager duty support, and then see what's actually being sent to them and how they are handling this information.
Add comment