Skip to content

Instantly share code, notes, and snippets.

@markwragg
Last active February 18, 2022 19:26
Show Gist options
  • Save markwragg/02a91560f46210cf67ca5c810681f6ae to your computer and use it in GitHub Desktop.
Save markwragg/02a91560f46210cf67ca5c810681f6ae to your computer and use it in GitHub Desktop.
Powershell script for returning the Auto Acknowledge setting for all Ping sensors in PRTG using the API.
[CmdletBinding()]
Param(
$PRTGURL = "https://{your PRTG URL}/api",
$Auth = "username={your username}&passhash={your password hash}",
$SensorType = "ping"
)
$Sensors = ""
$Sensors = (invoke-restmethod "$PRTGURL/table.json?content=sensors&output=json&columns=objid,probe,group,device,sensor,status&count=10000&filter_type=$SensorType&$Auth").sensors
$i = 1
$Sensors | ForEach-Object {
Write-Progress -Activity "Gathering AutoAcknowledge settings for $($_.device)" -Status "$i of $($Sensors.Count)" -PercentComplete (($i / $Sensors.Count)*100)
$ObjID = ""
$ObjID = $_.objid
$AutoAcknowledge = ""
$AutoAcknowledge = (invoke-restmethod "$PRTGURL/getobjectproperty.htm?id=$ObjID&name=AutoAcknowledge&show=text&$Auth").prtg.result
$_ | Add-Member –MemberType NoteProperty –Name "AutoAcknowledge" –Value $AutoAcknowledge
$i++
$_
} | Export-CSV "AutoAcknowledge-$SensorType-$(get-date -format yyyy-MM-dd-hhmm).csv" -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment