Hi guys, i was wondering if you had any pointers on how to collect the alerting/notification settings for every sensor on our prtg server so we can audit them and make sure they are standardised.
Im looking for
- Limits Enabled - y/n
- Thresholds for sensors Alarm and Warn
- If possible what notification triggers exist for a device I.e just a ticket or email groups.
However i need this on a large scale for everything. Any API pointers greatly received, i also use LordMilkos API suite if he is about :)
Article Comments
Hey there LordMilko! I actually figured this out from the docs of prtgapi about 15s after i posted it but then the edit feature wouldnt work. Do you by any chance know how to include device/sensor name in the get-notificationtrigger output? I'm happy working with objids but this spreadsheet is going to head honchos who need names, numbers and charts :)
May, 2018 - Permalink
Hi Sam,
The API calls made by Get-NotificationTrigger do not return that information, however this can be achieved very easily with a bit of PowerShell magic
C:\> $triggers = Get-Probe | foreach { $_ | Get-Trigger | Add-Member Name $_.Name -PassThru } C:\> $triggers | fl Name : Local Probe ObjectId : 1 ParentId : 0 Inherited : True Type : State TypeName : State Trigger SubId : 1 Latency : 600 Channel : Unit : OnNotificationAction : Ticket Notification OffNotificationAction : None Threshold : Down Condition : Equals EscalationLatency : 900 EscalationNotificationAction : Ticket Notification RepeatInterval : 0
Instead of piping Get-Probe straight into Get-Trigger, we pipe it into a foreach cmdlet that performs three functions
1. Retrieves all triggers from the input Probe
2. Adds a new property "Name" to each trigger containing the name of the input Probe
3. Writes the updated input Probe to the pipeline
You will also find an example showing this exact technique on the Channels page of the wiki, showing how the name of each Sensor can be added to each channel
Regards,
lordmilko
May, 2018 - Permalink
I am trying to run an audit like the others here with PRTG API and powershell, thank you for creating this. However, I need to get the device name that such sensor is associated with. that way I dont have to do look ups for each sensor ID
I hope there is a way to pipe that in?
Please advise. thank you again
Oct, 2019 - Permalink
You can use the Add-Member technique in this post
# List all sensors of all triggers, additionally including the sensor name and sensor device on each item C:\> $triggers = Get-Sensor | foreach { $_ | Get-Trigger | Add-Member Name $_.Name -PassThru | Add-Member Device $_.Device -PassThru }
Oct, 2019 - Permalink
Hi Samuel,
This can be achieved with the Get-Channel and Get-NotificationTrigger cmdlets of PrtgAPI. For more information, see Channels and Notification Triggers on the PrtgAPI wiki
Regards,
lordmilko
May, 2018 - Permalink