Share via


az monitor autoscale rule

管理自動調整調整規則。

如需自動調整的詳細資訊,請流覽: https://docs.microsoft.com/azure/monitoring-and-diagnostics/monitoring-understanding-autoscale-settings

命令

名稱 Description 類型 狀態
az monitor autoscale rule copy

將自動調整規則從一個配置檔案複製到另一個設定檔。

核心 GA
az monitor autoscale rule create

新增自動調整規則。

核心 GA
az monitor autoscale rule delete

從設定檔中移除自動調整規則。

核心 GA
az monitor autoscale rule list

列出設定檔的自動調整規則。

核心 GA

az monitor autoscale rule copy

將自動調整規則從一個配置檔案複製到另一個設定檔。

az monitor autoscale rule copy --autoscale-name
                               --dest-schedule
                               --index
                               --resource-group
                               [--source-schedule]

必要參數

--autoscale-name

自動調整設定的名稱。

--dest-schedule

要複製規則的設定檔名稱。

--index

要複製的規則索引以空格分隔的清單,或複製所有規則的 '*' 。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--source-schedule

要從中複製規則的設定檔名稱。

預設值: default
全域參數
--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 來取得完整偵錯記錄。

az monitor autoscale rule create

新增自動調整規則。

如需自動調整的詳細資訊,請流覽: https://docs.microsoft.com/azure/monitoring-and-diagnostics/monitoring-understanding-autoscale-settings

az monitor autoscale rule create --autoscale-name
                                 --condition
                                 --scale
                                 [--cooldown]
                                 [--profile-name]
                                 [--resource]
                                 [--resource-group]
                                 [--resource-namespace]
                                 [--resource-parent]
                                 [--resource-type]
                                 [--timegrain]

範例

當跨實例的 CPU 百分比大於 75 平均超過 10 分鐘時,調整為 5 個實例。

az monitor autoscale rule create -g {myrg} --autoscale-name {myvmss} \
  --scale to 5 --condition "Percentage CPU > 75 avg 10m"

當跨實例的 CPU 百分比大於 75 平均超過 5 分鐘時,相應增加 2 個實例。

az monitor autoscale rule create -g {myrg} --autoscale-name {myvmss} \
  --scale out 2 --condition "Percentage CPU > 75 avg 5m"

當跨實例的 CPU 百分比小於 25 平均超過 15 分鐘時,相應減少 50%。

az monitor autoscale rule create -g {myrg} --autoscale-name {myvmss} \
  --scale in 50% --condition "Percentage CPU < 25 avg 15m"

透過從診斷擴充功能啟用的客體 VM 計量建立自動調整設定。 您可以在 '--condition' 中使用從 'az vmss diagnostics get-default-config' 擷取的 counterSpecifier 欄位。

az monitor autoscale rule create -g {myrg} --autoscale-name test --scale out 1 --condition "/builtin/memory/percentavailablememory > 80 total 5m"

必要參數

--autoscale-name

自動調整設定的名稱。

--condition

觸發縮放動作的條件。

使用方式: --condition [「NAMESPACE」] METRIC {=,! > =,, > = < ,, < =} THRESHOLD {avg,min,max,total,count} PERIOD [where DIMENSION {==,!=} VALUE [or VALUE ...][and DIMENSION {==,!=} VALUE [or VALUE ...] ...]]

您可以藉由新增 'where' 關鍵字和多個維度來查詢維度,方法是結合 'and' 關鍵字來查詢維度。 您可以從 命令取得 az monitor metric METRIC 和適當 THRESHOLD 值的值。 PERIOD 的格式為 「##h##m##s」。

--scale

縮放的方向和數量。

使用量: --scale {to,in,out} VAL[%] 固定計數: --scale to 5 In by Count: --scale in 2 Out by Percent: --scale out 10%。

選擇性參數

--cooldown

必須經過的分鐘數,才能發生另一個調整事件。

預設值: 5
--profile-name

自動調整設定檔的名稱。

預設值: default
--resource

目標資源的名稱或識別碼。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--resource-namespace

目標資源提供者命名空間。

--resource-parent

如果適用,則以資源父路徑為目標。

--resource-type

目標資源類型。 也可以接受命名空間/類型格式(例如:'Microsoft.Compute/virtualMachines')。

--timegrain

計量在實例之間輪詢的方式。

timegrain 的格式為 {avg,min,max,sum} VALUE。 您可以從 命令取得 az monitor metric 值。 VALUE 的格式為 「##h##m##s」。

預設值: avg 1m
全域參數
--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 來取得完整偵錯記錄。

az monitor autoscale rule delete

從設定檔中移除自動調整規則。

az monitor autoscale rule delete --autoscale-name
                                 --index
                                 --resource-group
                                 [--profile-name]

必要參數

--autoscale-name

自動調整設定的名稱。

--index

要移除的規則索引以空格分隔的清單,或 '*' 以清除所有規則。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--profile-name

自動調整設定檔的名稱。

預設值: default
全域參數
--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 來取得完整偵錯記錄。

az monitor autoscale rule list

列出設定檔的自動調整規則。

az monitor autoscale rule list --autoscale-name
                               --resource-group
                               [--profile-name]

範例

列出設定檔的自動調整規則。 (自動產生)

az monitor autoscale rule list --autoscale-name MyAutoscale --profile-name MyProfile --resource-group MyResourceGroup

必要參數

--autoscale-name

自動調整設定的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--profile-name

自動調整設定檔的名稱。

預設值: default
全域參數
--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 來取得完整偵錯記錄。