Upravit

Sdílet prostřednictvím


New-AzMetricAlertRuleV2Criteria

Creates a local criteria object that can be used to create a new metric alert

Syntax

New-AzMetricAlertRuleV2Criteria
   -MetricName <String>
   [-MetricNamespace <String>]
   [-SkipMetricValidation <Boolean>]
   [-DimensionSelection <PSMetricDimension[]>]
   -TimeAggregation <String>
   -Operator <String>
   -Threshold <Double>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzMetricAlertRuleV2Criteria
   [-DynamicThreshold]
   -MetricName <String>
   [-MetricNamespace <String>]
   [-SkipMetricValidation <Boolean>]
   [-DimensionSelection <PSMetricDimension[]>]
   -TimeAggregation <String>
   -Operator <String>
   [-ThresholdSensitivity <String>]
   [-ViolationCount <Int32>]
   [-ExaminedAggregatedPointCount <Int32>]
   [-IgnoreDataBefore <DateTime>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzMetricAlertRuleV2Criteria
   [-WebTest]
   -WebTestId <String>
   -ApplicationInsightsId <String>
   [-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.

Type:String
Aliases:componentId
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DimensionSelection

List of dimension conditions

Type:PSMetricDimension[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DynamicThreshold

Switch parameter for using Dynamic Threshold Type

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ExaminedAggregatedPointCount

The Total number of examined points

Type:Int32
Aliases:TotalPeriod, NumberOfExaminedAggregatedPoints
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FailedLocationCount

The minimum number of failed locations to raise an alert.

Type:Int32
Aliases:AlertLocationThreshold
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IgnoreDataBefore

The IgnoreDataBefore parameter

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MetricName

The metric name for rule

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-MetricNamespace

The Namespace of the metric

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Operator

The rule condition operator

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SkipMetricValidation

Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Threshold

The threshold for rule condition

Type:Double
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ThresholdSensitivity

The sensitivity for rule condition

Type:String
Aliases:Sensitivity
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TimeAggregation

The aggregation operation used to roll up multiple metric values across the window interval

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ViolationCount

The minimum number of violations required within the selected lookback time window required to raise an alert

Type:Int32
Aliases:FailingPeriod, NumberOfViolations
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WebTest

Switch parameter for using availability criteria Type

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WebTestId

The Application Insights web test Id.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSMetricDimension[]

Outputs

IPSMultiMetricCriteria