We use PRTG to monitor a variety of things within our district. It is a good program, but it has been tedious to work with to add and modify devices, groups and sensors manually or using the custom template Auto Discovery in the GUI because Paessler has not officially supported Powershell. Disclaimer 1: I did not write this module, I am just writing about it. In this post I am just going to go over getting the module, what it has in it, and some caveats to using it. In my next post I am going to go over a situation we had that I needed to recreate over 40 devices and sensors in a limited amount of time.
A blog post on the Paessler site from January 2019 has the following disclaimer about the PrtgAPI module for PRTG on the site:
Disclaimer: PrtgAPI is developed by an independent PRTG user. As the solution described in this post is not part of PRTG itself, it is not officially supported by Paessler or PRTG Technical Support.
Reading the post that this came from I am learning the Powershell commands in the PrtgAPI module. You can read more about the module and get it in the PowerShell Gallery.
- PrtgAPI at PS Gallery
- PrtgAPI at Github
- How to Add Hundreds of Devices or Groups to PRTG Programmatically
You can install it through Powershell by using the following command
- Install-Module -Name PrtgAPI
Once you have the module installed there is one caveat that I found while using it with my normal Powershell profile. That caveat is that you cannot use Exchange or Office365 modules at the same time because when the PrtgAPI was written in 2015 the author did not use an unique verb-noun structure. That means that cmdlets like Get-Group overlap with Exchange cmdlets. What I do is comment out my profile that loads all my other modules when I want to work on PRTG. Not the most elegant solution, but it works.
Here are the commands within the module by using the Get-Command cmdlet. Below is just a small sample.
PS C:\Powershell> get-command -Module PrtgAPI
Command Type | Name |
Alias | Acknowledge-Sensor |
Alias | Add-Trigger |
Alias | New-Trigger |
Function | New-Credential |
Cmdlet | Add-Device |
Cmdlet | Add-Group |
Cmdlet | Add-Sensor |
Cmdlet | Approve-Probe |
Cmdlet | Connect-PrtgServer |
Cmdlet | Copy-Object |
Cmdlet | Disconnect-PrtgServer |
Cmdlet | Get-Device |
Cmdlet | Get-Object |
Cmdlet | Get-Probe |
Cmdlet | Get-PrtgStatus |
Cmdlet | Get-PrtgTree |
Cmdlet | Get-Sensor |
Go ahead and install the module, then give it a quick test drive to see what each cmdlet can do by using Get-Help for some of the cmdlets. In the next post I will go over adding a Group and the adding devices, and sensor. Cya then, and don’t forget to like this post!