PRTG Notifications for Cisco WebEx Teams

Things slowed down for me quite a bit over the Christmas break so I spent some time working on a rather large project involving PowerShell. It was good to get some more practice scripting and I certainly learnt a lot (and invented some new swear words as well!). The work was done using Visual Studio Code and PowerShell Core 6 and I have to say after getting over a few teething issues I really enjoyed learning these new tools!

A few issues popped up this week involving PRTG and notifications and I was disappointed to see that whilst PRTG has pre canned notification templates for Microsoft Teams and Slack, there is nothing for Cisco WebEx Teams. Time for some scripting!

I have put together a fairly basic PowerShell script that can be used as an “Execute Program” Notification Template. It is very much in development but I will be actively working on this and sharing the changes as I refine it over the coming weeks. I originally wrote the script using PowerShell Core 6 but when I installed it on the PRTG server I had some dramas as it was configured to use PowerShell 5.1 so I had to make a few changes to account for missing cmdlets and parameters. I will be investigating how I can get the PRTG Core service to use PowerShell Core 6 in the not too distant future.

First thing to do is to create a Bot through an existing Cisco WebEx Teams account. This will be used as a Notifier to post messages into Spaces that it has been made a member of. More details are available here.

The important thing is to grab the Access Token that you are issued with when you create the Bot. This is used by the script to authenticate when making REST calls to the Cisco WebEx API.

Copy the script to the /Notifications/EXE sub folder of your PRTG Core server to make it available in the Notification Template – Execute Program – Program File drop down. You will need to change the $AccessToken entry at the top. Future iterations of this script will encrypt this field to keep it safe from prying eyes. You also need to make sure the path for the $DebugLogFilePath entry is valid.

The script takes the Message and Space name as input parameters which you define in the Execute Program section of the Notification Template setup in PRTG. For the Message Parameter, I have currently successfully tested the %device, %name, %status and %down placeholders, I ran into some problems with the %message placeholder which I believe is due to some illegal characters so I will be working on a function to cleanse the input in the future. The Space Parameter is the name of the Space that you wish the posted message to appear in. Your Bot needs to be added as a member of this Space before the script will work.

Example Parameter entry:

-Space 'PRTG Alerts' -Message '%device %name %status %Down'

Leave a Reply

Your email address will not be published. Required fields are marked *