PRTG Powershell class for custom sensor results

I’ve been working with PRTG a lot over the last years for monitoring IT infrastructure. One of the cool features of PRTG is that you have almost unlimited possibilities to create your own custom scripts to monitor almost anything. If you are able to return a numeric value, you can show it in PRTG.

Over the past years I’ve created a few dozen custom Powershell scripts for monitoring various IT infrastructures that were not included by default in PRTG. The problem I always had with writing those custom scripts, was to get the correct XML or JSON format outputted so PRTG can interpret the results correctly. Retrieving the items you want to monitor and then combining those values with XML codes, regularly leaded to some typos and the corresponding debugging tasks to find out where the issue is located.

A few month ago, I started playing with custom scripts using Python (which is included in PRTG). I found out that PRTG actually provides a “CustomSensorResult” class which makes it a lot easier to output the correct format to PRTG. You create the object, you add channels and you output the result. This made me wondering why they don’t have this for Powershell.

It sure looked like a nice challenge to me, so I started learning about Powershell classes and I finished writing a “CustomSensorResult” class in Powershell. It is largely based on the Python version. It’s not yet fully complete to accommodate all possible parameters, but I have a solid base to get started with and hopefully will be able to extend it in the near feature.

The code can be found on GitHub. You’ll also find the instructions there on how to use it in your own scripts

Stay tuned for more new monitoring scripts to monitor VMware Horizon infrastructure with PRTG in the near feature!

Leave a Reply

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