As of this writing, PRTG only has native support for Notification webhooks with Slack and MS Teams. Also, the HTTP POST feature for notifications does not support JSON and XML.

Therefore, deploying a webhook to Discord requires an powershell script and is easy to deploy. This post is to create a pointer to the awesome work by mmetully, and I take no credit for this.

https://github.com/mmetully/prtg-notifications-discord

I am wondering why Paessler have not added this support natively as is really very simple.

Out of the box there is one issue with the script, related to lack of TLS support and is easily addressed by adding the following line to the code, as noted here: https://github.com/mmetully/prtg-notifications-discord/issues/

[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"

I do suggest that before jumping directly to the PRTG configuration, you test the script from a Powershell CLI and confirm operation. Once confirmed, you can then create the PRTG Notification template.

I took one more step and commented the variable $uri on line 73 and send it in the parameters instead.

-sensor '%sensor' -sensorID '%sensorid' -status '%status' -message '%message' -since '%since' -lastup '%lastup' -device '%device' -sensorURL '%linksensor' -deviceURL '%linkdevice' -serviceURL '%serviceurl' -uri 'https://discord.com/api/webhooks/your_webhook_uri_here'

The solves the problem of ability to have multiple PRTG Notification Templates, in order to send messages to different Discord Server channels. e.g. one channel per site that you monitor in PRTG.

The other issue is the Acknowledge link goes to the serviceURL, but can be easily addressed if needed.

I hope others find this information useful.


Article Comments

Also, I neglected to mention that this method addresses the need for custom JSON based webhook to any target platform, e.g. Teams, Slack, others. I may update the title to reflect this.


Oct, 2022 - Permalink

I forked the github to build in the fixes as well as some additional enhancements like graphical logos. I have not re-written the top section, to streamline the comments as of this writing.

https://github.com/JJWatMyself/prtg-notifications-discord

Here is the screen snip of the notifications with PRTG status logos added: https://github.com/JJWatMyself/prtg-notifications-discord/blob/master/example_alerts.png


Dec, 2022 - Permalink