All Products
Search
Document Center

Application Real-Time Monitoring Service:DescribePrometheusAlertRule

Last Updated:Jun 12, 2026

Mengkueri aturan peringatan Prometheus.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tidak ada otorisasi untuk operasi ini. Jika Anda mengalami masalah saat menjalankan operasi ini, hubungi dukungan teknis.

Parameter permintaan

Parameter

Type

Required

Description

Example

AlertId

integer

Yes

ID aturan peringatan. Anda dapat memperoleh ID dari tanggapan operasi ListPrometheusAlertRules.

3888704

ClusterId

string

No

ID instans Prometheus.

cc7a37ee31aea4ed1a059eff8034b****

Elemen respons

Element

Type

Description

Example

object

RequestId

string

ID permintaan.

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

PrometheusAlertRule

object

Struct yang dikembalikan.

Status

integer

Apakah aturan peringatan diaktifkan. Nilai valid:

  • 1: Diaktifkan

  • 0: Dinonaktifkan.

1

Type

string

Tipe aturan peringatan.

Kubernetes组件告警

NotifyType

string

Metode notifikasi. Nilai valid:

  • ALERT_MANAGER: Mengirim notifikasi menggunakan Alert Center.

  • DISPATCH_RULE: Mengirim notifikasi menggunakan kebijakan notifikasi tertentu.

ALERT_MANAGER

Expression

string

Ekspresi peringatan.

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

Pesan notifikasi peringatan. Anda dapat menggunakan format {{$labels.xxx}} untuk mereferensikan label.

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

Duration

string

Durasi peringatan. Nilai valid: 1m hingga 1440m. Unit: menit.

1m

DispatchRuleId

integer

ID kebijakan notifikasi. Parameter ini dikembalikan ketika NotifyType diatur ke DISPATCH_RULE.

10282

AlertName

string

Nama aturan peringatan.

Prometheus_Alert

AlertId

integer

ID aturan peringatan.

3888704

ClusterId

string

ID kluster.

c0bad479465464e1d8c1e641b0afb****

Labels

array<object>

Label aturan peringatan.

object

Name

string

The name of the tag.

severity

Value

string

The value of the tag.

critical

Annotations

array<object>

Anotasi aturan peringatan.

object

Name

string

The name of the annotation.

message

Value

string

The value of the annotation.

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

Code

integer

Kode status. Nilai 200 menunjukkan bahwa permintaan berhasil.

200

Success

boolean

Apakah permintaan berhasil:

  • true: Permintaan berhasil.

  • false: Permintaan gagal.

True

Message

string

Paket yang dikembalikan.

success

Contoh

Respons sukses

JSONformat

{
  "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"
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.