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

Prometheus Rule Groups - Get

检索 Prometheus 规则组定义。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/prometheusRuleGroups/{ruleGroupName}?api-version=2023-03-01

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

minLength: 1
maxLength: 90

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

ruleGroupName
path True

string

pattern: ^[^:@/#{}%&+*<>?]+$

规则组的名称。

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

api-version
query True

string

minLength: 1

用于此作的 API 版本。

响应

名称 类型 说明
200 OK

PrometheusRuleGroupResource

成功请求 Prometheus 规则组列表

Other Status Codes

ErrorResponse

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

示例

Get a PrometheusRuleGroup

示例请求

GET https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup?api-version=2023-03-01

示例响应

{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup",
  "type": "Microsoft.AlertsManagement/prometheusRuleGroups",
  "location": "East US",
  "properties": {
    "description": "This is the description of the following rule group",
    "enabled": true,
    "interval": "PT10M",
    "clusterName": "myClusterName",
    "scopes": [
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"
    ],
    "rules": [
      {
        "record": "job_type:billing_jobs_duration_seconds:99p5m",
        "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))",
        "labels": {
          "team": "prod"
        }
      },
      {
        "alert": "Billing_Processing_Very_Slow",
        "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30",
        "enabled": true,
        "severity": 2,
        "for": "PT5M",
        "labels": {
          "team": "prod"
        },
        "annotations": {
          "annotationName1": "annotationValue1"
        },
        "resolveConfiguration": {
          "autoResolved": true,
          "timeToResolve": "PT10M"
        },
        "actions": [
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup",
            "actionProperties": {
              "key11": "value11",
              "key12": "value12"
            }
          },
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup",
            "actionProperties": {
              "key21": "value21",
              "key22": "value22"
            }
          }
        ]
      }
    ]
  }
}

定义

名称 说明
createdByType

创建资源的标识的类型。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

PrometheusRule

Azure Prometheus 警报或记录规则。

PrometheusRuleGroupAction

警报操作。 仅与警报相关。

PrometheusRuleGroupResource

Prometheus 规则组资源。

PrometheusRuleResolveConfiguration

指定 Prometheus 警报规则配置。

systemData

与创建和上次修改资源相关的元数据。

createdByType

创建资源的标识的类型。

说明
User
Application
ManagedIdentity
Key

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

PrometheusRule

Azure Prometheus 警报或记录规则。

名称 类型 说明
actions

PrometheusRuleGroupAction[]

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

alert

string

警报规则名称。

annotations

object

批注子句指定一组信息性标签,可用于存储更长的其他信息,例如警报说明或 Runbook 链接。 批注值可以模板化。

enabled

boolean

启用/禁用规则。

expression

string

要计算的 PromQL 表达式。 https://prometheus.io/docs/prometheus/latest/querying/basics/。 按“interval”定期计算,并将结果记录为一组新的时序,指标名称由“record”提供。

for

string (duration)

触发前警报必须处于活动状态的时间量。

labels

object

存储结果之前要添加或覆盖的标签。

record

string

记录的指标名称。

resolveConfiguration

PrometheusRuleResolveConfiguration

定义用于解析触发的警报的配置。 仅与警报相关。

severity

integer (int32)

规则触发的警报的严重性。 必须介于 0 和 4 之间。

PrometheusRuleGroupAction

警报操作。 仅与警报相关。

名称 类型 说明
actionGroupId

string

要使用的操作组的资源 ID。

actionProperties

object

操作组对象的属性。

PrometheusRuleGroupResource

Prometheus 规则组资源。

名称 类型 说明
id

string

资源的完全限定资源 ID。 示例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

location

string

资源所在的地理位置

name

string

资源的名称

properties.clusterName

string

将规则应用于来自特定群集的数据。

properties.description

string

规则组说明。

properties.enabled

boolean

启用/禁用规则组。

properties.interval

string (duration)

运行以 ISO 8601 持续时间格式表示的 Prometheus 规则组的间隔。 应介于 1 到 15 分钟之间

properties.rules

PrometheusRule[]

定义 Prometheus 规则组中的规则。

properties.scopes

string[]

目标 Azure Monitor 工作区资源 ID。 此 API 版本目前仅限于使用一个范围创建。 这将来可能会改变。

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

tags

object

资源标记。

type

string

资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

PrometheusRuleResolveConfiguration

指定 Prometheus 警报规则配置。

名称 类型 说明
autoResolved

boolean

启用警报自动解决。

timeToResolve

string (duration)

警报自动解决超时。

systemData

与创建和上次修改资源相关的元数据。

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

上次修改的资源时间戳(UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识的类型。