共用方式為


az monitor autoscale rule

管理自動調整調整規則。

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

命令

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

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

核心 加語
az monitor autoscale rule create

新增自動調整規則。

核心 加語
az monitor autoscale rule delete

從配置檔中移除自動調整規則。

核心 加語
az monitor autoscale rule list

列出配置檔的自動調整規則。

核心 加語

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

新增自動調整規則。

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"

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

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 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。