你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Alert Rules - List By Resource Group

列出资源组中的经典指标警报规则。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules?api-version=2016-03-01

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string

目标订阅的 ID。

api-version
query True

string

要用于此操作的 API 版本。

响应

名称 类型 说明
200 OK

AlertRuleResourceCollection

成功请求警报规则列表

Other Status Codes

ErrorResponse

描述操作失败原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流

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

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

List alert rules

Sample Request

GET https://management.azure.com/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourcegroups/Rac46PostSwapRG/providers/Microsoft.Insights/alertrules?api-version=2016-03-01

Sample Response

{
  "value": [
    {
      "id": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName",
      "name": "myRuleName",
      "type": "Microsoft.Insights/alertRules",
      "location": "West US",
      "tags": {
        "$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage",
        "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
      },
      "properties": {
        "name": "myRuleName",
        "description": "Pura Vida",
        "isEnabled": true,
        "condition": {
          "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
          "dataSource": {
            "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
            "resourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest",
            "metricName": "Requests"
          },
          "operator": "GreaterThan",
          "threshold": 2,
          "windowSize": "PT5M",
          "timeAggregation": "Total"
        },
        "lastUpdatedTime": "2016-11-10T21:04:39.0005255Z",
        "actions": [
          {
            "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
            "sendToServiceOwners": true,
            "customEmails": [
              "gu@ms.com",
              "su@ms.net"
            ]
          }
        ]
      }
    },
    {
      "id": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0",
      "name": "chiricutin0",
      "type": "Microsoft.Insights/alertRules",
      "location": "West US",
      "tags": {
        "$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage",
        "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
      },
      "properties": {
        "name": "chiricutin0",
        "description": "Pura Vida 0",
        "isEnabled": true,
        "condition": {
          "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
          "dataSource": {
            "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
            "resourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest",
            "metricName": "Requests"
          },
          "operator": "GreaterThan",
          "threshold": 2,
          "windowSize": "PT5M",
          "timeAggregation": "Total"
        },
        "lastUpdatedTime": "2016-11-10T21:04:39.1082596Z",
        "actions": []
      }
    }
  ]
}

定义

名称 说明
AlertRuleResource

警报规则资源。

AlertRuleResourceCollection

表示警报规则资源的集合。

ConditionOperator

规则条件中允许的运算符。

ErrorResponse

描述错误响应的格式。

LocationThresholdRuleCondition

基于一定数量的失败位置的规则条件。

ManagementEventAggregationCondition

随着时间推移,收集的数据应如何组合。

ManagementEventRuleCondition

管理事件规则条件。

RuleEmailAction

指定在评估规则条件时发送电子邮件的操作。 在这种情况下,鉴别器始终为 RuleEmailAction。

RuleManagementEventClaimsDataSource

规则管理事件数据源的声明。

RuleManagementEventDataSource

规则管理事件数据源。 在这种情况下,鉴别器字段始终为 RuleManagementEventDataSource。

RuleMetricDataSource

规则指标数据源。 在这种情况下,鉴别器值始终为 RuleMetricDataSource。

RuleWebhookAction

指定要在计算规则条件时发布到服务的操作。 在这种情况下,鉴别器始终为 RuleWebhookAction。

ThresholdRuleCondition

基于超过阈值的指标的规则条件。

TimeAggregationOperator

规则中允许的聚合运算符。

AlertRuleResource

警报规则资源。

名称 类型 说明
id

string

Azure 资源 ID

location

string

资源位置

name

string

Azure 资源名称

properties.action RuleAction:

在警报规则变为活动状态以及解决警报条件时执行的操作。

properties.actions RuleAction[]:

警报规则变为活动状态以及解决警报条件时执行的操作数组。

properties.condition RuleCondition:

导致激活警报规则的条件。

properties.description

string

警报电子邮件中将包含的警报规则的说明。

properties.isEnabled

boolean

指示是否启用警报规则的标志。

properties.lastUpdatedTime

string

上次以ISO8601格式更新规则的时间。

properties.name

string

警报规则的名称。

properties.provisioningState

string

预配状态。

tags

object

资源标记

type

string

Azure 资源类型

AlertRuleResourceCollection

表示警报规则资源的集合。

名称 类型 说明
value

AlertRuleResource[]

警报规则资源的值。

ConditionOperator

规则条件中允许的运算符。

名称 类型 说明
GreaterThan

string

GreaterThanOrEqual

string

LessThan

string

LessThanOrEqual

string

ErrorResponse

描述错误响应的格式。

名称 类型 说明
code

string

错误代码

message

string

指示操作失败原因的错误消息。

LocationThresholdRuleCondition

基于一定数量的失败位置的规则条件。

名称 类型 说明
dataSource RuleDataSource:

规则从中收集数据的资源。 对于此类型,dataSource 将始终为 RuleMetricDataSource 类型。

failedLocationCount

integer

必须无法激活警报的位置数。

odata.type string:

Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition

指定条件的类型。 这可以是以下三种类型之一:ManagementEventRuleCondition (管理事件) 、LocationThresholdRuleCondition ((基于 Web 测试) 的失败次数)和基于指标) 阈值的 ThresholdRuleCondition (。

windowSize

string

(ISO 8601 持续时间格式) ,用于根据阈值监视警报活动。 如果指定,则它必须介于 5 分钟到 1 天之间。

ManagementEventAggregationCondition

随着时间推移,收集的数据应如何组合。

名称 类型 说明
operator

ConditionOperator

条件运算符。

threshold

number

激活警报的阈值。

windowSize

string

(ISO 8601 持续时间格式) ,用于根据阈值监视警报活动。 如果指定,则它必须介于 5 分钟到 1 天之间。

ManagementEventRuleCondition

管理事件规则条件。

名称 类型 说明
aggregation

ManagementEventAggregationCondition

收集的数据应如何随着时间推移以及警报的激活时间进行组合。 请注意,对于管理事件警报,聚合是可选的;如果未提供任何聚合,则任何事件都将导致激活警报。

dataSource RuleDataSource:

规则从中收集数据的资源。 对于此类型,dataSource 将始终为 RuleMetricDataSource 类型。

odata.type string:

Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition

指定条件的类型。 这可以是以下三种类型之一:ManagementEventRuleCondition (管理事件) 、LocationThresholdRuleCondition ((基于 Web 测试) 的失败次数)和基于指标) 阈值的 ThresholdRuleCondition (。

RuleEmailAction

指定在评估规则条件时发送电子邮件的操作。 在这种情况下,鉴别器始终为 RuleEmailAction。

名称 类型 说明
customEmails

string[]

用于通知警报激活的管理员自定义电子邮件地址列表。

odata.type string:

Microsoft.Azure.Management.Insights.Models.RuleEmailAction

指定操作的类型。 有两种类型的操作:RuleEmailAction 和 RuleWebhookAction。

sendToServiceOwners

boolean

服务管理员(服务和协同管理员)在警报激活后是否应获得通知。

RuleManagementEventClaimsDataSource

规则管理事件数据源的声明。

名称 类型 说明
emailAddress

string

电子邮件地址。

RuleManagementEventDataSource

规则管理事件数据源。 在这种情况下,鉴别器字段始终为 RuleManagementEventDataSource。

名称 类型 说明
claims

RuleManagementEventClaimsDataSource

声明。

eventName

string

事件名称。

eventSource

string

事件源。

legacyResourceId

string

规则监视的资源的旧资源标识符。 注意:无法为现有规则更新此属性。

level

string

级别。

metricNamespace

string

指标的命名空间。

odata.type string:

Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource

指定数据源的类型。 有两种类型的规则数据源:RuleMetricDataSource 和 RuleManagementEventDataSource

operationName

string

应该检查的操作的名称。 如果未提供任何名称,则任何操作都将匹配。

resourceGroupName

string

资源组名称。

resourceLocation

string

资源的位置。

resourceProviderName

string

资源提供程序名称。

resourceUri

string

规则监视的资源的资源标识符。 注意:无法为现有规则更新此属性。

status

string

应该检查的操作的状态。 如果未提供状态,则任何状态都将匹配。

subStatus

string

子状态。

RuleMetricDataSource

规则指标数据源。 在这种情况下,鉴别器值始终为 RuleMetricDataSource。

名称 类型 说明
legacyResourceId

string

规则监视的资源的旧资源标识符。 注意:无法为现有规则更新此属性。

metricName

string

定义规则监视的指标的名称。

metricNamespace

string

指标的命名空间。

odata.type string:

Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource

指定数据源的类型。 有两种类型的规则数据源:RuleMetricDataSource 和 RuleManagementEventDataSource

resourceLocation

string

资源的位置。

resourceUri

string

规则监视的资源的资源标识符。 注意:无法为现有规则更新此属性。

RuleWebhookAction

指定要在计算规则条件时发布到服务的操作。 在这种情况下,鉴别器始终为 RuleWebhookAction。

名称 类型 说明
odata.type string:

Microsoft.Azure.Management.Insights.Models.RuleWebhookAction

指定操作的类型。 有两种类型的操作:RuleEmailAction 和 RuleWebhookAction。

properties

object

要包含在发布操作中的自定义属性的字典。 这些数据追加到 Webhook 有效负载。

serviceUri

string

在警报激活或解决时发布通知的服务 URI。

ThresholdRuleCondition

基于超过阈值的指标的规则条件。

名称 类型 说明
dataSource RuleDataSource:

规则从中收集数据的资源。 对于此类型,dataSource 将始终为 RuleMetricDataSource 类型。

odata.type string:

Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition

指定条件的类型。 这可以是以下三种类型之一:ManagementEventRuleCondition (管理事件) 、LocationThresholdRuleCondition ((基于 Web 测试) 的失败次数)和基于指标) 阈值的 ThresholdRuleCondition (。

operator

ConditionOperator

用于比较数据和阈值的运算符。

threshold

number

激活警报的阈值。

timeAggregation

TimeAggregationOperator

时间聚合运算符。 收集的数据应如何随时间推移进行组合。 默认值为 Metric 的 PrimaryAggregationType。

windowSize

string

(ISO 8601 持续时间格式) ,用于根据阈值监视警报活动。 如果指定,则它必须介于 5 分钟到 1 天之间。

TimeAggregationOperator

规则中允许的聚合运算符。

名称 类型 说明
Average

string

Last

string

Maximum

string

Minimum

string

Total

string