你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

New-AzMetricAlertRuleV2Criteria

创建可用于创建新指标警报的本地条件对象

语法

StaticThresholdParameterSet (默认值)

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>]

说明

New-AzMetricAlertRuleV2Criteria cmdlet 创建一个本地指标条件对象,该对象用作输入 Add-AzMetricAlertRuleV2 cmdlet,该 cmdlet 将创建新的指标警报规则。

示例

示例 1:创建简单的指标警报条件

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           :

此命令创建可在指标警报规则中使用的简单指标警报条件

示例 2:创建动态指标警报条件

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           :

此命令创建可在指标警报规则中使用的动态指标警报条件

示例 3:创建更复杂的指标警报条件

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}

这组命令创建更复杂的指标警报条件,其中包括维度选择

示例 4:创建 Web 测试可用性条件

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 :

此命令创建可在指标警报规则中使用的 Webtest 可用性条件

参数

-ApplicationInsightsId

Application Insights 资源 ID。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False
别名:componentId

参数集

WebtestParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

参数属性

类型:IAzureContextContainer
默认值:None
支持通配符:False
不显示:False
别名:AzContext, AzureRmContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DimensionSelection

维度条件列表

参数属性

类型:

PSMetricDimension[]

默认值:None
支持通配符:False
不显示:False

参数集

StaticThresholdParameterSet
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False
DynamicThresholdParameterSet
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DynamicThreshold

使用动态阈值类型的开关参数

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

DynamicThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ExaminedAggregatedPointCount

已检查点总数

参数属性

类型:Int32
默认值:None
支持通配符:False
不显示:False
别名:TotalPeriod, NumberOfExaminedAggregatedPoints

参数集

DynamicThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-FailedLocationCount

要引发警报的最小失败位置数。

参数属性

类型:Int32
默认值:None
支持通配符:False
不显示:False
别名:AlertLocationThreshold

参数集

WebtestParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-IgnoreDataBefore

IgnoreDataBefore 参数

参数属性

类型:DateTime
默认值:None
支持通配符:False
不显示:False

参数集

DynamicThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricName

规则的指标名称

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

StaticThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
DynamicThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricNamespace

指标的命名空间

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

StaticThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
DynamicThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Operator

规则条件运算符

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

StaticThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
DynamicThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SkipMetricValidation

允许在尚未发出的自定义指标上创建警报规则,方法是跳过指标验证

参数属性

类型:Boolean
默认值:None
支持通配符:False
不显示:False

参数集

StaticThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
DynamicThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Threshold

规则条件的阈值

参数属性

类型:Double
默认值:None
支持通配符:False
不显示:False

参数集

StaticThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ThresholdSensitivity

规则条件的敏感度

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False
别名:Sensitivity

参数集

DynamicThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-TimeAggregation

用于跨窗口间隔汇总多个指标值的聚合作

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

StaticThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
DynamicThresholdParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ViolationCount

引发警报所需的所选回溯时间范围内所需的最小冲突数

参数属性

类型:Int32
默认值:None
支持通配符:False
不显示:False
别名:FailingPeriod, NumberOfViolations

参数集

DynamicThresholdParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WebTest

切换参数以使用可用性条件类型

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

WebtestParameterSet
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WebTestId

Application Insights Web 测试 ID。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

WebtestParameterSet
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

PSMetricDimension

输出

IPSMultiMetricCriteria