PRTG and Slack are the next best things since the Big Tasty. So how can we make them play well together?

Fortunately for us, Slack has the best API you can find in any Instant Messaging client and PRTG has a wide range of Notification Options, one of which is Execute HTTP Action.

Setting Up Incoming Webhook Integration in Slack

First we need to setup an Incoming Webhook on Slack. Depending on your Slack configuration you might need to be an admin to add an Incoming Webhook. Click on this URL to create an Incoming Webhook: https://my.slack.com/services/new/incoming-webhook/

Choose a custom name such as PRTG and choose a Custom Icon, ideally the PRTG logo. Make note of the Webhook URL.

That's all the setup we need to on Slack. On to PRTG...

Setting up PRTG

Log into your PRTG setup and from the top menu choose Setup and then Notifications and create a new Notification



I choose to create 2 Notifications, one for Errors and one for Warnings. The difference between these 2 is that the Error notification uses the @channel mention, which alerts everyone in the channel.

Error Notification

Fill out Error Notification Details according to your preferences.



In the URL use your Slack Webhook URL. In the Postdata you can use the following:

payload={ "text": "%device %status %down (%message)... Alerting @channel", "link_names": 1, "attachments": [ { "title": "Sensor: %device %name", "title_link": "%homesensor.htm?id=%sensorid", "text": "*Status:* %status %down

*Date/Time:* %datetime (UTC)

*Last Result:* %lastvalue

*Last Message:* %message

*Probe:* %probe

*Group:* %group

*Device:* %device ()

*Last Scan:* %lastcheck

*Last Up:* %lastup

*Last Down:* %lastdown

*Uptime:* %uptime

*Downtime:* %downtime

*Cumulated since:* %cumsince

*Location:* %location", "color": "%colorofstate", "mrkdwn_in": ["text", "pretext"] } ] }

If you want to modify the payload you can have a look at Slack's Webhook Documentation and PRTG's Notification Placeholders.

Warning Notification

If you want to create a different Warning Notification, create another notification (name it different) and inside the Postdata make sure that in the payload variable, you don't have the @channel mention

Using the Notification

Now that everything is set up, we need to tell PRTG to trigger these notifications. If you want to have these notifications for all objects, under the devices section, choose Notifications.



Add State Triggers depending on your likes:



Congratulations

Congratulations, your PRTG can now post to Slack. Enjoy waking up at 3 in the morning because the printer is out of ink :)