Del via


az monitor metrics alert condition

Manage near-realtime metric alert rule conditions.

Commands

Name Description Type Status
az monitor metrics alert condition create

Build a metric alert rule condition.

Core Preview

az monitor metrics alert condition create

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Build a metric alert rule condition.

az monitor metrics alert condition create --aggregation {Average, Count, Maximum, Minimum, Total}
                                          --metric
                                          --op {Equals, GreaterOrLessThan, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals}
                                          --type {dynamic, static}
                                          [--dimension]
                                          [--namespace]
                                          [--num-periods]
                                          [--num-violations]
                                          [--sensitivity {High, Low, Medium}]
                                          [--since]
                                          [--skip-metric-validation {false, true}]
                                          [--threshold]

Examples

Build a static condition.

$dim1 = az monitor metrics alert dimension create -n dimName --op Include -v GetBlob PutBlob
$dim2 = az monitor metrics alert dimension create -n Instance --op Exclude -v Get Put
$condition = az monitor metrics alert condition create -t static 

--aggregation Count 

--metric "CPU Percentage" 

--op GreaterThan  

--threshold 95 

--dimension "$dim1" "$dim2"

Build a dynamic condition.

$condition = az monitor metrics alert condition create -t dynamic 

--aggregation Average 

--metric "CPU Percentage" 

--op GreaterOrLessThan 

--num-violations 4 

--num-periods 4 

--since 2020-11-02T12:11

Required Parameters

--aggregation

Time aggregation.

Accepted values: Average, Count, Maximum, Minimum, Total
--metric

Name of the metric to base the rule on.

Value from: az monitor metrics list-definitions
--op --operator

Operator for static threshold can be 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan' or 'LessThanOrEqual'. Operator for dynamic threshold can be 'GreaterThan', 'LessThan', 'GreaterOrLessThan'.

Accepted values: Equals, GreaterOrLessThan, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals
--type -t

Type of condition threshold.

Accepted values: dynamic, static

Optional Parameters

--dimension

Dimension created by 'az monitor metrics alert dimension create'.

--namespace

Namespace of metric.

--num-periods

The number of evaluation periods for dynamic threshold. Range: 1-6.

--num-violations

The number of violations to trigger an dynamic alert. Range: 1-6. It should be less than or equal to --num-periods.

--sensitivity

Alert sensitivity for dynamic threshold.

Accepted values: High, Low, Medium
Default value: Medium
--since

The date from which to start learning the metric historical data and calculate the dynamic thresholds. Format: date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm).

--skip-metric-validation

Cause the metric validation to be skipped. This allows to use a metric that has not been emitted yet.

Accepted values: false, true
--threshold

Static threshold value.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.