Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
New-AzMetricAlertRuleV2Criteria
- Module:
- Az.Monitor Module
Creates a local criteria object that can be used to create a new metric alert
Syntax
StaticThresholdParameterSet (Default)
New-AzMetricAlertRuleV2Criteria
-MetricName <String>
-TimeAggregation <String>
-Operator <String>
-Threshold <Double>
[-MetricNamespace <String>]
[-SkipMetricValidation <Boolean>]
[-DimensionSelection <PSMetricDimension[]>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
DynamicThresholdParameterSet
New-AzMetricAlertRuleV2Criteria
-MetricName <String>
-TimeAggregation <String>
-Operator <String>
[-DynamicThreshold]
[-MetricNamespace <String>]
[-SkipMetricValidation <Boolean>]
[-DimensionSelection <PSMetricDimension[]>]
[-ThresholdSensitivity <String>]
[-ViolationCount <Int32>]
[-ExaminedAggregatedPointCount <Int32>]
[-IgnoreDataBefore <DateTime>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
WebtestParameterSet
New-AzMetricAlertRuleV2Criteria
-WebTestId <String>
-ApplicationInsightsId <String>
[-WebTest]
[-FailedLocationCount <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzMetricAlertRuleV2Criteria cmdlet creates a local metric criteria object to be used as an input Add-AzMetricAlertRuleV2 cmdlet which creates a new metric alert rule.
Examples
Example 1: Create a simple metric alert criteria
New-AzMetricAlertRuleV2Criteria -MetricName "Percentage CPU" -MetricNameSpace "Microsoft.Compute/virtualMachines" -TimeAggregation Average -Operator GreaterThan -Threshold 5
CriterionType : StaticThresholdCriterion
OperatorProperty : GreaterThan
Threshold : 5
AdditionalProperties :
Name : metric1
MetricName : Percentage CPU
MetricNamespace : Microsoft.Compute/virtualMachines
TimeAggregation : Average
Dimensions :
This command creates a simple metric alert criteria that can be used in a metric alert rule
Example 2: Create a dynamic metric alert criteria
New-AzMetricAlertRuleV2Criteria -DynamicThreshold -MetricName "Percentage CPU" -MetricNameSpace "Microsoft.Compute/virtualMachines" -TimeAggregation Average -Operator GreaterThan -ThresholdSensitivity Medium -ViolationCount 2 -ExaminedAggregatedPointCount 4
CriterionType : DynamicThresholdCriterion
OperatorProperty : GreaterThan
AlertSensitivity : Medium
FailingPeriods : Microsoft.Azure.Management.Monitor.Models.DynamicThresholdFailingPeriods
IgnoreDataBefore :
AdditionalProperties :
Name : metric1
MetricName : Percentage CPU
MetricNamespace : Microsoft.Compute/virtualMachines
TimeAggregation : Average
Dimensions :
This command creates a Dynamic metric alert criteria that can be used in a metric alert rule
Example 3: Create a more complex metric alert criteria
New-AzMetricAlertRuleV2DimensionSelection -DimensionName "availabilityResult/name" -ValuesToInclude "gdtest" | New-AzMetricAlertRuleV2Criteria -MetricName "availabilityResults/availabilityPercentage" -TimeAggregation Average -Operator GreaterThan -Threshold 2
CriterionType : StaticThresholdCriterion
OperatorProperty : GreaterThan
Threshold : 2
AdditionalProperties :
Name : metric1
MetricName : availabilityResults/availabilityPercentage
MetricNamespace :
TimeAggregation : Average
Dimensions : {availabilityResult/name}
This set of commands creates a more complex metric alert criteria which includes dimension selection
Example 4: Create a webtest availability criteria
New-AzMetricAlertRuleV2Criteria -WebTest -WebTestId "/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/012345/providers/Microsoft.Insights/webtests/PingTest-appInsights" -ApplicationInsightsId "/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/012345/providers/Microsoft.Insights/components/appInsights" -FailedLocationCount 3
CriterionType : WebtestLocationAvailabilityCriterion
WebTestId : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/012345/providers/Microsoft.Insights/webtests/PingTest-appInsights
ComponentId : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/012345/providers/Microsoft.Insights/components/appInsights
FailedLocationCount : 3
AdditionalProperties :
This command creates a webtest availability criteria that can be used in a metric alert rule
Parameters
-ApplicationInsightsId
The Application Insights resource Id.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | componentId |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-DimensionSelection
List of dimension conditions
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DynamicThreshold
Switch parameter for using Dynamic Threshold Type
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ExaminedAggregatedPointCount
The Total number of examined points
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | TotalPeriod, NumberOfExaminedAggregatedPoints |
Parameter sets
-FailedLocationCount
The minimum number of failed locations to raise an alert.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AlertLocationThreshold |
Parameter sets
-IgnoreDataBefore
The IgnoreDataBefore parameter
Parameter properties
| Type: | DateTime |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MetricName
The metric name for rule
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MetricNamespace
The Namespace of the metric
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Operator
The rule condition operator
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SkipMetricValidation
Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Threshold
The threshold for rule condition
Parameter properties
| Type: | Double |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ThresholdSensitivity
The sensitivity for rule condition
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Sensitivity |
Parameter sets
-TimeAggregation
The aggregation operation used to roll up multiple metric values across the window interval
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ViolationCount
The minimum number of violations required within the selected lookback time window required to raise an alert
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | FailingPeriod, NumberOfViolations |
Parameter sets
-WebTest
Switch parameter for using availability criteria Type
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WebTestId
The Application Insights web test Id.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
PSMetricDimension
Outputs
IPSMultiMetricCriteria
Azure PowerShell
Feedback
Was this page helpful?
