All Products
Search
Document Center

Application Real-Time Monitoring Service:GetAlertRules

Last Updated:Jun 12, 2026

Mengkueri aturan peringatan yang telah dibuat.

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

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

arms:GetAlertRules

get

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

AlertIds

string

No

Daftar ID aturan peringatan. ID aturan peringatan mengidentifikasi aturan peringatan secara unik dan tidak duplikat.

  • Jika Anda tidak menentukan parameter ini, permintaan API tidak memfilter aturan peringatan berdasarkan ID aturan peringatan.

  • Jika Anda menentukan daftar ID aturan peringatan, permintaan hanya mengembalikan subset aturan peringatan yang ID-nya ada dalam daftar. Kondisi filter lain juga berlaku.

Catatan

Panggil operasi GetAlertRules dengan parameter permintaan lain untuk mendapatkan AlertIds dari tanggapan. Anda kemudian dapat menggunakan AlertIds untuk mengkueri aturan peringatan tertentu.

["12345"]

AlertNames

string

No

Daftar nama aturan peringatan. Aturan peringatan baru tidak boleh memiliki nama yang duplikat, tetapi aturan peringatan yang ada mungkin memiliki nama yang duplikat. Oleh karena itu, AlertName bukan pengidentifikasi unik untuk aturan peringatan.

  • Jika Anda tidak menentukan parameter ini, aturan peringatan tidak difilter.

  • Jika Anda menentukan daftar nama aturan peringatan, permintaan hanya mengembalikan subset aturan peringatan yang namanya ada dalam daftar. Kondisi filter lain juga berlaku.

["test"]

RegionId

string

Yes

ID wilayah.

cn-hangzhou

AlertType

string

No

Tipe aturan peringatan. Parameter ini wajib untuk aturan peringatan baru.

  • APPLICATION_MONITORING_ALERT_RULE: Aturan peringatan Pemantauan Aplikasi.

  • BROWSER_MONITORING_ALERT_RULE: Aturan peringatan Pemantauan Browser.

  • PROMETHEUS_MONITORING_ALERT_RULE: Aturan peringatan Managed Service for Prometheus.

APPLICATION_MONITORING_ALERT_RULE

AlertStatus

string

No

Status berjalan aturan peringatan.

  • RUNNING: berjalan

  • STOPPED: dihentikan

  • PAUSED: dijeda

Catatan

Status PAUSED menunjukkan bahwa aturan peringatan tidak normal dan telah dijeda secara proaktif oleh sistem. Kemungkinan penyebabnya termasuk nilai dimensi yang terlalu besar atau penghapusan Kluster yang terkait.

RUNNING

ClusterId

string

No

ID kluster aturan peringatan Managed Service for Prometheus.

ceba9b9ea5b924dd0b6726d2de6******

ProductCode

string

No

Parameter ini tidak wajib.

null

Page

integer

Yes

Nomor halaman aturan peringatan yang akan dikueri.

1

Size

integer

Yes

Jumlah aturan peringatan per halaman.

20

Tags

array<object>

No

Daftar tag.

object

No

Key

string

No

Kunci tag.

type

Value

string

No

Nilai tag.

prod

BizRegionId

string

No

ID wilayah tempat aturan berada.

cn-hangzhou

Elemen respons

Element

Type

Description

Example

object

Struktur tanggapan.

RequestId

string

ID permintaan.

337B8F7E-0A64-5768-9225-E9B3CF******

PageBean

object

Objek paginasi.

Total

integer

Jumlah total aturan peringatan yang dikembalikan.

1

Page

integer

Nomor halaman kueri.

1

Size

integer

Jumlah aturan peringatan per halaman.

20

AlertRules

array<object>

Daftar aturan peringatan.

array<object>

Struktur daftar aturan peringatan.

AlertId

integer

The alert rule ID.

5730***

AlertName

string

The name of the alert rule.

arms-test

UserId

string

The ID of the Alibaba Cloud account.

1131971649******

RegionId

string

The region ID.

cn-hangzhou

AlertType

string

The type of the alert rule. Valid values:

  • APPLICATION_MONITORING_ALERT_RULE: alert rule for Application Monitoring

  • BROWSER_MONITORING_ALERT_RULE: alert rule for Browser Monitoring

  • PROMETHEUS_MONITORING_ALERT_RULE: Prometheus alert rule

APPLICATION_MONITORING_ALERT_RULE

AlertStatus

string

The status of the alert rule. Valid values:

  • RUNNING

  • STOPPED

  • PAUSED

Catatan

The PAUSED state indicates that the alert rule is abnormal and has been suspended. This may be because the specified threshold value is excessively large, or the associated cluster has been deleted.

RUNNING

CreatedTime

integer

The time when the alert rule was created. The value is a timestamp. Unit: milliseconds.

1640333981000

UpdatedTime

integer

The time when the alert rule was updated. The value is a timestamp. Unit: milliseconds.

1640333981000

Extend

string

The extended fields.

Catatan

For existing Application Monitoring alert rules, the fields contain information such as contacts, alert template, and notification content.

{\"alarmContext\":\"{\\\"content\\\":\\\"报警名称:$报警名称\\\\n筛选条件: $筛选\\\\n报警时间: $报警时间\\\\n报警内容: $报警内容\\\\n注意!:该报警未收到恢复邮件之前,正在持续报警中,24小时后会再次提醒您!\\\",\\\"subTitle\\\":\\\"\\\"}\",\"alertWays\":\"[0,1]\",\"contactGroupIds\":\"381,5075\",\"notice\":\"{\\\"endTime\\\":1480607940000,\\\"noticeEndTime\\\":1480607940000,\\\"noticeStartTime\\\":1480521600000,\\\"startTime\\\":1480521600000}\"}

NotifyStrategy

string

The name of the notification policy.

ALERT_MANAGER

Pids

array

The process ID (PID) of the application to which the Application Monitoring or Browser Monitoring alert rule is applied.

string

The PID of the application.

["b590lhguqs@40d8deedfa9******"]

AutoAddNewApplication

boolean

Indicates whether the alert rule is applied to new applications that are created in Application Monitoring or Browser Monitoring. Valid values:

  • true: yes

  • false: no

false

MetricsType

string

The metric type of the Application Monitoring or Browser Monitoring alert rule.

JVM

AlertRuleContent

object

The content of the Application Monitoring or Browser Monitoring alert rule.

Condition

string

The relationship between multiple alert conditions specified for the Application Monitoring or Browser Monitoring alert rule. Valid values:

  • OR: The alert rule is triggered if one of the conditions is met.

  • AND: The alert rule is triggered if all the conditions are met.

OR

AlertRuleItems

array<object>

The trigger conditions of the Application Monitoring or Browser Monitoring alert rule.

object

The details of the alert condition.

N

integer

The last N minutes.

1

MetricKey

string

The metric of the alert condition.

appstat.jvm.non_heap_used

Aggregate

string

The aggregation method of the alert condition. Valid values:

  • AVG: calculates the average value

  • SUM: calculates the total value

  • MAX: selects the maximum value

  • MIN: selects the minimum value

AVG

Operator

string

The operator that is used to compare the metric value with the threshold. Valid values:

  • CURRENT_GTE: greater than or equal to

  • CURRENT_LTE: less than or equal to

  • PREVIOUS_UP: increase in percentage compared with the previous period

  • PREVIOUS_DOWN: decrease in percentage compared with the previous period

  • HOH_UP: increase in percentage compared with the same period in the previous hour

  • HOH_DOWN: decrease in percentage compared with the same period in the previous hour

  • DOD_UP: increase in percentage compared with the same period in the previous day

  • DOD_DOWN: decrease in percentage compared with the same period in the previous day

CURRENT_GTE

Value

string

The threshold of the alert condition.

1

Filters

object

The filter conditions of the Application Monitoring or Browser Monitoring alert rule.

DimFilters

array<object>

The information about each filter condition of the Application Monitoring or Browser Monitoring alert rule.

object

The details of the filter condition.

FilterKey

string

The key of the filter condition.

rootIp

FilterOpt

string

The logical operator of the filter condition.

ALL

FilterValues

array

The details of the filter condition.

string

The parameters of the filter condition.

null

CustomSLSFilters

array<object>

The custom filter condition of the Browser Monitoring alert rule.

object

The details of the custom filter condition.

Key

string

The key of the filter condition.

username

Opt

string

The logical operator of the filter condition. Valid values:

  • =: equal to

  • not: not equal to

=

Value

string

The value of the filter condition.

test

T

string

The log type of Browser Monitoring. This field is not included in other filter conditions.

null

Show

boolean

Indicates whether this filter condition is displayed on the frontend.

false

CustomSLSGroupByDimensions

array

The information about the aggregation dimension.

string

The value of the aggregation dimension.

["page"]

CustomSLSWheres

array

The details of the custom filter condition.

string

The value of the custom filter condition.

["t like '%api%'"]

AlertCheckType

string

The alert check type of the Prometheus alert rule.

  • STATIC: static threshold

  • CUSTOM: custom PromQL

STATIC

ClusterId

string

The cluster ID of the Prometheus alert rule.

ceba9b9ea5b924dd0b6726d2de6******

AlertGroup

integer

The alert contact group ID of the Prometheus alert rule.

  • -1: custom PromQL

  • 1: Kubernetes load

  • 15: Kubernetes node

1

PromQL

string

The PromQL statement of the Prometheus alert rule.

node_memory_MemAvailable_bytes{} / node_memory_MemTotal_bytes{} * 100

Duration

string

The duration of the Prometheus alert rule.

1

Level

string

The severity level of the Prometheus alert rule.

  • P1: Alert notifications are sent for major issues that affect the availability of core business, have a huge impact, and may lead to serious consequences.

  • P2: Alert notifications are sent for service errors that affect the system availability with relatively limited impact.

  • P3: Alert notifications are sent for issues that may cause service errors or negative effects, or alert notifications for services that are relatively less important.

  • P4: Alert notifications are sent for low-priority issues that do not affect your business.

  • Default: Alert notifications are sent regardless of alert levels.

P2

Message

string

The alert message of the Prometheus alert rule.

命名空间: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / 容器: {{$labels.container}} CPU使用率{{$labels.metrics_params_opt_label_value}} {{$labels.metrics_params_value}}%, 当前值{{ printf "%.2f" $value }}%

Labels

array<object>

The tags of the Prometheus alert rule.

object

The tag struct.

Name

string

The tag key.

123

Value

string

The tag value.

abc

Annotations

array<object>

The annotations of the Prometheus alert rule.

object

The annotation struct.

Name

string

The key of the annotation.

123

Value

string

The value of the annotation.

abc

Tags

array<object>

The tags of the alert rule.

object

Key

string

The tag key.

type

Value

string

The tag value.

prod

Contoh

Respons sukses

JSONformat

{
  "RequestId": "337B8F7E-0A64-5768-9225-E9B3CF******",
  "PageBean": {
    "Total": 1,
    "Page": 1,
    "Size": 20,
    "AlertRules": [
      {
        "AlertId": 0,
        "AlertName": "arms-test",
        "UserId": "1131971649******",
        "RegionId": "cn-hangzhou",
        "AlertType": "APPLICATION_MONITORING_ALERT_RULE",
        "AlertStatus": "RUNNING",
        "CreatedTime": 1640333981000,
        "UpdatedTime": 1640333981000,
        "Extend": "{\\\"alarmContext\\\":\\\"{\\\\\\\"content\\\\\\\":\\\\\\\"报警名称:$报警名称\\\\\\\\n筛选条件: $筛选\\\\\\\\n报警时间: $报警时间\\\\\\\\n报警内容: $报警内容\\\\\\\\n注意!:该报警未收到恢复邮件之前,正在持续报警中,24小时后会再次提醒您!\\\\\\\",\\\\\\\"subTitle\\\\\\\":\\\\\\\"\\\\\\\"}\\\",\\\"alertWays\\\":\\\"[0,1]\\\",\\\"contactGroupIds\\\":\\\"381,5075\\\",\\\"notice\\\":\\\"{\\\\\\\"endTime\\\\\\\":1480607940000,\\\\\\\"noticeEndTime\\\\\\\":1480607940000,\\\\\\\"noticeStartTime\\\\\\\":1480521600000,\\\\\\\"startTime\\\\\\\":1480521600000}\\\"}",
        "NotifyStrategy": "ALERT_MANAGER",
        "Pids": [
          "[\"b590lhguqs@40d8deedfa9******\"]"
        ],
        "AutoAddNewApplication": false,
        "MetricsType": "JVM",
        "AlertRuleContent": {
          "Condition": "OR",
          "AlertRuleItems": [
            {
              "N": 1,
              "MetricKey": "appstat.jvm.non_heap_used",
              "Aggregate": "AVG",
              "Operator": "CURRENT_GTE",
              "Value": "1"
            }
          ]
        },
        "Filters": {
          "DimFilters": [
            {
              "FilterKey": "rootIp",
              "FilterOpt": "ALL",
              "FilterValues": [
                "null"
              ]
            }
          ],
          "CustomSLSFilters": [
            {
              "Key": "username",
              "Opt": "=",
              "Value": "test",
              "T": "null",
              "Show": false
            }
          ],
          "CustomSLSGroupByDimensions": [
            "[\"page\"]"
          ],
          "CustomSLSWheres": [
            "[\"t like '%api%'\"]"
          ]
        },
        "AlertCheckType": "STATIC",
        "ClusterId": "ceba9b9ea5b924dd0b6726d2de6******",
        "AlertGroup": 1,
        "PromQL": "node_memory_MemAvailable_bytes{} / node_memory_MemTotal_bytes{} * 100",
        "Duration": "1",
        "Level": "P2",
        "Message": "命名空间: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / 容器: {{$labels.container}} CPU使用率{{$labels.metrics_params_opt_label_value}} {{$labels.metrics_params_value}}%, 当前值{{ printf \"%.2f\" $value }}%",
        "Labels": [
          {
            "Name": "123",
            "Value": "abc"
          }
        ],
        "Annotations": [
          {
            "Name": "123",
            "Value": "abc"
          }
        ],
        "Tags": [
          {
            "Key": "type",
            "Value": "prod"
          }
        ]
      }
    ]
  }
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.