简体   繁体   English

启用 azure 指标警报 V2

[英]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.

相关问题 Azure日志分析指标衡量警报 - Azure Log Analytics Metric Measurement Alert Azure Monitor / Log Analytics 指标警报查询 - Azure Monitor / Log Analytics metric alert query Azure v2工作人员角色? - Azure v2 Worker Role? Azure 应用网关 v2 - Azure application gateway v2 如何使用 Azure Monitor 或 ADF 本身触发 Azure 数据工厂 V2 中长时间运行的进程的警报通知? - How to trigger an alert notification of a long-running process in Azure Data Factory V2 using either Azure Monitor or ADF itself? 带有Azure Functions v2的IWebJobsStartup - IWebJobsStartup with Azure Functions v2 Azure CLI v1与v2? - Azure CLI v1 vs v2? Azure CLI 中 azure 监视器指标警报条件的格式是什么? - What is the format of azure monitor metric alert conditions in Azure CLI? Azure 警报 Azure 功能“失败”指标正在触发,没有明显的故障 - Azure alert on Azure Functions "Failed" metric is triggering with no apparent failures Azure存储帐户的可用性指标图表将变为0,但警报显示为100% - Availability metric chart for Azure storage account going to 0 but alert shown as 100%
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM