Share via


az monitor metrics alert condition

管理近乎即時的計量警示規則條件。

命令

名稱 Description 類型 狀態
az monitor metrics alert condition create

建置計量警示規則條件。

核心 預覽版

az monitor metrics alert condition create

預覽

此命令處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

建置計量警示規則條件。

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]

範例

建置靜態條件。

$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"

建置動態條件。

$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

必要參數

--aggregation

時間匯總。

接受的值: Average, Count, Maximum, Minimum, Total
--metric

要根據規則的計量名稱。

值來自: az monitor metrics list-definitions
--op --operator

靜態閾值的運算子可以是 'Equals'、'NotEquals'、'GreaterThan'、'GreaterThanOrEqual'、'LessThan' 或 'LessThanOrEqual'。 動態閾值的運算子可以是 'GreaterThan'、'LessThan'、'GreaterOrLessThan'。

接受的值: Equals, GreaterOrLessThan, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals
--type -t

條件閾值的類型。

接受的值: dynamic, static

選擇性參數

--dimension

'az monitor metrics alert dimension create' 所建立的維度。

--namespace

計量的命名空間。

--num-periods

動態閾值的評估期間數目。 範圍:1-6。

--num-violations

觸發動態警示的違規次數。 範圍:1-6。 它應該小於或等於 --num-periods。

--sensitivity

動態閾值的警示敏感度。

接受的值: High, Low, Medium
預設值: Medium
--since

開始學習計量歷程記錄資料的日期,並計算動態閾值。 格式:date(yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm)。

--skip-metric-validation

導致略過計量驗證。 這可讓您使用尚未發出的計量。

接受的值: false, true
--threshold

靜態臨界值。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。