Edit

Share via


New-AzMetricAlertRuleV2Criteria

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

WebtestParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DimensionSelection

List of dimension conditions

Parameter properties

Type:

PSMetricDimension[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

StaticThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
DynamicThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-DynamicThreshold

Switch parameter for using Dynamic Threshold Type

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DynamicThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExaminedAggregatedPointCount

The Total number of examined points

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:TotalPeriod, NumberOfExaminedAggregatedPoints

Parameter sets

DynamicThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

WebtestParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IgnoreDataBefore

The IgnoreDataBefore parameter

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DynamicThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MetricName

The metric name for rule

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

StaticThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DynamicThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MetricNamespace

The Namespace of the metric

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

StaticThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DynamicThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Operator

The rule condition operator

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

StaticThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DynamicThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

StaticThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DynamicThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Threshold

The threshold for rule condition

Parameter properties

Type:Double
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

StaticThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ThresholdSensitivity

The sensitivity for rule condition

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Sensitivity

Parameter sets

DynamicThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

StaticThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DynamicThresholdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

DynamicThresholdParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WebTest

Switch parameter for using availability criteria Type

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WebtestParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WebTestId

The Application Insights web test Id.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WebtestParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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