I am using multiple Notification triggers in various places such as groups, equipment, and sensors.
So it is difficult to find out where I set these Notification trigger.
I ask myself where did I set the Notification trigger.
Is there a way to check or export all Notification triggers?
Article Comments
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
Mar, 2021 - Permalink
Hi Lordmilko, I have just installed PRTGAPI, connected to my PRTG server, but it does not output anything on my console when I run 'Get-Sensor | Get-Trigger'. I have tried to output the results to a text file, but no joy. I get results from Get-Probe ok.
I am sure I am doing something wrong, any pointers?
Jun, 2021 - Permalink
Hi Mikeemike,
When you look at one of these sensors in the PRTG UI, do they actually show that the triggers are applying to them? It's possible that the devices or groups in between your probes and sensors have sensor inheritance disabled, hence why your requests to retrieve triggers from sensors are failing
Jun, 2021 - Permalink
Hi Lordmilko,
I am trying to get this to work but my PRTG server seems to be closing the connection when running the get-object cmd.
Any ideas?
Get-Object -Resolve | Where-Object Type -EQ Probe
WARNING: 'Get-Object' timed out: The underlying connection was closed: The connection was closed unexpectedly. Retries remaining: 1
Get-Object : The underlying connection was closed: The connection was closed unexpectedly.
At line:1 char:12
+ $objects = Get-Object -Resolve | Where-Object Type -EQ Probe
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Object], WebException
+ FullyQualifiedErrorId : System.Net.WebException,PrtgAPI.PowerShell.Cmdlets.GetObject
Aug, 2023 - Permalink
To query probes it makes more sense to simply do "Get-Probe". For any issues relating to PrtgAPI please open a request on GitHub
Aug, 2023 - Permalink
Hello Jonathan,
Thank you for your message.
Regarding notification triggers, I'm afraid that there is no native way to get a list of them for all your devices/groups.
However, you have the possibility to use the API of PRTG to get the notification trigger of one object based on its ID, by using the following call:
The API call above returns a JSON response that you can easily process to create a list. Here are the information returned and their description:
If you have further questions, let us know.
Regards.
Mar, 2021 - Permalink