Thank you for your feedback.
I have taken a look at the REST Custom sensor, and unfortunately the credentials can't be hidden there. Therefore, I would recommend to go with the EXE/Script sensor to which you can pass the credentials configured in the device settings. To do so, you can use the placeholders %windowsuser and %windowspassword in the parameters sent to the script, explained below.
Here is an example of script which can help you to get the information, please notice that we do not provide support for it.
Param (
[string]$url = "",
[string]$probeID = "",
[string]$prtguser = "",
[string]$passhash = ""
)
function Invoke-Request {
Param(
$baseurl = $script:url,
$user = $script:prtguser,
$pass = $script:passhash,
$probeID
)
$url = "{0}/api/table.json?content=devices&columns=objid,name&count=*&id={1}&noraw=1&username={2}&passhash={3}" -f $baseurl.trim("/"), $probeID, $user, $pass
Invoke-RestMethod -Uri $url -Method Get -SkipCertificateCheck
}
try {
$r = Invoke-Request
$output = "{0}:OK" -f $($r.treesize)
Write-Host $output
exit 0
} catch {
$err = "$($($_.exception.message)) at line : $($_.InvocationInfo.ScriptLineNumber))"
$output = "0:{0}" -f $err
Exit 1
}
When adding the EXE/Script sensor, you must send the parameters as the following:
"<Server Address>" "<ProbeID>" "<PRTG User>" "<Passhash>"
Make sure to remove the characters <> when replacing the information above.
Here is the documentation regarding custom sensors: https://www.paessler.com/manuals/prtg/custom_sensors#standard_exescript
Regards.
Add comment