lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

question: can the api create new rest custom sensors? #32

Closed olsonnn closed 6 years ago

olsonnn commented 6 years ago

question: can the api create new rest custom sensors with specific values in the custom header settings? The wiki is a bit unclear for me...

lordmilko commented 6 years ago

Hi @olsonnn,

You can create a new REST Custom BETA sensor by creating a set of Dynamic Parameters

The following provides an example of how you might add a new REST Custom BETA sensor

$params = Get-Device -count 1 | New-SensorParameters -RawType restcustom

$params.usecustomheaders = "yes"
$params.customheaders = "some: header`nanother: header"
$params.query = "awesome query"

Get-Device -Id 1234 | Add-Sensor $params

PRTG requires each header be separated by a newline character, which we achieve in PowerShell by typing `n

Please let me know if you require any further assistance

Regards, lordmilko

olsonnn commented 6 years ago

thanks! works perfectly.!