全部产品
Search
文档中心

可观测监控 Prometheus 版:DescribePrometheusAlertRule - 查看告警规则

更新时间:Aug 28, 2026

查看Prometheus告警规则。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求参数

名称

类型

必填

描述

示例值

AlertId

integer

告警规则 ID,您可以在 ListPrometheusAlertRules API 接口的返回数据中查看。

3888704

ClusterId

string

Prometheus 实例 ID。

cc7a37ee31aea4ed1a059eff8034b****

返回参数

名称

类型

描述

示例值

object

RequestId

string

请求 ID。

9FEA6D00-317F-45E3-9004-7FB8B0B7****

PrometheusAlertRule

object

返回结构体。

Status

integer

告警规则启用状态,取值:

  • 1:开启

  • 0:关闭

1

Type

string

告警规则类型。

Kubernetes组件告警

NotifyType

string

通知类型, 取值:

  • ALERT_MANAGER:通过告警运维中心通知。

  • DISPATCH_RULE:指定通知策略进行通知。

ALERT_MANAGER

Expression

string

告警表达式。

100 * (sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, \"pod_name\", \"$1\", \"pod\", \"(.*)\")) by (pod_name))>75

Message

string

告警通知消息,支持按照{{$labels.xxx}}格式来引用标签。

${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}%

Duration

string

持续时间,范围在 1m~1440m,单位为分钟。

1m

DispatchRuleId

integer

通知策略 ID,当 NotifyType 指定为DISPATCH_RULE时显示此参数。

10282

AlertName

string

告警规则名称。

Prometheus_Alert

AlertId

integer

告警规则 ID。

3888704

ClusterId

string

集群 ID。

c0bad479465464e1d8c1e641b0afb****

Labels

array<object>

告警规则的标签。

object

Name

string

标签的名称。

severity

Value

string

标签的值。

critical

Annotations

array<object>

告警规则的注释。

object

Name

string

注释的名称。

message

Value

string

注释的值。

${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}%

Code

integer

状态码。说明 200 表示成功。

200

Success

boolean

操作是否成功:

  • true:成功。

  • false:失败。

True

Message

string

返回结果的提示信息。

success

示例

正常返回示例

JSON格式

{
  "RequestId": "9FEA6D00-317F-45E3-9004-7FB8B0B7****",
  "PrometheusAlertRule": {
    "Status": 1,
    "Type": "Kubernetes组件告警",
    "NotifyType": "ALERT_MANAGER",
    "Expression": "100 * (sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, \\\"pod_name\\\", \\\"$1\\\", \\\"pod\\\", \\\"(.*)\\\")) by (pod_name))>75",
    "Message": "${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}%",
    "Duration": "1m",
    "DispatchRuleId": 10282,
    "AlertName": "Prometheus_Alert",
    "AlertId": 3888704,
    "ClusterId": "c0bad479465464e1d8c1e641b0afb****",
    "Labels": [
      {
        "Name": "severity",
        "Value": "critical"
      }
    ],
    "Annotations": [
      {
        "Name": "message",
        "Value": "${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}%"
      }
    ]
  },
  "Code": 200,
  "Success": true,
  "Message": "success"
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情