az monitor scheduled-query

Note

このリファレンスは、Azure CLI (バージョン 2.54.0 以降) のスケジュールされたクエリ拡張機能の一部です。 拡張機能は、az monitor scheduled-query コマンドを初めて実行するときに自動的にインストールされます。 拡張機能の詳細をご覧ください。

スケジュールされたクエリを管理するコマンド。

コマンド

名前 説明 Status
az monitor scheduled-query create

スケジュールされたクエリを作成します。

拡張子 GA
az monitor scheduled-query delete

スケジュールされたクエリを削除します。

拡張子 GA
az monitor scheduled-query list

スケジュールされたすべてのクエリを一覧表示します。

拡張子 GA
az monitor scheduled-query show

スケジュールされたクエリの詳細を表示します。

拡張子 GA
az monitor scheduled-query update

スケジュールされたクエリを更新します。

拡張子 GA

az monitor scheduled-query create

スケジュールされたクエリを作成します。

az monitor scheduled-query create --condition
                                  --name
                                  --resource-group
                                  --scopes
                                  [--action-groups]
                                  [--auto-mitigate {false, true}]
                                  [--check-ws-alerts-storage {false, true}]
                                  [--condition-query]
                                  [--custom-properties]
                                  [--description]
                                  [--disabled {false, true}]
                                  [--evaluation-frequency]
                                  [--location]
                                  [--mad]
                                  [--severity]
                                  [--skip-query-validation {false, true}]
                                  [--tags]
                                  [--target-resource-type]
                                  [--window-size]

VM のスケジュールされたクエリを作成します。

az monitor scheduled-query create -g {rg} -n {name1} --scopes {vm_id} --condition "count 'Placeholder_1' > 360 resource id _ResourceId at least 1 violations out of 5 aggregated points" --condition-query Placeholder_1="union Event, Syslog | where TimeGenerated > ago(1h) | where EventLevelName=='Error' or SeverityLevel=='err'" --description "Test rule"

リソース グループ内の VM のスケジュールされたクエリを作成します。

az monitor scheduled-query create -g {rg} -n {name1} --scopes {rg_id} --condition "count 'Placeholder_1' > 360 resource id _ResourceId at least 1 violations out of 5 aggregated points" --condition-query Placeholder_1="union Event, Syslog | where TimeGenerated > ago(1h) | where EventLevelName=='Error' or SeverityLevel=='err'" --description "Test rule"

必須のパラメーター

--condition

ルールをトリガーする条件。

使用法: --condition {avg,min,max,total,count} ["METRIC COLUMN" from] "QUERY_PLACEHOLDER" {=,!=,,>>=,=,<<=}THRESHOLD [resource id RESOURCEID] [where DIMENSION {includes,excludes} VALUE [or VALUE ...][AND DIMENSION {includes,excludes} VALUE [or VALUE ...] ...]][EvaluationPeriod 集計ポイントから少なくとも MinTimeToFail 違反]' クエリ プレースホルダーは、--condition-query 引数で定義できます。ディメンションは 、"where" キーワード (keyword)を追加することでクエリを実行でき、複数のディメンションを 'and' キーワード (keyword)と組み合わせてクエリできます。

--name -n

スケジュールされたクエリ ルールの名前。

--resource-group -g

リソース グループの名前。 az configure --defaults group=<name> を使用して、既定のグループを構成できます。

--scopes

ルールが適用されるスコープのスペース区切りの一覧。 このパラメーターで指定するリソースは、同じ型で、同じ場所に存在する必要があります。

省略可能のパラメーター

--action-groups

アラートが発生したときに呼び出すアクション グループ リソース ID。

使用法: --action-groups ACTION_GROUP_NAME_OR_ID [NAME_OR_ID,...]。

--auto-mitigate

アラートを自動的に解決するかどうかを示すフラグ。 既定値は true です。

承認された値: false, true
既定値: True
--check-ws-alerts-storage --cwas

このスケジュールされたクエリ ルールを顧客のストレージに格納するかどうかを示すフラグ。

承認された値: false, true
既定値: False
--condition-query

引数内 --condition のプレースホルダーを置き換えるには、クエリを実行します。

--custom-properties

アラート ペイロードのプロパティ。

使用法: --custom-properties ALERT_PAYLOAD_PROPERTIES [KEY=VAL,KEY=VAL ...].

--description

ルールの自由テキストの説明。

--disabled

スケジュールされたクエリを無効にします。

承認された値: false, true
既定値: False
--evaluation-frequency

"##h##m##s" 形式でルールを評価する頻度。

既定値: 5m
--location -l

Location。 値のソース: az account list-locations az configure --defaults location=<location> を使用して、既定の場所を構成できます。

--mad --mute-actions-duration

アラートが発生した後、選択した期間 (ISO 8601 期間形式) のアクションをミュートします。

--severity

アラートの重大度が 0 (重大) から 4 (詳細) です。

既定値: 2
--skip-query-validation

指定されたクエリを検証するかどうかを示すフラグ。

承認された値: false, true
既定値: False
--tags

スペース区切りのタグ: key[=value] [key[=value] ...]既存のタグをクリアするには、"" を使用します。

--target-resource-type --type

スコープ内のターゲット リソースのリソースの種類。 これは、スコープがリソース グループまたはサブスクリプションである場合に指定する必要があります。

--window-size

メトリックを "##h##m##s" 形式で集計する時間。

既定値: 5m
グローバル パラメーター
--debug

すべてのデバッグ ログを表示するようにログの詳細レベルを上げます。

--help -h

このヘルプ メッセージを表示して終了します。

--only-show-errors

エラーのみを表示し、警告は抑制します。

--output -o

出力形式。

承認された値: json, jsonc, none, table, tsv, yaml, yamlc
既定値: json
--query

JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ をご覧ください。

--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

--verbose

ログの詳細レベルを上げます。 詳細なデバッグ ログを表示するには --debug を使います。

az monitor scheduled-query delete

スケジュールされたクエリを削除します。

az monitor scheduled-query delete [--ids]
                                  [--name]
                                  [--resource-group]
                                  [--subscription]
                                  [--yes]

省略可能のパラメーター

--ids

1 つまたは複数のリソース ID (スペース区切り)。 これは、'Resource Id' 引数のすべての情報を含む完全なリソース ID である必要があります。 --ids または他の 'Resource Id' 引数を指定する必要があります。

--name -n

スケジュールされたクエリ ルールの名前。

--resource-group -g

リソース グループの名前。 az configure --defaults group=<name> を使用して、既定のグループを構成できます。

--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

--yes -y

確認のダイアログを表示しません。

既定値: False
グローバル パラメーター
--debug

すべてのデバッグ ログを表示するようにログの詳細レベルを上げます。

--help -h

このヘルプ メッセージを表示して終了します。

--only-show-errors

エラーのみを表示し、警告は抑制します。

--output -o

出力形式。

承認された値: json, jsonc, none, table, tsv, yaml, yamlc
既定値: json
--query

JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ をご覧ください。

--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

--verbose

ログの詳細レベルを上げます。 詳細なデバッグ ログを表示するには --debug を使います。

az monitor scheduled-query list

スケジュールされたすべてのクエリを一覧表示します。

az monitor scheduled-query list [--resource-group]

省略可能のパラメーター

--resource-group -g

リソース グループの名前。 az configure --defaults group=<name> を使用して、既定のグループを構成できます。

グローバル パラメーター
--debug

すべてのデバッグ ログを表示するようにログの詳細レベルを上げます。

--help -h

このヘルプ メッセージを表示して終了します。

--only-show-errors

エラーのみを表示し、警告は抑制します。

--output -o

出力形式。

承認された値: json, jsonc, none, table, tsv, yaml, yamlc
既定値: json
--query

JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ をご覧ください。

--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

--verbose

ログの詳細レベルを上げます。 詳細なデバッグ ログを表示するには --debug を使います。

az monitor scheduled-query show

スケジュールされたクエリの詳細を表示します。

az monitor scheduled-query show [--ids]
                                [--name]
                                [--resource-group]
                                [--subscription]

省略可能のパラメーター

--ids

1 つまたは複数のリソース ID (スペース区切り)。 これは、'Resource Id' 引数のすべての情報を含む完全なリソース ID である必要があります。 --ids または他の 'Resource Id' 引数を指定する必要があります。

--name -n

スケジュールされたクエリ ルールの名前。

--resource-group -g

リソース グループの名前。 az configure --defaults group=<name> を使用して、既定のグループを構成できます。

--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

グローバル パラメーター
--debug

すべてのデバッグ ログを表示するようにログの詳細レベルを上げます。

--help -h

このヘルプ メッセージを表示して終了します。

--only-show-errors

エラーのみを表示し、警告は抑制します。

--output -o

出力形式。

承認された値: json, jsonc, none, table, tsv, yaml, yamlc
既定値: json
--query

JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ をご覧ください。

--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

--verbose

ログの詳細レベルを上げます。 詳細なデバッグ ログを表示するには --debug を使います。

az monitor scheduled-query update

スケジュールされたクエリを更新します。

az monitor scheduled-query update [--action-groups]
                                  [--add]
                                  [--auto-mitigate {false, true}]
                                  [--check-ws-alerts-storage {false, true}]
                                  [--condition]
                                  [--condition-query]
                                  [--custom-properties]
                                  [--description]
                                  [--disabled {false, true}]
                                  [--evaluation-frequency]
                                  [--force-string]
                                  [--ids]
                                  [--mad]
                                  [--name]
                                  [--remove]
                                  [--resource-group]
                                  [--set]
                                  [--severity]
                                  [--skip-query-validation {false, true}]
                                  [--subscription]
                                  [--tags]
                                  [--target-resource-type]
                                  [--window-size]

省略可能のパラメーター

--action-groups

アラートが発生したときに呼び出すアクション グループ リソース ID。

--add

パスとキー値のペアを指定して、オブジェクトの一覧にオブジェクトを追加します。 例: --add property.listProperty <key=value, string or JSON string>

既定値: []
--auto-mitigate

アラートを自動的に解決するかどうかを示すフラグ。 既定値は true です。

承認された値: false, true
--check-ws-alerts-storage --cwas

このスケジュールされたクエリ ルールを顧客のストレージに格納するかどうかを示すフラグ。

承認された値: false, true
--condition

ルールをトリガーする条件。

使用法: --condition {avg,min,max,total,count} ["METRIC COLUMN" from] "QUERY_PLACEHOLDER" {=,!=,,>>=,=,<<=}THRESHOLD [resource id RESOURCEID] [where DIMENSION {includes,excludes} VALUE [or VALUE ...][AND DIMENSION {includes,excludes} VALUE [or VALUE ...] ...]][EvaluationPeriod 集計ポイントから少なくとも MinTimeToFail 違反]'

クエリ プレースホルダーは、--condition-query 引数で定義できます。ディメンションは 、"where" キーワード (keyword)を追加することでクエリできます。また、複数のディメンションを 'and' キーワード (keyword)と組み合わせることによってクエリを実行できます。

--condition-query

引数内 --condition のプレースホルダーを置き換えるには、クエリを実行します。

--custom-properties

アラート ペイロードのプロパティ。

使用法: --custom-properties ALERT_PAYLOAD_PROPERTIES [KEY=VAL,KEY=VAL ...].

--description

ルールの自由テキストの説明。

--disabled

スケジュールされたクエリを無効にします。

承認された値: false, true
--evaluation-frequency

"##h##m##s" 形式でルールを評価する頻度。

--force-string

'set' または 'add' を使用する場合は、JSON に変換するのではなく、文字列リテラルを保持します。

既定値: False
--ids

1 つまたは複数のリソース ID (スペース区切り)。 これは、'Resource Id' 引数のすべての情報を含む完全なリソース ID である必要があります。 --ids または他の 'Resource Id' 引数を指定する必要があります。

--mad --mute-actions-duration

アラートが発生した後、選択した期間 (ISO 8601 期間形式) のアクションをミュートします。

--name -n

スケジュールされたクエリ ルールの名前。

--remove

リストからプロパティまたは要素を削除します。 例: --remove property.list <indexToRemove> OR --remove propertyToRemove.

既定値: []
--resource-group -g

リソース グループの名前。 az configure --defaults group=<name> を使用して、既定のグループを構成できます。

--set

設定するプロパティ パスと値を指定して、オブジェクトを更新します。 例: --set property1.property2=<value>

既定値: []
--severity

アラートの重大度が 0 (重大) から 4 (詳細) です。

--skip-query-validation

指定されたクエリを検証するかどうかを示すフラグ。

承認された値: false, true
--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

--tags

スペース区切りのタグ: key[=value] [key[=value] ...]既存のタグをクリアするには、"" を使用します。

--target-resource-type --type

スコープ内のターゲット リソースのリソースの種類。 これは、スコープがリソース グループまたはサブスクリプションである場合に指定する必要があります。

--window-size

メトリックを "##h##m##s" 形式で集計する時間。

グローバル パラメーター
--debug

すべてのデバッグ ログを表示するようにログの詳細レベルを上げます。

--help -h

このヘルプ メッセージを表示して終了します。

--only-show-errors

エラーのみを表示し、警告は抑制します。

--output -o

出力形式。

承認された値: json, jsonc, none, table, tsv, yaml, yamlc
既定値: json
--query

JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ をご覧ください。

--subscription

サブスクリプションの名前または ID。 az account set -s NAME_OR_ID を使用して、既定のサブスクリプションを構成できます。

--verbose

ログの詳細レベルを上げます。 詳細なデバッグ ログを表示するには --debug を使います。