< Back
New-NotificationTriggerParameters
Post
NAME New-NotificationTriggerParameters
SYNOPSIS
Creates a new set of notification trigger parameters for adding or editing a notification trigger.
SYNTAX
New-NotificationTriggerParameters [-Type] {State | Speed | Volume | Threshold | Change} -Object
<SensorOrDeviceOrGroupOrProbe> [<CommonParameters>]
New-NotificationTriggerParameters [-Id] <int> [-Type] {State | Speed | Volume | Threshold | Change}
[<CommonParameters>]
New-NotificationTriggerParameters [-Id] <int> [-TriggerId] <int> [-Type] {State | Speed | Volume | Threshold |
Change} [<CommonParameters>]
New-NotificationTriggerParameters [-Id] <int> -Source <NotificationTrigger> [<CommonParameters>]
New-NotificationTriggerParameters -Source <NotificationTrigger> [<CommonParameters>]
DESCRIPTION
The New-NotificationTriggerParameters cmdlet creates a set of trigger parameters for creating or editing a
notification trigger. When editing notification triggers, New-NotificationTriggerParameters should only be used
when multiple values require updating. For updating a single notification trigger property
Edit-NotificationTriggerProperty should be used instead.
When creating a new notification trigger, the trigger's parameters can either be imported from an existing
notification trigger's properties and then further modified, or defined manually from scratch.
Based on the type of notification trigger specified, New-NotificationTriggerParameters will create one of several
TriggerParameter type objects, exposing only the parameters relevant to that trigger type.
When working with TriggerParameters objects, all parameter properties support nullable values, allowing you to
clear any properties you wish to remove or undo. The exception to this however is Notification Action related
properties. When a Notification Action is set to null, it will set the property to the "empty" notification
action. This allows you to easily clear unwanted notification actions within the PRTG Interface.
When editing existing notification triggers, all properties on the TriggerParameters object will be initially set
to null. Specifying a value for a property will highlight to PrtgAPI that that property should be updated when the
trigger request is executed. While holding a value of null by default, Notification Actions will not set
themselves with the "empty" notification action unless this value is explicitly specified. Note that if you wish
to undo modifying a notification action property you have set to null, you will be unable to do so without
creating a brand new TriggerParameters object.
For trigger types where the Channel property is supported (Speed, Threshold and Volume) when defining the trigger
on a Probe, Group or Device, enum values "Primary", "Total", "TrafficIn" and "TrafficOut" must be used. When
applied directly to a Sensor, a specific Channel or Channel ID must be used. To safely resolve all channels
supported by the sensor the Get-Channel cmdlet can be used. Once a Channel or Channel ID has been assigned to a
trigger parameter's Channel property, it is wrapped as a TriggerChannel object and the underlying type cannot be
retrieved. As such, if you wish to refer to your original type, you must keep a copy of the value assigned to the
Channel property for further use in your code.
PARAMETERS
-Object <SensorOrDeviceOrGroupOrProbe>
The object a trigger should be created for.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Id <int>
The ID of the object the notification trigger will be created for or the ID of the object whose triggers
should be modified.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Source <NotificationTrigger>
The notification trigger import trigger parameters from.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-TriggerId <int>
The Sub ID of the trigger to manipulate.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Type <TriggerType>
The type of notification trigger to manipulate.
Possible values: State, Speed, Volume, Threshold, Change
Required? true
Position? 0
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
PrtgAPI.SensorOrDeviceOrGroupOrProbe
The object a trigger should be created for.
System.Int32
The ID of the object the notification trigger will be created for or the ID of the object whose triggers
should be modified.
PrtgAPI.NotificationTrigger
The notification trigger import trigger parameters from.
OUTPUTS
PrtgAPI.Parameters.TriggerParameters
---------- EXAMPLE 1 ----------
C:\\> $params = New-TriggerParameters 1234 State
C:\\> $params | Add-Trigger
Add a new state notification trigger with default values to object with ID 1234
---------- EXAMPLE 2 ----------
C:\\> $params = New-TriggerParameters 1234 3 State
C:\\> $params.Latency = 40
C:\\> $params | Set-Trigger
Edit the state notification trigger with sub ID 3 on the object with ID 1234, setting the Latency to 40 seconds
---------- EXAMPLE 3 ----------
C:\\> $params = Get-Sensor -Id 1001 | Get-Trigger -Type State -Inherited $false | New-TriggerParameters 1234
C:\\> $params.OffNotificationAction = $null
C:\\> $params | Add-Trigger
Create a new notification trigger on the object with ID 1234 from the state trigger on the sensor with ID 1001,
setting the OffNotificationAction to "None"
---------- EXAMPLE 4 ----------
C:\\> $params = Get-Sensor -Id 1001 | Get-Trigger -Type State -Inherited $false | New-TriggerParameters
C:\\> $params.Latency = 30
C:\\> $params | Set-Trigger
Edit the notification trigger on the sensor with ID 1001, setting the latency to 30 seconds
---------- EXAMPLE 5 ----------
C:\\> $sensor = Get-Sensor -Id 1001
C:\\> $channel = $sensor | Get-Channel "Available Memory"
C:\\> $params = $sensor | New-TriggerParameters Threshold
C:\\> $params.Channel = $channel
C:\\> $params | Add-Trigger
Create a new notification trigger on the sensor with ID 1001 that alerts based on the value of its "Available
Memory" channel.
---------- EXAMPLE 6 ----------
C:\\> $params = New-TriggerParameters 1001 Threshold
C:\\> $params.Channel = 1
C:\\> $params | Add-Trigger
Create a new threshold notification trigger on the sensor with ID 1001 that alerts based on the value of the
channel with ID 1.
RELATED LINKS
Online version: https://github.com/lordmilko/PrtgAPI/wi ... gers#add-1
Edit-NotificationTriggerProperty
Add-NotificationTrigger
Set-NotificationTrigger
Get-Channel
SYNOPSIS
Creates a new set of notification trigger parameters for adding or editing a notification trigger.
SYNTAX
New-NotificationTriggerParameters [-Type] {State | Speed | Volume | Threshold | Change} -Object
<SensorOrDeviceOrGroupOrProbe> [<CommonParameters>]
New-NotificationTriggerParameters [-Id] <int> [-Type] {State | Speed | Volume | Threshold | Change}
[<CommonParameters>]
New-NotificationTriggerParameters [-Id] <int> [-TriggerId] <int> [-Type] {State | Speed | Volume | Threshold |
Change} [<CommonParameters>]
New-NotificationTriggerParameters [-Id] <int> -Source <NotificationTrigger> [<CommonParameters>]
New-NotificationTriggerParameters -Source <NotificationTrigger> [<CommonParameters>]
DESCRIPTION
The New-NotificationTriggerParameters cmdlet creates a set of trigger parameters for creating or editing a
notification trigger. When editing notification triggers, New-NotificationTriggerParameters should only be used
when multiple values require updating. For updating a single notification trigger property
Edit-NotificationTriggerProperty should be used instead.
When creating a new notification trigger, the trigger's parameters can either be imported from an existing
notification trigger's properties and then further modified, or defined manually from scratch.
Based on the type of notification trigger specified, New-NotificationTriggerParameters will create one of several
TriggerParameter type objects, exposing only the parameters relevant to that trigger type.
When working with TriggerParameters objects, all parameter properties support nullable values, allowing you to
clear any properties you wish to remove or undo. The exception to this however is Notification Action related
properties. When a Notification Action is set to null, it will set the property to the "empty" notification
action. This allows you to easily clear unwanted notification actions within the PRTG Interface.
When editing existing notification triggers, all properties on the TriggerParameters object will be initially set
to null. Specifying a value for a property will highlight to PrtgAPI that that property should be updated when the
trigger request is executed. While holding a value of null by default, Notification Actions will not set
themselves with the "empty" notification action unless this value is explicitly specified. Note that if you wish
to undo modifying a notification action property you have set to null, you will be unable to do so without
creating a brand new TriggerParameters object.
For trigger types where the Channel property is supported (Speed, Threshold and Volume) when defining the trigger
on a Probe, Group or Device, enum values "Primary", "Total", "TrafficIn" and "TrafficOut" must be used. When
applied directly to a Sensor, a specific Channel or Channel ID must be used. To safely resolve all channels
supported by the sensor the Get-Channel cmdlet can be used. Once a Channel or Channel ID has been assigned to a
trigger parameter's Channel property, it is wrapped as a TriggerChannel object and the underlying type cannot be
retrieved. As such, if you wish to refer to your original type, you must keep a copy of the value assigned to the
Channel property for further use in your code.
PARAMETERS
-Object <SensorOrDeviceOrGroupOrProbe>
The object a trigger should be created for.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Id <int>
The ID of the object the notification trigger will be created for or the ID of the object whose triggers
should be modified.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Source <NotificationTrigger>
The notification trigger import trigger parameters from.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-TriggerId <int>
The Sub ID of the trigger to manipulate.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Type <TriggerType>
The type of notification trigger to manipulate.
Possible values: State, Speed, Volume, Threshold, Change
Required? true
Position? 0
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
PrtgAPI.SensorOrDeviceOrGroupOrProbe
The object a trigger should be created for.
System.Int32
The ID of the object the notification trigger will be created for or the ID of the object whose triggers
should be modified.
PrtgAPI.NotificationTrigger
The notification trigger import trigger parameters from.
OUTPUTS
PrtgAPI.Parameters.TriggerParameters
---------- EXAMPLE 1 ----------
C:\\> $params = New-TriggerParameters 1234 State
C:\\> $params | Add-Trigger
Add a new state notification trigger with default values to object with ID 1234
---------- EXAMPLE 2 ----------
C:\\> $params = New-TriggerParameters 1234 3 State
C:\\> $params.Latency = 40
C:\\> $params | Set-Trigger
Edit the state notification trigger with sub ID 3 on the object with ID 1234, setting the Latency to 40 seconds
---------- EXAMPLE 3 ----------
C:\\> $params = Get-Sensor -Id 1001 | Get-Trigger -Type State -Inherited $false | New-TriggerParameters 1234
C:\\> $params.OffNotificationAction = $null
C:\\> $params | Add-Trigger
Create a new notification trigger on the object with ID 1234 from the state trigger on the sensor with ID 1001,
setting the OffNotificationAction to "None"
---------- EXAMPLE 4 ----------
C:\\> $params = Get-Sensor -Id 1001 | Get-Trigger -Type State -Inherited $false | New-TriggerParameters
C:\\> $params.Latency = 30
C:\\> $params | Set-Trigger
Edit the notification trigger on the sensor with ID 1001, setting the latency to 30 seconds
---------- EXAMPLE 5 ----------
C:\\> $sensor = Get-Sensor -Id 1001
C:\\> $channel = $sensor | Get-Channel "Available Memory"
C:\\> $params = $sensor | New-TriggerParameters Threshold
C:\\> $params.Channel = $channel
C:\\> $params | Add-Trigger
Create a new notification trigger on the sensor with ID 1001 that alerts based on the value of its "Available
Memory" channel.
---------- EXAMPLE 6 ----------
C:\\> $params = New-TriggerParameters 1001 Threshold
C:\\> $params.Channel = 1
C:\\> $params | Add-Trigger
Create a new threshold notification trigger on the sensor with ID 1001 that alerts based on the value of the
channel with ID 1.
RELATED LINKS
Online version: https://github.com/lordmilko/PrtgAPI/wi ... gers#add-1
Edit-NotificationTriggerProperty
Add-NotificationTrigger
Set-NotificationTrigger
Get-Channel