lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
305 stars 38 forks source link

Creating Ping Sensor with Powershell #156

Closed xasz closed 4 years ago

xasz commented 4 years ago

The Documentation about creating Sensors with Powershell is missing a Simple Example for Ping Sensor if this is possible. The was already some Users asked this in the official PRTG Forum, where the answer was to clone a other sensor.

I by myself could not figure it out how to add a new Ping Sensor to a device by the documentation. There is an example for C# but i could not figure it out how to use this with Powershell.

Btw: Very very nice work on this PrtgAPI

Has an Example for Ping for C#: https://github.com/lordmilko/PrtgAPI Would be nice if the Powershell Object-Creation had an example for Ping: https://github.com/lordmilko/PrtgAPI/wiki/Object-Creation

lordmilko commented 4 years ago

Hi @xasz,

I don't see an example for creating a Ping sensor for C# either on the Object Creation page

On the Object Creation page it states

PrtgAPI natively supports the creation of the following sensor types:

  • EXE/Script Advanced
  • WMI Service
  • HTTP
  • Sensor Factory

For all other sensor types please see Dynamic Parameters

which then links you here. You should then be able to create a new Ping sensor using this information; the following illustrates how you would use this info to create a ping sensor on a single object

Get-Device -Id 1001 | New-SensorParameters -RawType ping | Add-Sensor

Regards, lordmilko

mdurupt commented 2 years ago

Thank you for this very usefull command! This should be added to the Wiki