Last active
September 12, 2016 10:29
-
-
Save markwragg/7640aeab480f2f4e4b278908d108c1ef to your computer and use it in GitHub Desktop.
Powershell script for getting the URL step settings from all HTTP Transaction sensors in PRTG : http://wragg.io/get-transaction-sensor-url-settings-from-prtg-with-powershell/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
Param( | |
$PRTGURL = "https://{your prtg URL}/api", | |
$Auth = "username={your prtg user}&passhash={your prtg password hash}" | |
) | |
$Sensors = "" | |
$Sensors = (invoke-restmethod "$PRTGURL/table.json?content=sensors&output=json&columns=objid,probe,group,device,sensor,status&count=10000&filter_type=httptransaction&$Auth").sensors | |
$i = 1 | |
$Sensors | ForEach-Object { | |
Write-Progress -Activity "Gathering URL settings for $($_.device)" -Status "$i of $($Sensors.Count)" -PercentComplete (($i / $Sensors.Count)*100) | |
$ObjID = "" | |
$ObjID = $_.objid | |
For ($c = 1; $c -le 10; $c++){ | |
Write-Progress -id 1 -Activity "Getting URL$c" -Status "$c of 10" -PercentComplete (($c / 10)*100) | |
$URL = "" | |
$URL = (invoke-restmethod "$PRTGURL/getobjectproperty.htm?id=$ObjID&name=HTTPURL$c&show=text&$Auth").prtg.result | |
$_ | Add-Member –MemberType NoteProperty –Name "URL$c" –Value $URL | |
} | |
$i++ | |
$_ | |
} | Export-CSV "TransactionSensors-$(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