Azure CLI中的天蓝色监视器指标警报条件的格式是什么?

时间:2019-06-12 02:15:36

标签: azure azure-cli azure-monitoring azure-sdk azure-sdk-python

az monitor metrics alert create的文档未解释--conditon参数使用的格式。在我看来,该值最终作为allOf参数传递给MetricAlertSingleResourceMultipleMetricCriteria class的构造函数,如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]来说似乎不是有效的格式

1 个答案:

答案 0 :(得分:0)

在调用-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.