Hi Jonathan,
The native PRTG API does not expose an endpoint for manipulating notification triggers, however you can do this fairly easily using PrtgAPI
Get-Sensor | Get-Trigger
This will return all notification triggers defined on all sensors. Most of these will in fact probably be inherited from their parent object; you can uniquely identify all triggers in your system by grouping according to the ParentId and SubId of the object. Since triggers might also be flagged to not be inherited by child objects, I would say you probably want to inspect all probes, devices, groups and sensors for triggers and then group for each unique one
$objects = Get-Object -Resolve | where { $_ -is "PrtgAPI.SensorOrDeviceOrGroupOrProbe" }
$triggers = $objects | Get-Trigger -Inherited:$false
$unique = $triggers | group { "$($_.parentid)_$($_.subid)" } | foreach { $_.Group | select -first 1 }
This should then give you all the triggers on your system!
C:\> $unique
Type ObjectId SubId Inherited ParentId Latency Condition Threshold Unit OnNotificationAction
---- -------- ----- --------- -------- ------- --------- --------- ---- --------------------
State 0 1 False 0 600 Equals Down Ticket Notification
Threshold 2055 4 False 2055 75 7 Email and push notification to admin
Change 2055 5 False 2055 Change Ticket Notification
State 2055 1 False 2055 70 Equals Down Email and push notification to admin
Speed 2055 2 False 2055 80 Below 30 Kbit/Mi... Email and push notification to admin
Volume 2055 3 False 2055 Equals 5 Email to all members of group PRT...
State 1001 1 False 1001 900 Equals Down Email and push notification to admin
State 1002 1 False 1002 900 Equals Down Email and push notification to admin
For more information on retrieving notification triggers, please see the PrtgAPI wiki
Regards,
lordmilko
Add comment