Scheduled Query Rules - Update

更新排程的查詢規則。

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}?api-version=2021-08-01

URI 參數

名稱 位於 必要 類型 Description
resourceGroupName
path True

string

資源群組的名稱。 名稱不區分大小寫。

ruleName
path True

string

規則的名稱。

subscriptionId
path True

string

目標訂用帳戶的標識碼。

api-version
query True

string

用於此作業的 API 版本。

要求本文

名稱 類型 Description
properties.actions

Actions

警示引發時要叫用的動作。

properties.autoMitigate

boolean

旗標,指出是否應該自動解決警示。 預設值是 true。 僅適用於 LogAlert 類型的規則。

properties.checkWorkspaceAlertsStorageConfigured

boolean

旗標,指出是否應該將此排程查詢規則儲存在客戶的記憶體中。 預設值為 false。 僅適用於 LogAlert 類型的規則。

properties.criteria

ScheduledQueryRuleCriteria

定義排程查詢規則條件的規則準則。

properties.description

string

排程查詢規則的描述。

properties.displayName

string

警示規則的顯示名稱

properties.enabled

boolean

旗標,指出是否啟用此排程查詢規則。 值應為 true 或 false

properties.evaluationFrequency

string

以 ISO 8601 持續時間格式來評估排程查詢規則的頻率。 只有 LogAlert 類型的規則才相關且必要。

properties.muteActionsDuration

string

在引發警示之後,以 ISO 8601 持續時間格式 (將所選時段的動作設為靜音) 。 僅適用於 LogAlert 類型的規則。

properties.overrideQueryTimeRange

string

如果指定,則會覆寫查詢時間範圍, (預設值為 WindowSize*NumberOfEvaluationPeriods) 。 僅適用於 LogAlert 類型的規則。

properties.scopes

string[]

此排程查詢規則的範圍是資源標識碼的清單。

properties.severity

AlertSeverity

警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。

properties.skipQueryValidation

boolean

旗標,指出是否應該驗證提供的查詢。 預設值為 false。 僅適用於 LogAlert 類型的規則。

properties.targetResourceTypes

string[]

建立/更新警示的目標資源 () 的資源類型清單。 例如,如果範圍是資源群組,且 targetResourceTypes 是 Microsoft.Compute/virtualMachines,則會針對符合警示準則的資源群組中的每個虛擬機引發不同的警示。 僅適用於 LogAlert 類型的規則

properties.windowSize

string

ISO 8601 持續時間格式 (期間) ,警示查詢 (將在間隔大小) 執行。 只有 LogAlert 類型的規則才相關且必要。

tags

object

資源標籤

回應

名稱 類型 Description
200 OK

ScheduledQueryRuleResource

成功要求以更新排程的查詢規則

Other Status Codes

ErrorContract

描述作業失敗原因的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

Create or update a scheduled query rule

Sample Request

PATCH https://management.azure.com/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourceGroups/QueryResourceGroupName/providers/Microsoft.Insights/scheduledQueryRules/heartbeat?api-version=2021-08-01

{
  "properties": {
    "enabled": false
  }
}

Sample Response

{
  "id": "/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat",
  "name": "heartbeat",
  "type": "microsoft.insights/scheduledqueryrules",
  "location": "eastus",
  "tags": {},
  "properties": {
    "description": "Health check rule",
    "severity": 4,
    "enabled": false,
    "evaluationFrequency": "PT5M",
    "scopes": [
      "/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"
    ],
    "targetResourceTypes": [
      "Microsoft.Compute/virtualMachines"
    ],
    "windowSize": "PT10M",
    "criteria": {
      "allOf": [
        {
          "query": "Heartbeat",
          "timeAggregation": "Count",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 360,
          "failingPeriods": {
            "numberOfEvaluationPeriods": 1,
            "minFailingPeriodsToAlert": 1
          }
        }
      ]
    },
    "muteActionsDuration": "PT30M",
    "actions": {
      "actionGroups": [
        "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"
      ],
      "customProperties": {
        "key11": "value11",
        "key12": "value12"
      }
    },
    "autoMitigate": true,
    "isWorkspaceAlertsStorageConfigured": true,
    "checkWorkspaceAlertsStorageConfigured": true,
    "skipQueryValidation": true
  }
}

定義

名稱 Description
Actions

警示引發時要叫用的動作。

AlertSeverity

警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。

Condition

排程查詢規則的條件。

conditionOperator

criteria 運算子。 只有 LogAlert 類型的規則才相關且必要。

createdByType

建立資源的身分識別類型。

Dimension

維度分割和篩選定義

dimensionOperator

維度值的運算符

ErrorAdditionalInfo

資源管理錯誤其他資訊。

ErrorContract

描述錯誤回應的格式。

ErrorResponse

錯誤回應

FailingPeriods

在引發警示所需的所選回溯時間範圍內,所需的違規次數下限。 僅適用於 LogAlert 類型的規則。

Kind

指出排程查詢規則的類型。 預設值為LogAlert。

ScheduledQueryRuleCriteria

定義排程查詢規則條件的規則準則。

ScheduledQueryRuleResource

排程的查詢規則資源。

ScheduledQueryRuleResourcePatch

修補作業的排程查詢規則資源。

systemData

與建立和上次修改資源相關的元數據。

timeAggregation

匯總類型。 只有 LogAlert 類型的規則才相關且必要。

Actions

警示引發時要叫用的動作。

名稱 類型 Description
actionGroups

string[]

動作群組資源標識碼,以在警示引發時叫用。

customProperties

object

警示承載的屬性。

AlertSeverity

警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。

名稱 類型 Description
0

Integer

1

Integer

2

Integer

3

Integer

4

Integer

Condition

排程查詢規則的條件。

名稱 類型 Description
dimensions

Dimension[]

維度條件清單

failingPeriods

FailingPeriods

在引發警示所需的所選回溯時間範圍內,所需的違規次數下限。 僅適用於 LogAlert 類型的規則。

metricMeasureColumn

string

包含計量量值編號的數據行。 僅適用於 LogAlert 類型的規則。

metricName

string

要傳送之計量的名稱。 只有 LogToMetric 類型的規則才相關且必要。

operator

conditionOperator

criteria 運算子。 只有 LogAlert 類型的規則才相關且必要。

query

string

記錄查詢警示

resourceIdColumn

string

包含資源標識碼的數據行。數據行的內容必須是格式化為資源標識碼的 URI。僅適用於 LogAlert 類型的規則。

threshold

number

啟動警示的準則閾值。 只有 LogAlert 類型的規則才相關且必要。

timeAggregation

timeAggregation

匯總類型。 只有 LogAlert 類型的規則才相關且必要。

conditionOperator

criteria 運算子。 只有 LogAlert 類型的規則才相關且必要。

名稱 類型 Description
Equals

string

GreaterThan

string

GreaterThanOrEqual

string

LessThan

string

LessThanOrEqual

string

createdByType

建立資源的身分識別類型。

名稱 類型 Description
Application

string

Key

string

ManagedIdentity

string

User

string

Dimension

維度分割和篩選定義

名稱 類型 Description
name

string

維度的名稱

operator

dimensionOperator

維度值的運算符

values

string[]

維度值清單

dimensionOperator

維度值的運算符

名稱 類型 Description
Exclude

string

Include

string

ErrorAdditionalInfo

資源管理錯誤其他資訊。

名稱 類型 Description
info

object

其他資訊。

type

string

其他信息類型。

ErrorContract

描述錯誤回應的格式。

名稱 類型 Description
error

ErrorResponse

錯誤回應
錯誤詳細資料。

ErrorResponse

錯誤回應

名稱 類型 Description
additionalInfo

ErrorAdditionalInfo[]

錯誤其他資訊。

code

string

錯誤碼。

details

ErrorResponse[]

錯誤詳細資料。

message

string

錯誤訊息。

target

string

錯誤目標。

FailingPeriods

在引發警示所需的所選回溯時間範圍內,所需的違規次數下限。 僅適用於 LogAlert 類型的規則。

名稱 類型 預設值 Description
minFailingPeriodsToAlert

integer

1

觸發警示的違規次數。 應小於或等於 numberOfEvaluationPeriods。 預設值為 1

numberOfEvaluationPeriods

integer

1

匯總回溯點的數目。 回溯時間範圍是根據匯總數據粒度計算, (windowSize) 和選取的匯總點數目。 預設值為 1

Kind

指出排程查詢規則的類型。 預設值為LogAlert。

名稱 類型 Description
LogAlert

string

LogToMetric

string

ScheduledQueryRuleCriteria

定義排程查詢規則條件的規則準則。

名稱 類型 Description
allOf

Condition[]

要根據指定範圍評估的條件清單

ScheduledQueryRuleResource

排程的查詢規則資源。

名稱 類型 Description
etag

string

不需要 etag 欄位。 如果在回應本文中提供,也必須根據一般 etag 慣例提供它做為標頭。 實體標籤可用來比較來自相同要求資源的兩個或多個實體。 HTTP/1.1 會在 etag (節 14.19) 中使用實體標記,If-Match (第 14.24 節) 、If-None-Match (第 14.26 節) ,以及 If-Range (第 14.27 節) 標頭字段。

id

string

資源的完整資源識別碼。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

kind

Kind

指出已排程查詢規則的類型。 預設值為LogAlert。

location

string

資源所在的地理位置

name

string

資源的名稱

properties.actions

Actions

警示引發時要叫用的動作。

properties.autoMitigate

boolean

旗標,指出是否應該自動解決警示。 預設值是 true。 僅適用於 LogAlert 類型的規則。

properties.checkWorkspaceAlertsStorageConfigured

boolean

旗標,指出此排程的查詢規則是否應該儲存在客戶的記憶體中。 預設值為 false。 僅適用於 LogAlert 類型的規則。

properties.createdWithApiVersion

string

建立此警示規則時所使用的 API 版本

properties.criteria

ScheduledQueryRuleCriteria

定義排程查詢規則條件的規則準則。

properties.description

string

排程查詢規則的描述。

properties.displayName

string

警示規則的顯示名稱

properties.enabled

boolean

指出是否啟用此排程查詢規則的旗標。 值應為 true 或 false

properties.evaluationFrequency

string

排程查詢規則的評估頻率是以 ISO 8601 持續時間格式表示。 只有 LogAlert 類型的規則才相關且必要。

properties.isLegacyLogAnalyticsRule

boolean

True 是表示 如果警示規則是舊版 Log Analytic 規則

properties.isWorkspaceAlertsStorageConfigured

boolean

旗標,指出是否已將此排程的查詢規則設定為儲存在客戶的記憶體中。 預設值為 false。

properties.muteActionsDuration

string

在引發警示之後) ,以 ISO 8601 持續時間格式將所選時段的動作設為靜音 (。 僅適用於 LogAlert 類型的規則。

properties.overrideQueryTimeRange

string

如果指定,則會覆寫查詢時間範圍 (預設值為 WindowSize*NumberOfEvaluationPeriods) 。 僅適用於 LogAlert 類型的規則。

properties.scopes

string[]

此排程查詢規則的範圍為的資源標識碼清單。

properties.severity

AlertSeverity

警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。

properties.skipQueryValidation

boolean

旗標,指出是否應該驗證提供的查詢。 預設值為 false。 僅適用於 LogAlert 類型的規則。

properties.targetResourceTypes

string[]

建立/更新警示的目標資源 () 的資源類型清單。 例如,如果範圍是資源群組,而 targetResourceTypes 是 Microsoft.Compute/virtualMachines,則會針對符合警示準則的資源群組中的每個虛擬機引發不同的警示。 僅與 LogAlert 類型的規則相關

properties.windowSize

string

ISO 8601 持續時間格式 (期間) ,警示查詢將會執行 (間隔大小) 。 只有 LogAlert 類型的規則才相關且必要。

systemData

systemData

ScheduledQueryRule 的 SystemData。

tags

object

資源標籤。

type

string

資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”

ScheduledQueryRuleResourcePatch

修補作業的排程查詢規則資源。

名稱 類型 Description
properties.actions

Actions

警示引發時要叫用的動作。

properties.autoMitigate

boolean

旗標,指出是否應該自動解決警示。 預設值是 true。 僅適用於 LogAlert 類型的規則。

properties.checkWorkspaceAlertsStorageConfigured

boolean

旗標,指出此排程的查詢規則是否應該儲存在客戶的記憶體中。 預設值為 false。 僅適用於 LogAlert 類型的規則。

properties.createdWithApiVersion

string

建立此警示規則時所使用的 API 版本

properties.criteria

ScheduledQueryRuleCriteria

定義排程查詢規則條件的規則準則。

properties.description

string

排程查詢規則的描述。

properties.displayName

string

警示規則的顯示名稱

properties.enabled

boolean

指出是否啟用此排程查詢規則的旗標。 值應為 true 或 false

properties.evaluationFrequency

string

排程查詢規則的評估頻率是以 ISO 8601 持續時間格式表示。 只有 LogAlert 類型的規則才相關且必要。

properties.isLegacyLogAnalyticsRule

boolean

True 是表示 如果警示規則是舊版 Log Analytic 規則

properties.isWorkspaceAlertsStorageConfigured

boolean

旗標,指出是否已將此排程的查詢規則設定為儲存在客戶的記憶體中。 預設值為 false。

properties.muteActionsDuration

string

在引發警示之後) ,以 ISO 8601 持續時間格式將所選時段的動作設為靜音 (。 僅適用於 LogAlert 類型的規則。

properties.overrideQueryTimeRange

string

如果指定,則會覆寫查詢時間範圍 (預設值為 WindowSize*NumberOfEvaluationPeriods) 。 僅適用於 LogAlert 類型的規則。

properties.scopes

string[]

此排程查詢規則的範圍為的資源標識碼清單。

properties.severity

AlertSeverity

警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。

properties.skipQueryValidation

boolean

旗標,指出是否應該驗證提供的查詢。 預設值為 false。 僅適用於 LogAlert 類型的規則。

properties.targetResourceTypes

string[]

建立/更新警示的目標資源 () 的資源類型清單。 例如,如果範圍是資源群組,而 targetResourceTypes 是 Microsoft.Compute/virtualMachines,則會針對符合警示準則的資源群組中的每個虛擬機引發不同的警示。 僅與 LogAlert 類型的規則相關

properties.windowSize

string

ISO 8601 持續時間格式 (期間) ,警示查詢將會執行 (間隔大小) 。 只有 LogAlert 類型的規則才相關且必要。

tags

object

資源標籤

systemData

與建立和上次修改資源相關的元數據。

名稱 類型 Description
createdAt

string

資源建立的時間戳 (UTC) 。

createdBy

string

建立資源的身分識別。

createdByType

createdByType

建立資源的身分識別類型。

lastModifiedAt

string

上次修改的資源時間戳 (UTC)

lastModifiedBy

string

上次修改資源的身分識別。

lastModifiedByType

createdByType

上次修改資源的身分識別類型。

timeAggregation

匯總類型。 只有 LogAlert 類型的規則才相關且必要。

名稱 類型 Description
Average

string

Count

string

Maximum

string

Minimum

string

Total

string