Scheduled Query Rules - Update
更新计划的查询规则。
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}?api-version=2021-08-01URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 | 
|---|---|---|---|---|
| resource | path | True | stringminLength: 1 maxLength: 90 | 资源组的名称。 名称不区分大小写。 | 
| rule | path | True | string | 规则的名称。 | 
| subscription | path | True | stringminLength: 1 | 目标订阅的 ID。 | 
| api-version | query | True | stringminLength: 1 | 用于此作的 API 版本。 | 
请求正文
| 名称 | 类型 | 说明 | 
|---|---|---|
| properties.actions | 触发警报时要调用的操作。 | |
| properties.autoMitigate | boolean | 指示是否应自动解决警报的标志。 默认值为 true。 仅适用于 LogAlert 类型的规则。 | 
| properties.checkWorkspaceAlertsStorageConfigured | boolean | 指示此计划查询规则是否应存储在客户的存储中的标志。 默认值为 false。 仅适用于 LogAlert 类型的规则。 | 
| properties.criteria | 定义计划查询规则条件的规则条件。 | |
| properties.description | string | 计划查询规则的说明。 | 
| properties.displayName | string | 警报规则的显示名称 | 
| properties.enabled | boolean | 指示是否启用此计划查询规则的标志。 值应为 true 或 false | 
| properties.evaluationFrequency | string (duration) | 以 ISO 8601 持续时间格式计算计划查询规则的频率。 仅针对 LogAlert 类型的规则相关且必需。 | 
| properties.muteActionsDuration | string (duration) | 触发警报后,在所选时间段(采用 ISO 8601 持续时间格式)将操作静音。 仅适用于 LogAlert 类型的规则。 | 
| properties.overrideQueryTimeRange | string (duration) | 如果指定,则覆盖查询时间范围(默认值为 WindowSize*NumberOfEvaluationPeriods)。 仅适用于 LogAlert 类型的规则。 | 
| properties.scopes | string[] | 此计划查询规则的范围是资源 ID 的列表。 | 
| properties.severity | 
					Alert | 警报的严重性。 应该是 [0-4] 之间的整数。 值 0 最严重。 仅针对 LogAlert 类型的规则相关且必需。 | 
| properties.skipQueryValidation | boolean | 指示是否应验证提供的查询的标志。 默认值为 false。 仅适用于 LogAlert 类型的规则。 | 
| properties.targetResourceTypes | string[] | 创建/更新警报的目标资源的资源类型的列表。 例如,如果范围是资源组,targetResourceTypes Microsoft.Compute/virtualMachines,则会针对资源组中满足警报条件的每个虚拟机触发不同的警报。 仅适用于 LogAlert 类型的规则 | 
| properties.windowSize | string (duration) | 将在其中执行警报查询的时间段(采用 ISO 8601 持续时间格式)(箱大小)。 仅针对 LogAlert 类型的规则相关且必需。 | 
| tags | object | 资源标记 | 
响应
| 名称 | 类型 | 说明 | 
|---|---|---|
| 200 OK | 成功请求以更新计划的查询规则 | |
| Other Status Codes | 描述操作失败的原因的错误响应。 | 
安全性
azure_auth
Azure Active Directory OAuth2 流
					类型: 
					oauth2
					流向: 
					implicit
					授权 URL: 
					https://login.microsoftonline.com/common/oauth2/authorize
			
作用域
| 名称 | 说明 | 
|---|---|
| user_impersonation | 模拟用户帐户 | 
示例
Create or update a scheduled query rule
示例请求
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
  }
}
示例响应
{
  "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
  }
}定义
| 名称 | 说明 | 
|---|---|
| Actions | 触发警报时要调用的操作。 | 
| Alert | 警报的严重性。 应该是 [0-4] 之间的整数。 值 0 最严重。 仅针对 LogAlert 类型的规则相关且必需。 | 
| Condition | 计划查询规则的条件。 | 
| condition | 条件运算符。 仅针对 LogAlert 类型的规则相关且必需。 | 
| created | 创建资源的标识的类型。 | 
| Dimension | 维度拆分和筛选定义 | 
| dimension | 维度值的运算符 | 
| Error | 资源管理错误附加信息。 | 
| Error | 描述错误响应的格式。 | 
| Error | 错误响应 | 
| Failing | 在引发警报所需的所选回溯时间范围内所需的最小冲突数。 仅适用于 LogAlert 类型的规则。 | 
| Kind | 指示计划查询规则的类型。 默认值为 LogAlert。 | 
| Scheduled | 定义计划查询规则条件的规则条件。 | 
| Scheduled | 计划的查询规则资源。 | 
| Scheduled | 用于修补作的计划查询规则资源。 | 
| system | 与创建和上次修改资源相关的元数据。 | 
| time | 聚合类型。 仅针对 LogAlert 类型的规则相关且必需。 | 
Actions
触发警报时要调用的操作。
| 名称 | 类型 | 说明 | 
|---|---|---|
| actionGroups | string[] | 触发警报时要调用的操作组资源 ID。 | 
| customProperties | object | 警报有效负载的属性。 | 
AlertSeverity 
			
			警报的严重性。 应该是 [0-4] 之间的整数。 值 0 最严重。 仅针对 LogAlert 类型的规则相关且必需。
| 值 | 说明 | 
|---|---|
| 0 | |
| 1 | |
| 2 | |
| 3 | |
| 4 | 
Condition
计划查询规则的条件。
| 名称 | 类型 | 说明 | 
|---|---|---|
| dimensions | 维度条件列表 | |
| failingPeriods | 在引发警报所需的所选回溯时间范围内所需的最小冲突数。 仅适用于 LogAlert 类型的规则。 | |
| metricMeasureColumn | string | 包含指标度量值的列。 仅适用于 LogAlert 类型的规则。 | 
| metricName | string | 要发送的指标的名称。 仅对 LogToMetric 类型的规则相关且必需。 | 
| operator | 条件运算符。 仅针对 LogAlert 类型的规则相关且必需。 | |
| query | string | 日志查询警报 | 
| resourceIdColumn | string | 包含资源 ID 的列。列的内容必须是格式为资源 ID 的 URI。仅适用于 LogAlert 类型的规则。 | 
| threshold | number (double) | 激活警报的条件阈值。 仅针对 LogAlert 类型的规则相关且必需。 | 
| timeAggregation | 聚合类型。 仅针对 LogAlert 类型的规则相关且必需。 | 
conditionOperator 
			
			条件运算符。 仅针对 LogAlert 类型的规则相关且必需。
| 值 | 说明 | 
|---|---|
| Equals | |
| GreaterThan | |
| GreaterThanOrEqual | |
| LessThan | |
| LessThanOrEqual | 
createdByType 
			
			创建资源的标识的类型。
| 值 | 说明 | 
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key | 
Dimension
维度拆分和筛选定义
| 名称 | 类型 | 说明 | 
|---|---|---|
| name | string | 维度的名称 | 
| operator | 维度值的运算符 | |
| values | string[] | 维度值列表 | 
dimensionOperator 
			
			维度值的运算符
| 值 | 说明 | 
|---|---|
| Include | |
| Exclude | 
ErrorAdditionalInfo  
			
			资源管理错误附加信息。
| 名称 | 类型 | 说明 | 
|---|---|---|
| info | object | 其他信息。 | 
| type | string | 其他信息类型。 | 
ErrorContract 
			
			描述错误响应的格式。
| 名称 | 类型 | 说明 | 
|---|---|---|
| error | 错误响应 | 
ErrorResponse 
			
			错误响应
| 名称 | 类型 | 说明 | 
|---|---|---|
| additionalInfo | 错误附加信息。 | |
| code | string | 错误代码。 | 
| details | 错误详细信息。 | |
| message | string | 错误消息。 | 
| target | string | 错误目标。 | 
FailingPeriods 
			
			在引发警报所需的所选回溯时间范围内所需的最小冲突数。 仅适用于 LogAlert 类型的规则。
| 名称 | 类型 | 默认值 | 说明 | 
|---|---|---|---|
| minFailingPeriodsToAlert | integer (int64) | 1 | 触发警报的冲突数。 应小于或等于 numberOfEvaluationPeriods。 默认值为 1 | 
| numberOfEvaluationPeriods | integer (int64) | 1 | 聚合回溯点数。 回溯时间窗口是根据聚合粒度(windowSize)和所选聚合点数计算的。 默认值为 1 | 
Kind
指示计划查询规则的类型。 默认值为 LogAlert。
| 值 | 说明 | 
|---|---|
| LogAlert | |
| LogToMetric | 
ScheduledQueryRuleCriteria   
			
			定义计划查询规则条件的规则条件。
| 名称 | 类型 | 说明 | 
|---|---|---|
| allOf | 要针对指定范围评估的条件列表 | 
ScheduledQueryRuleResource   
			
			计划的查询规则资源。
| 名称 | 类型 | 说明 | 
|---|---|---|
| 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 | 资源的完全限定资源 ID。 示例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | 
| kind | 指示计划查询规则的类型。 默认值为 LogAlert。 | |
| location | string | 资源所在的地理位置 | 
| name | string | 资源的名称 | 
| properties.actions | 触发警报时要调用的操作。 | |
| properties.autoMitigate | boolean | 指示是否应自动解决警报的标志。 默认值为 true。 仅适用于 LogAlert 类型的规则。 | 
| properties.checkWorkspaceAlertsStorageConfigured | boolean | 指示此计划查询规则是否应存储在客户的存储中的标志。 默认值为 false。 仅适用于 LogAlert 类型的规则。 | 
| properties.createdWithApiVersion | string | 创建此警报规则时使用的 API 版本 | 
| properties.criteria | 定义计划查询规则条件的规则条件。 | |
| properties.description | string | 计划查询规则的说明。 | 
| properties.displayName | string | 警报规则的显示名称 | 
| properties.enabled | boolean | 指示是否启用此计划查询规则的标志。 值应为 true 或 false | 
| properties.evaluationFrequency | string (duration) | 以 ISO 8601 持续时间格式计算计划查询规则的频率。 仅针对 LogAlert 类型的规则相关且必需。 | 
| properties.isLegacyLogAnalyticsRule | boolean | 如此 如果警报规则是旧版 Log Analytic 规则 | 
| properties.isWorkspaceAlertsStorageConfigured | boolean | 指示是否已将此计划查询规则配置为存储在客户的存储中的标志。 默认值为 false。 | 
| properties.muteActionsDuration | string (duration) | 触发警报后,在所选时间段(采用 ISO 8601 持续时间格式)将操作静音。 仅适用于 LogAlert 类型的规则。 | 
| properties.overrideQueryTimeRange | string (duration) | 如果指定,则覆盖查询时间范围(默认值为 WindowSize*NumberOfEvaluationPeriods)。 仅适用于 LogAlert 类型的规则。 | 
| properties.scopes | string[] | 此计划查询规则的范围是资源 ID 的列表。 | 
| properties.severity | 
					Alert | 警报的严重性。 应该是 [0-4] 之间的整数。 值 0 最严重。 仅针对 LogAlert 类型的规则相关且必需。 | 
| properties.skipQueryValidation | boolean | 指示是否应验证提供的查询的标志。 默认值为 false。 仅适用于 LogAlert 类型的规则。 | 
| properties.targetResourceTypes | string[] | 创建/更新警报的目标资源的资源类型的列表。 例如,如果范围是资源组,targetResourceTypes Microsoft.Compute/virtualMachines,则会针对资源组中满足警报条件的每个虚拟机触发不同的警报。 仅适用于 LogAlert 类型的规则 | 
| properties.windowSize | string (duration) | 将在其中执行警报查询的时间段(采用 ISO 8601 持续时间格式)(箱大小)。 仅针对 LogAlert 类型的规则相关且必需。 | 
| systemData | ScheduledQueryRule 的 SystemData。 | |
| tags | object | 资源标记。 | 
| type | string | 资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” | 
ScheduledQueryRuleResourcePatch    
			
			用于修补作的计划查询规则资源。
| 名称 | 类型 | 说明 | 
|---|---|---|
| properties.actions | 触发警报时要调用的操作。 | |
| properties.autoMitigate | boolean | 指示是否应自动解决警报的标志。 默认值为 true。 仅适用于 LogAlert 类型的规则。 | 
| properties.checkWorkspaceAlertsStorageConfigured | boolean | 指示此计划查询规则是否应存储在客户的存储中的标志。 默认值为 false。 仅适用于 LogAlert 类型的规则。 | 
| properties.createdWithApiVersion | string | 创建此警报规则时使用的 API 版本 | 
| properties.criteria | 定义计划查询规则条件的规则条件。 | |
| properties.description | string | 计划查询规则的说明。 | 
| properties.displayName | string | 警报规则的显示名称 | 
| properties.enabled | boolean | 指示是否启用此计划查询规则的标志。 值应为 true 或 false | 
| properties.evaluationFrequency | string (duration) | 以 ISO 8601 持续时间格式计算计划查询规则的频率。 仅针对 LogAlert 类型的规则相关且必需。 | 
| properties.isLegacyLogAnalyticsRule | boolean | 如此 如果警报规则是旧版 Log Analytic 规则 | 
| properties.isWorkspaceAlertsStorageConfigured | boolean | 指示是否已将此计划查询规则配置为存储在客户的存储中的标志。 默认值为 false。 | 
| properties.muteActionsDuration | string (duration) | 触发警报后,在所选时间段(采用 ISO 8601 持续时间格式)将操作静音。 仅适用于 LogAlert 类型的规则。 | 
| properties.overrideQueryTimeRange | string (duration) | 如果指定,则覆盖查询时间范围(默认值为 WindowSize*NumberOfEvaluationPeriods)。 仅适用于 LogAlert 类型的规则。 | 
| properties.scopes | string[] | 此计划查询规则的范围是资源 ID 的列表。 | 
| properties.severity | 
					Alert | 警报的严重性。 应该是 [0-4] 之间的整数。 值 0 最严重。 仅针对 LogAlert 类型的规则相关且必需。 | 
| properties.skipQueryValidation | boolean | 指示是否应验证提供的查询的标志。 默认值为 false。 仅适用于 LogAlert 类型的规则。 | 
| properties.targetResourceTypes | string[] | 创建/更新警报的目标资源的资源类型的列表。 例如,如果范围是资源组,targetResourceTypes Microsoft.Compute/virtualMachines,则会针对资源组中满足警报条件的每个虚拟机触发不同的警报。 仅适用于 LogAlert 类型的规则 | 
| properties.windowSize | string (duration) | 将在其中执行警报查询的时间段(采用 ISO 8601 持续时间格式)(箱大小)。 仅针对 LogAlert 类型的规则相关且必需。 | 
| tags | object | 资源标记 | 
systemData 
			
			与创建和上次修改资源相关的元数据。
| 名称 | 类型 | 说明 | 
|---|---|---|
| createdAt | string (date-time) | 资源创建时间戳(UTC)。 | 
| createdBy | string | 创建资源的标识。 | 
| createdByType | 创建资源的标识的类型。 | |
| lastModifiedAt | string (date-time) | 上次修改的资源时间戳(UTC) | 
| lastModifiedBy | string | 上次修改资源的标识。 | 
| lastModifiedByType | 上次修改资源的标识的类型。 | 
timeAggregation 
			
			聚合类型。 仅针对 LogAlert 类型的规则相关且必需。
| 值 | 说明 | 
|---|---|
| Count | |
| Average | |
| Minimum | |
| Maximum | |
| Total |