Azure CLI 中 azure monitor 指标警报条件的格式是什么?

What is the format of azure monitor metric alert conditions in Azure CLI?

az monitor metrics alert create does not explain the format used for --conditon parameter. Seems to me the value ends up being passed as allOf argument to constructor of MetricAlertSingleResourceMultipleMetricCriteria class as seen in the Azure CLI source for metric_alert.py 的文档。然而,这意味着这是一个 MetricCritieria 的列表,但文档示例如下:

--condition "total transactions > 5 where ResponseType includes Success" 
--condition "avg SuccessE2ELatency > 250 where ApiName includes GetBlob or PutBlob"

这看起来不像 list[MetricCritieria]

的有效格式

详细的格式说明在调用-h标志时给出:

PS> az monitor metrics alert create -h          
Command
    az monitor metrics alert create : Create a metric-based alert rule.

Arguments
    --condition         [Required] : The condition which triggers the rule.
        Usage:  --conditon {avg,min,max,total,count} [NAMESPACE.]METRIC {=,!=,>,>=,<,<=} THRESHOLD
                           [where DIMENSION {includes,excludes} VALUE [or VALUE ...]
                           [and   DIMENSION {includes,excludes} VALUE [or VALUE ...] ...]]

        Dimensions can be queried by adding the 'where' keyword and multiple dimensions can be
        queried by combining them with the 'and' keyword.

        Values for METRIC, DIMENSION and appropriate THRESHOLD values can be obtained from `az
        monitor metrics list-definition` command.

        Multiple conditons can be specified by using more than one `--condition` argument.

如果您有包含点“.”的自定义指标或冒号 ':' 那么它就不那么容易了,我没有找到任何文档。幸运的是,我找到了一个 metric condition parser rule,您可以在其中阅读条件应该是什么样子。

因此,例如我的指标称为 Ori.EventHub:DeliveryTime,因此条件开关应如下所示:

az monitor metrics alert create --condition "avg Azure.ApplicationInsights.'Ori.EventHub:DeliveryTime' > 100" .