-
Notifications
You must be signed in to change notification settings - Fork 0
New AlertRule
external help file: Pinja.Azure.Alerts-help.xml Module Name: Pinja.Azure.Alerts online version: schema: 2.0.0
Create new alert rule
New-AlertRule [-ResourceType] <String> [-Name] <String> [-Severity] <String> [-Criteria] <ScriptBlock>
[[-Description] <String>] [[-AlertValidationSteps] <String[]>] [[-AlertFixSteps] <String[]>]
[[-WindowSize] <TimeSpan>] [[-Frequency] <TimeSpan>] [[-InputObject] <PSObject[]>] [<CommonParameters>]
Create new alert rule. Simplifies custom alert creation by giving defaults for non mandatory values and validations for allowed values.
New-AlertRule `
-ResourceType 'Microsoft.Web/Sites' `
-Name "my-alert-1" `
-Severity Critical `
-Criteria { New-AzMetricAlertRuleV2Criteria -MetricName 'Http5xx' -TimeAggregation Total -Operator GreaterThan -Threshold 5 } `
-WindowSize (New-TimeSpan -Minutes 5) `
-Frequency (New-TimeSpan -Minutes 5)
$alertsWithAdditional = Get-DefaultAlertRules |
New-AlertRule `
-ResourceType 'Microsoft.Web/Sites' `
-Name "my-alert-1" `
-Severity Critical `
-Criteria { New-AzMetricAlertRuleV2Criteria -MetricName 'Http5xx' -TimeAggregation Total -Operator GreaterThan -Threshold 5 } `
-WindowSize (New-TimeSpan -Minutes 5) `
-Frequency (New-TimeSpan -Minutes 5)
Type of resource alert is applied, for example 'Microsoft.Web/Sites'
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Name of alert. This is shown on alert page and is used to check uniquenes. Alert with same name will be overwritten.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Severity of alert.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Scriptblock that defines alert criteria object. See documentation of New-AzMetricAlertRuleV2Criteria. Scriptblock is used so you can use targeted resource from pipeline variable ($_) for creating criteria with specific names or parameters based on resource it is applied.
Type: ScriptBlock
Parameter Sets: (All)
Aliases:
Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Description of alert what happened and possible short description what this means in system perspective.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Additional information (runbook / validation part) how receiver of alert can check that is system working or not. Usually contains array of links for documents how to validate system is working properly or not.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
Additional information (runbook / fix part) how receiver can fix issue after its validated that it isn't working properly. Usually contains array of links for documents how to attempt fix specific problematic resource.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
How wide window is used to calculate criteria.
Type: TimeSpan
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
How ofter defined window for criteria is checked.
Type: TimeSpan
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Supports adding new alert to existing alerts with pipeline syntax.
Type: PSObject[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.