[英]Enabling an azure metric alert V2
i am working on azure to monitor appservices and while a Continous deployments i am trying to build an automation task to disable/enable alert during deployments我正在研究 azure 以监控 appservices,并且在持续部署时,我正在尝试构建自动化任务以在部署期间禁用/启用警报
For disabling alerts it is working对于禁用警报,它正在工作
Get-AzMetricAlertRuleV2 -ResourceGroupName "<resource group name>" -Name "<alert name>" | Add-AzMetricAlertRuleV2 -DisableRule
For enabling the alerts after the deployments用于在部署后启用警报
Get-AzMetricAlertRuleV2 -ResourceGroupName "<resource group name>" -Name "<alert name>" | Add-AzMetricAlertRuleV2 -TargetResourceRegion "westeurope"
I get the following error:我收到以下错误:
Add-AzMetricAlertRuleV2: Exception type: ErrorResponseException, Message: Alert update failed. Updating from StaticThresholdCriteria and odata.type SingleResourceMultipleMetricCriteria to StaticThresholdCriteria and odata.type MultipleResourceMultipleMetricCriteria is not supported. Activity ID: ec818831-0516-44a7-92ff-cbddaa82b634., Code: BadRequest, Status code:BadRequest, Reason phrase: BadRequest
You should not change the region by passing -TargetResourceRegion
param while enabling.启用时不应通过传递-TargetResourceRegion
参数来更改区域。 Add-AzMetricAlertRuleV2
is trying add a new rule thinking that it's a new rule and failing because of the shown error message ( Updating from StaticThresholdCriteria and odata.type SingleResourceMultipleMetricCriteria to StaticThresholdCriteria and odata.type MultipleResourceMultipleMetricCriteria is not supported
). Add-AzMetricAlertRuleV2
正在尝试添加一个新规则,认为它是一个新规则并且由于显示的错误消息而失败( Updating from StaticThresholdCriteria and odata.type SingleResourceMultipleMetricCriteria to StaticThresholdCriteria and odata.type MultipleResourceMultipleMetricCriteria is not supported
)。 So just enable by without passing any other params like below.因此,只需在不传递任何其他参数的情况下启用,如下所示。
Get-AzMetricAlertRuleV2 -ResourceGroupName "<resource group name>" -Name "<alert name>" | Add-AzMetricAlertRuleV2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.