Microsoft.Insights scheduledQueryRules 2018-04-16

Bicep リソース定義

scheduledQueryRules リソースの種類は、次を対象とする操作でデプロイできます。

各 API バージョンの変更されたプロパティの一覧については、「 変更ログ」を参照してください。

解説

監視ソリューションのデプロイに関するガイダンスについては、「 Bicep を使用して監視リソースを作成する」を参照してください。

リソース形式

Microsoft.Insights/scheduledQueryRules リソースを作成するには、次の Bicep をテンプレートに追加します。

resource symbolicname 'Microsoft.Insights/scheduledQueryRules@2018-04-16' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  properties: {
    action: {
      'odata.type': 'string'
      // For remaining properties, see Action objects
    }
    autoMitigate: bool
    description: 'string'
    displayName: 'string'
    enabled: 'string'
    schedule: {
      frequencyInMinutes: int
      timeWindowInMinutes: int
    }
    source: {
      authorizedResources: [
        'string'
      ]
      dataSourceId: 'string'
      query: 'string'
      queryType: 'ResultCount'
    }
  }
}

アクション オブジェクト

オブジェクトの種類を指定するには 、odata.type プロパティを設定します。

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction の場合は、次の値を使用します。

  'odata.type': 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction'
  aznsAction: {
    actionGroup: [
      'string'
    ]
    customWebhookPayload: 'string'
    emailSubject: 'string'
  }
  severity: 'string'
  throttlingInMin: int
  trigger: {
    metricTrigger: {
      metricColumn: 'string'
      metricTriggerType: 'string'
      threshold: int
      thresholdOperator: 'string'
    }
    threshold: int
    thresholdOperator: 'string'
  }

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction の場合は、次の値を使用します。

  'odata.type': 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction'
  criteria: [
    {
      dimensions: [
        {
          name: 'string'
          operator: 'Include'
          values: [
            'string'
          ]
        }
      ]
      metricName: 'string'
    }
  ]

プロパティ値

scheduledQueryRules

名前 説明
name リソース名 string (必須)

文字数制限: 1 から 260

有効な文字:
次は使用できません:
`:<>+/&%\?` または制御文字

末尾をスペースまたはピリオドにすることはできません。
location リソースの場所 string (必須)
tags リソース タグ タグ名と値のディクショナリ。 「テンプレートのタグ」を参照してください
properties リソースのルール プロパティ。 LogSearchRule (必須)

LogSearchRule

名前 説明
action ルールの実行に対してアクションを実行する必要があります。 アクション (必須)
autoMitigate アラートを自動的に解決するかどうかを示すフラグ。 既定値は false です。 [bool]
description ログ検索ルールの説明。 string
displayName アラート ルールの表示名 string
enabled ログ検索ルールが有効かどうかを示すフラグ。 値は true または false にする必要があります 'false'
'true'
schedule ルールのスケジュール (頻度、時間枠)。 アクションの種類に必須 - AlertingAction [スケジュール]
source データのクエリを実行するルールに対するデータ ソース ソース (必須)

アクション

名前 説明
odata.type オブジェクトの種類を設定する Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction
Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction (必須)

AlertingAction

名前 説明
odata.type アクションを指定します。 サポートされている値 - AlertingAction、LogToMetricAction 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' (必須)
aznsAction Azure アクション グループリファレンス。 AzNsActionGroup
severity アラートの重大度 '0'
'1'
'2'
'3'
'4' (必須)
throttlingInMin アラートを調整または抑制する必要がある時間 (分単位)。 INT
トリガー (trigger) アラート ルールが発生するトリガー条件。 TriggerCondition (必須)

AzNsActionGroup

名前 説明
actionGroup Azure Action Group リファレンス。 string[]
customWebhookPayload Azure アクション グループ内のすべての Webhook URI に対して送信されるカスタム ペイロード string
emailSubject Azure アクション グループ内のすべての電子メール ID のカスタム件名のオーバーライド string

triggerCondition

名前 説明
metricTrigger メトリック クエリ ルールのトリガー条件 LogMetricTrigger
threshold トリガーする必要があるルールに基づく結果またはカウントのしきい値。 int (必須)
thresholdOperator ルールの評価操作 - 'GreaterThan' または 'LessThan。 'Equal'
'GreaterThan'
'GreaterThanOrEqual'
'LessThan'
'LessThanOrEqual' (必須)

LogMetricTrigger

名前 説明
metricColumn 特定の列のメトリックの評価 string
metricTriggerType メトリック トリガーの種類 - "連続" または "合計" 'Consecutive'
'Total'
threshold メトリック トリガーのしきい値。 INT
thresholdOperator メトリック -'GreaterThan' または 'LessThan' または 'Equal' の評価操作。 'Equal'
'GreaterThan'
'GreaterThanOrEqual'
'LessThan'
'LessThanOrEqual'

LogToMetricAction

名前 説明
odata.type アクションを指定します。 サポートされている値 - AlertingAction、LogToMetricAction 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' (必須)
条件 メトリックの条件 Criteria[] (必須)

条件

名前 説明
dimensions メトリックを作成するためのディメンションの一覧 Dimension[]
metricName メトリックの名前 string (必須)

Dimension

名前 説明
name ディメンションの名前 string (必須)
operator ディメンション値の演算子 'Include' (必須)
ディメンション値の一覧 string[] (必須)

スケジュール

名前 説明
frequencyInMinutes ルールの条件を評価する頻度 (分単位)。 int (必須)
timeWindowInMinutes クエリのデータをフェッチする必要がある時間枠 (frequencyInMinutes 以上にする必要があります)。 int (必須)

source

名前 説明
authorizedResources クエリに参照されるリソースの一覧 string[]
dataSourceId ログ検索クエリを実行するリソース URI。 string (必須)
query ログ検索クエリ。 アクションの種類に必須 - AlertingAction string
queryType 値を 'ResultCount' に設定します。 'ResultCount'

ARM テンプレート リソース定義

scheduledQueryRules リソースの種類は、次をターゲットとする操作と共にデプロイできます。

各 API バージョンの変更されたプロパティの一覧については、「 変更ログ」を参照してください。

解説

監視ソリューションのデプロイに関するガイダンスについては、「 Bicep を使用して監視リソースを作成する」を参照してください。

リソース形式

Microsoft.Insights/scheduledQueryRules リソースを作成するには、次の JSON をテンプレートに追加します。

{
  "type": "Microsoft.Insights/scheduledQueryRules",
  "apiVersion": "2018-04-16",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "properties": {
    "action": {
      "odata.type": "string"
      // For remaining properties, see Action objects
    },
    "autoMitigate": "bool",
    "description": "string",
    "displayName": "string",
    "enabled": "string",
    "schedule": {
      "frequencyInMinutes": "int",
      "timeWindowInMinutes": "int"
    },
    "source": {
      "authorizedResources": [ "string" ],
      "dataSourceId": "string",
      "query": "string",
      "queryType": "ResultCount"
    }
  }
}

Action オブジェクト

オブジェクトの種類を指定するには、 odata.type プロパティを設定します。

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction の場合は、次の値を使用します。

  "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
  "aznsAction": {
    "actionGroup": [ "string" ],
    "customWebhookPayload": "string",
    "emailSubject": "string"
  },
  "severity": "string",
  "throttlingInMin": "int",
  "trigger": {
    "metricTrigger": {
      "metricColumn": "string",
      "metricTriggerType": "string",
      "threshold": "int",
      "thresholdOperator": "string"
    },
    "threshold": "int",
    "thresholdOperator": "string"
  }

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction の場合は、次の値を使用します。

  "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction",
  "criteria": [
    {
      "dimensions": [
        {
          "name": "string",
          "operator": "Include",
          "values": [ "string" ]
        }
      ],
      "metricName": "string"
    }
  ]

プロパティ値

scheduledQueryRules

名前 説明
type リソースの種類 'Microsoft.Insights/scheduledQueryRules'
apiVersion リソース API のバージョン '2018-04-16'
name リソース名 string (必須)

文字制限: 1 から 260

有効な文字:
次は使用できません:
`:<>+/&%\?` または制御文字

末尾をスペースまたはピリオドにすることはできません。
location リソースの場所 string (必須)
tags リソース タグ タグの名前と値のディクショナリ。 「テンプレート内のタグ」を参照してください
properties リソースのルール プロパティ。 LogSearchRule (必須)

LogSearchRule

名前 説明
action ルールの実行に対してアクションを実行する必要があります。 アクション (必須)
autoMitigate アラートを自動的に解決するかどうかを示すフラグ。 既定値は false です。 [bool]
description ログ検索ルールの説明。 string
displayName アラート ルールの表示名 string
enabled ログ検索ルールが有効かどうかを示すフラグ。 値は true または false にする必要があります 'false'
'true'
schedule ルールのスケジュール (頻度、時間枠)。 アクションの種類に必須 - AlertingAction [スケジュール]
source データ のクエリを実行するルールに対するデータ ソース ソース (必須)

アクション

名前 説明
odata.type オブジェクトの種類を設定する Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction
Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction (必須)

AlertingAction

名前 説明
odata.type アクションを指定します。 サポートされている値 - AlertingAction、LogToMetricAction 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' (必須)
aznsAction Azure アクション グループ リファレンス。 AzNsActionGroup
severity アラートの重大度 '0'
'1'
'2'
'3'
'4' (必須)
throttlingInMin アラートを調整または抑制する必要がある時間 (分単位)。 INT
トリガー (trigger) アラート ルールが発生するトリガー条件。 TriggerCondition (必須)

AzNsActionGroup

名前 説明
actionGroup Azure Action Group リファレンス。 string[]
customWebhookPayload Azure アクション グループ内のすべての Webhook URI に対して送信されるカスタム ペイロード string
emailSubject Azure アクション グループ内のすべての電子メール ID のカスタム件名のオーバーライド string

triggerCondition

名前 説明
metricTrigger メトリック クエリ ルールのトリガー条件 LogMetricTrigger
threshold トリガーする必要があるルールに基づく結果またはカウントのしきい値。 int (必須)
thresholdOperator ルールの評価操作 - 'GreaterThan' または 'LessThan。 'Equal'
'GreaterThan'
'GreaterThanOrEqual'
'LessThan'
'LessThanOrEqual' (必須)

LogMetricTrigger

名前 説明
metricColumn 特定の列のメトリックの評価 string
metricTriggerType メトリック トリガーの種類 - "連続" または "合計" 'Consecutive'
'Total'
threshold メトリック トリガーのしきい値。 INT
thresholdOperator メトリック -'GreaterThan' または 'LessThan' または 'Equal' の評価操作。 'Equal'
'GreaterThan'
'GreaterThanOrEqual'
'LessThan'
'LessThanOrEqual'

LogToMetricAction

名前 説明
odata.type アクションを指定します。 サポートされている値 - AlertingAction、LogToMetricAction 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' (必須)
条件 メトリックの条件 Criteria[] (必須)

条件

名前 説明
dimensions メトリックを作成するためのディメンションの一覧 Dimension[]
metricName メトリックの名前 string (必須)

Dimension

名前 説明
name ディメンションの名前 string (必須)
operator ディメンション値の演算子 'Include' (必須)
ディメンション値の一覧 string[] (必須)

スケジュール

名前 説明
frequencyInMinutes ルールの条件を評価する頻度 (分単位)。 int (必須)
timeWindowInMinutes クエリのデータをフェッチする必要がある時間枠 (frequencyInMinutes 以上にする必要があります)。 int (必須)

source

名前 説明
authorizedResources クエリに参照されるリソースの一覧 string[]
dataSourceId ログ検索クエリを実行するリソース URI。 string (必須)
query ログ検索クエリ。 アクションの種類に必須 - AlertingAction string
queryType 値を 'ResultCount' に設定します。 'ResultCount'

Terraform (AzAPI プロバイダー) リソース定義

scheduledQueryRules リソースの種類は、次をターゲットとする操作と共にデプロイできます。

  • リソース グループ

各 API バージョンの変更されたプロパティの一覧については、「 変更ログ」を参照してください。

リソース形式

Microsoft.Insights/scheduledQueryRules リソースを作成するには、次の Terraform をテンプレートに追加します。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Insights/scheduledQueryRules@2018-04-16"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      action = {
        odata.type = "string"
        // For remaining properties, see Action objects
      }
      autoMitigate = bool
      description = "string"
      displayName = "string"
      enabled = "string"
      schedule = {
        frequencyInMinutes = int
        timeWindowInMinutes = int
      }
      source = {
        authorizedResources = [
          "string"
        ]
        dataSourceId = "string"
        query = "string"
        queryType = "ResultCount"
      }
    }
  })
}

Action オブジェクト

オブジェクトの種類を指定するには、 odata.type プロパティを設定します。

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction の場合は、次の値を使用します。

  odata.type = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction"
  aznsAction = {
    actionGroup = [
      "string"
    ]
    customWebhookPayload = "string"
    emailSubject = "string"
  }
  severity = "string"
  throttlingInMin = int
  trigger = {
    metricTrigger = {
      metricColumn = "string"
      metricTriggerType = "string"
      threshold = int
      thresholdOperator = "string"
    }
    threshold = int
    thresholdOperator = "string"
  }

Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction の場合は、次の値を使用します。

  odata.type = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction"
  criteria = [
    {
      dimensions = [
        {
          name = "string"
          operator = "Include"
          values = [
            "string"
          ]
        }
      ]
      metricName = "string"
    }
  ]

プロパティ値

scheduledQueryRules

名前 説明
type リソースの種類 "Microsoft.Insights/scheduledQueryRules@2018-04-16"
name リソース名 string (必須)

文字制限: 1 から 260

有効な文字:
次は使用できません:
`:<>+/&%\?` または制御文字

末尾をスペースまたはピリオドにすることはできません。
location リソースの場所 string (必須)
parent_id リソース グループにデプロイするには、そのリソース グループの ID を使用します。 string (必須)
tags リソース タグ タグの名前と値のディクショナリ。
properties リソースのルール プロパティ。 LogSearchRule (必須)

LogSearchRule

名前 説明
action ルールの実行に対してアクションを実行する必要があります。 アクション (必須)
autoMitigate アラートを自動的に解決するかどうかを示すフラグ。 既定値は false です。 [bool]
description ログ検索ルールの説明。 string
displayName アラート ルールの表示名 string
enabled ログ検索ルールが有効かどうかを示すフラグ。 値は true または false にする必要があります "false"
"true"
schedule ルールのスケジュール (頻度、時間枠)。 アクションの種類に必須 - AlertingAction [スケジュール]
source データ のクエリを実行するルールに対するデータ ソース ソース (必須)

アクション

名前 説明
odata.type オブジェクトの種類を設定する Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction
Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction (必須)

AlertingAction

名前 説明
odata.type アクションを指定します。 サポートされている値 - AlertingAction、LogToMetricAction "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" (必須)
aznsAction Azure アクション グループリファレンス。 AzNsActionGroup
severity アラートの重大度 "0"
"1"
"2"
"3"
"4" (必須)
throttlingInMin アラートを調整または抑制する必要がある時間 (分単位)。 INT
トリガー (trigger) アラート ルールが発生するトリガー条件。 TriggerCondition (必須)

AzNsActionGroup

名前 説明
actionGroup Azure Action Group リファレンス。 string[]
customWebhookPayload Azure アクション グループ内のすべての Webhook URI に対して送信されるカスタム ペイロード string
emailSubject Azure アクション グループ内のすべての電子メール ID のカスタム件名のオーバーライド string

triggerCondition

名前 説明
metricTrigger メトリック クエリ ルールのトリガー条件 LogMetricTrigger
threshold トリガーする必要があるルールに基づく結果またはカウントのしきい値。 int (必須)
thresholdOperator ルールの評価操作 - 'GreaterThan' または 'LessThan。 "等しい"
"GreaterThan"
"GreaterThanOrEqual"
"LessThan"
"LessThanOrEqual" (必須)

LogMetricTrigger

名前 説明
metricColumn 特定の列のメトリックの評価 string
metricTriggerType メトリック トリガーの種類 - "連続" または "合計" "Consecutive"
"Total"
threshold メトリック トリガーのしきい値。 INT
thresholdOperator メトリック -'GreaterThan' または 'LessThan' または 'Equal' の評価操作。 "等しい"
"GreaterThan"
"GreaterThanOrEqual"
"LessThan"
"LessThanOrEqual"

LogToMetricAction

名前 説明
odata.type アクションを指定します。 サポートされている値 - AlertingAction、LogToMetricAction "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" (必須)
条件 メトリックの条件 Criteria[] (必須)

条件

名前 説明
dimensions メトリックを作成するためのディメンションの一覧 Dimension[]
metricName メトリックの名前 string (必須)

Dimension

名前 説明
name ディメンションの名前 string (必須)
operator ディメンション値の演算子 "Include" (必須)
ディメンション値の一覧 string[] (必須)

スケジュール

名前 説明
frequencyInMinutes ルールの条件を評価する頻度 (分単位)。 int (必須)
timeWindowInMinutes クエリのデータをフェッチする必要がある時間枠 (frequencyInMinutes 以上にする必要があります)。 int (必須)

source

名前 説明
authorizedResources クエリに参照されるリソースの一覧 string[]
dataSourceId ログ検索クエリを実行するリソース URI。 string (必須)
query ログ検索クエリ。 アクションの種類に必須 - AlertingAction string
queryType 値を 'ResultCount' に設定します。 "ResultCount"