ListAlarmPolicy
Updated at:2025-11-03
Description
Retrieve alarm strategy list
Request
- Request syntax
Text
1POST /v1/alarm/policy/list HTTP/1.1
2Host: <Endpoint>
3Authorization: <Authorization String>
4Content-Type: application/json; charset=utf-8
5{
6 "policyNamePattern": "policy-name"
7}
- Request headers
No additional headers are required beyond the standard request headers.
- Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| policyNamePattern | String | No | RequestBody | Filter by policy name |
| policyIdPattern | String | No | RequestBody | Filter by policy ID |
| logStoreNamePattern | String | No | RequestBody | Filter by logstore |
| state | String | No | RequestBody | Filter by policy status, option: ENABLE or DISABLED |
| noticeState | String | No | RequestBody | Filter by notification status, option: ENABLE or DISABLED |
| orderBy | String | No | RequestBody | Sorting field, createdTime: Creation time, updatedTime: Update time, default value: updatedTime |
| order | String | No | RequestBody | Sorting method, asc: Ascending order, desc: Descending order, default value: desc |
| pageNo | Int | Yes | RequestBody | Page number, starting from 1 |
| pageSize | Int | Yes | RequestBody | Number of items per page, maximum: 100 |
Response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Field | Types | Description |
|---|---|---|
| success | Boolean | Whether the request succeeded |
| code | String | Request code, OK for success, or a specific error code for failure |
| message | String | Empty for request success, or a specific error message for request failure |
| result | Result | Alarm policy details |
The element structure of result object is as follows:
| Field | Types | Description |
|---|---|---|
| policies | List<Policy> | Alarm Strategy List |
| pageNo | Int | Page number |
| pageSize | Int | Number of items per page |
| totalCount | Int | Total |
The element structure of Policy object is as follows:
| Field | Types | Description |
|---|---|---|
| id | String | Alarm policy ID, unique |
| name | String | Alarm policy name, unique |
| objects | List<LogStore> | List of monitor objects. Fill in this field when all logstores share the target logstore. |
| targets | List<Target> | List of execution statements |
| triggerConditions | List<TriggerCondition> | List of trigger conditions |
| groups | List<String> | Group trigger |
| schedule | Schedule | Execution cycle |
| pendingCount | Int | Continuous trigger threshold, number of consecutive times the threshold is triggered before an alarm is raised |
| repeatIntervalMinute | Int | Repeat alarm interval, unit: minutes, default value: 0, which means repeat alarm is disabled |
| recoverWithoutNotice | Bool | Whether to notify after recovery, true: no notification, false: notification, defaulting to false |
| state | String | Policy activation status. ENABLED: Enabled; DISABLED: Disabled |
| noticeState | String | Notification activation status, ENABLED: Enabled; DISABLED: Disabled |
| notices | List<Notice> | Alarm notification template, reference: BCM Notification Template API |
| noticeRawLogs | List<NoticeRawLog> | Whether to include original logs in alarm notifications |
Each LogStore element structure in the objects array is as follows:
| Field | Types | Description |
|---|---|---|
| project | String | Logstore project, defaulting to "default" |
| logStoreName | String | Logstore name |
The element structure of each target in targets array is as follows:
| Parameter name | Types | Description |
|---|---|---|
| query | String | Execution statement |
| startTimeOffsetMinute | Int | Query start time offset, value range: [-1440, 0) |
| endTimeOffsetMinute | Int | Value range: (startTimeOffsetMinute, 0] |
| object | LogStore | Fill in this field when each execution statement specifies a logstore individually |
Each TriggerCondition element structure in the triggerConditions array is as follows:
| Parameter name | Types | Description |
|---|---|---|
| level | String | Alarm level, required. Options: INFO, WARN, and CRITICAL |
| condition | String | Trigger condition expression |
Schedule element structure is as follows:
| Parameter name | Types | Description |
|---|---|---|
| intervalMinute | Int | Fixed interval, unit: minutes, value range [1, 1440] |
| fixTimeMinute | Int | Specified time, minutes of the day, value range [0, 1440) |
| dayOfWeek | Int | Fixed time frequency; 0: Daily. 1~7 represents Monday to Sunday in a week |
Notice element structure is as follows:
| Parameter name | Types | Description |
|---|---|---|
| id | String | BCM alarm template ID |
The element structure of NoticeRawLog is as follows:
| Parameter name | Types | Description |
|---|---|---|
| type | String | Configuration type, REF: Associated execution statement, CUSTOM: Custom search statement |
| refTarget | String | If type=REF, it represents the referenced execution statement sequence number, counting from 0 |
| customTarget | Target | If type=CUSTOM, fill in the custom execution statement |
| columns | List<String> | List of field names displayed in the original logs. If not filled, all fields will be displayed |
| limit | Int | Number of logs displayed, maximum: 5 |
Error code
No special error codes are returned beyond standard error codes.
Example
- Request example
Text
1POST /v1/alarm/policy/list HTTP/1.1
2Host: bls-log.bj.baidubce.com
3Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
4Content-Type: application/json; charset=utf-8
5{
6 "pageNo": 1,
7 "pageSize": 10
8}
- Response example
Text
1HTTP/1.1 201
2Content-Type: application/json; charset=utf-8
3X-Bce-Request-Id: 2eeba101-4cc7-4cfe-b5ac-a3be8d060e33
4Date: Fri, 10 Apr 2020 04:42:37 GMT
5{
6 "success": true,
7 "code": "OK", // Error code
8 "message": "", // Error details
9 "result": {
10 "pageNo": 1, // Page number
11 "pageSize": 10, // Number of items per page
12 "totalCount": 100, // Total count
13 "policies": {
14 // Alarm policy name, unique under the same user
15 "name": "policy-name",
16 // Policy ID, unique under the same user
17 "id": "p-nRyKJOpr",
18 // policy enabled status, options:
19 // ENABLED - enabled
20 // DISABLED - disabled
21 "state": "ENABLED",
22 // Notification enabled status, options:
23 // ENABLED - enabled
24 // DISABLED - disabled
25 "noticeState": "ENABLED",
26 // Notification enabled status, options
27 // ENABLED - enabled
28 // DISABLED - disabled
29 "noticeState": "ENABLED",
30 "createdTime": "20240410T10:12:30Z", // Creation time, UTC time
31 "updatedTime": "20240410T10:12:30Z", // Update time, UTC time
32 // List of monitor objects. When all logstores share the target logstore, this field is populated
33 "objects": [
34 {
35 "logStoreName": "test-logstore-52" // Logstore name
36 },
37 ],
38 // List of execution statements
39 "targets": [
40 {
41 // Execution statement
42 "query": "select sum(age) as age",
43 // Query start time offset, required, value range: [-1440, 0)
44 "startTimeOffsetMinute": -1440,
45 // Query end time offset, required, value range: (startTimeOffsetMinute, 0]
46 "endTimeOffsetMinute": 0,
47 // Target logstore, When each execution statement specifies a logstore separately, this field is filled in
48 "object": {
49 "logStoreName": "test-logstore-52" // Logstore name
50 }
51 }
52 ],
53 // List of trigger conditions
54 "triggerConditions": [
55 {
56 // Alarm level, options:
57 // INFO - Notification,
58 // WARN - Warning
59 // CRITICAL - Critical
60 "level": "WARN",
61 // Trigger condition expression
62 "condition": "$1.age > 1"
63 }
64 ],
65 // Group trigger
66 "groups": ["$1.age", "$1.salary"],
67 // Execution cycle. Either fixed interval or specified time must be set, but not both
68 "schedule": {
69 // Fixed interval, unit: minutes, value range [1, 1440]
70 "intervalMinute": 1,
71 // Specified time, minutes of the day, value range [0, 1440)
72 "fixTimeMinute": 120, // In the example, 120 represents the 120th minute of the day, i.e., 2:00 AM
73 // Fixed time frequency; 0: Daily 1~7 represents Monday to Sunday in a week
74 "dayOfWeek": 3,
75 },
76 // Continuous trigger threshold, number of consecutive times the threshold is triggered before an alarm is raised
77 "pendingCount": 1,
78 // Repeat alarm interval, unit: minutes, default value: 0, which means repeat alarm is disabled
79 "repeatIntervalMinute": 5,
80 // Whether to notify after recovery, true: notify, false: do not notify, default
81 "recoverAlarmNotice": true,
82 // Alarm notification template list
83 "notices": [
84 {
85 // BCM alarm template ID
86 "id": "testNotice"
87 }
88 ],
89 // Whether to include the original log in the alarm content, false: do not include, default true: include
90 "noticeWithRawLog" : true,
91 // Alarm notification content configuration
92 "noticeRawConfigs" : [
93 {
94 // Configuration type, required
95 // REF Automatically associate execution statements
96 // CUSTOM Custom search statement
97 "type" : "CUSTOM",
98 // If type is REF, it represents the execution statement sequence number
99 "refTarget" : 1,
100 // If type is AUTO_ASSOCIATED, it represents a custom search statement
101 "query" : "match *",
102 // If each execution statement selects a logstore separately and is configured as a custom search statement, this represents the logstore
103 "object" : {
104 // Logstore project, required
105 "project" : "default",
106 // Logstore name, required
107 "logStoreName" : "bls-ng-log"
108 },
109 // Display fields, required
110 // All - All fields
111 // SpecifiedFields - Specified fields
112 "displayType" : "ALL",
113 // Specified field name list, optional
114 "display_fields" : ["requestid", "status"],
115 // Number of logs to display, maximum value is 5
116 "limit" : 4,
117 }
118 ]
119 }
120 }
121}
