Setting up PRTG to post to Slack

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:

Webhook Integration Settings

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
Setup Notifications

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.
Notification Details

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

    "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 \n*Date/Time:* %datetime (UTC) \n*Last Result:* %lastvalue \n*Last Message:* %message \n*Probe:* %probe \n*Group:* %group \n*Device:* %device () \n*Last Scan:* %lastcheck \n*Last Up:* %lastup \n*Last Down:* %lastdown \n*Uptime:* %uptime \n*Downtime:* %downtime \n*Cumulated since:* %cumsince \n*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.
Notifications Tab
Add State Triggers depending on your likes:
State Triggers


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