What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Auditing alerting thresholds, notifications and limits via API

Votes:

0

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 :)

api limits lordmilko notifications threshold

Created on May 10, 2018 11:02:15 AM

Last change on May 10, 2018 11:38:38 AM by  Luciano Lingnau [Paessler]



6 Replies

Accepted Answer

Votes:

2

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

C:\> Get-Sensor | Select -First 1 | Get-Channel

Name                SensorId    Id    LastValue LimitsEnabled UpperErrorLimit LowerErrorLimit ErrorLimitMessage
----                --------    --    --------- ------------- --------------- --------------- -----------------
Total               3001         0       0.32 %          True              95                 PANIC!! PANIC!!!
Processor 1         3001         1         <1 %         False
C:\> Get-Probe | Get-NotificationTrigger

Type        ObjectId SubId Inherited ParentId Latency Condition Threshold Units      OnNotificationAction
----        -------- ----- --------- -------- ------- --------- --------- -----      --------------------
Change      1        8     False     1                Change                         Ticket Notification
State       1        1     True      0        600     Equals    Down                 Email Administrator
Threshold   1        7     False     1        60      NotEquals 5                    Email PRTG Alerts Mailbox
Speed       1        5     False     1        60      Above     3         TByte/Day  SMS Escalation Team 1
Volume      1        6     False     1                Equals    6         KByte/Hour SMS Escalation Team 1

Regards,

lordmilko

Created on May 10, 2018 12:01:49 PM



Votes:

0

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 :)

Created on May 10, 2018 12:06:26 PM



Votes:

2

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

Created on May 10, 2018 12:16:19 PM



Votes:

0

holy frijoles... you're a savior ma dude :)

Created on May 10, 2018 12:30:55 PM



Votes:

0

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

Created on Oct 1, 2019 2:44:33 AM



Votes:

0

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 }

Created on Oct 1, 2019 4:17:48 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.