Alarm Management Interface V2
Updated at:2025-11-03
Create Alarm Strategy
Request structure
- method:POST
- URL:/csm/api/v2/userId/{userId}/services/{service}/alarm/config/create
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Path |
| service | String | Cloud product name | Yes | Path |
| alarmConfigV2 | AlarmConfigV2 | Alarm configuration | Yes | RequestBody |
Request example
JSON
1{
2 "userId": "453bf9********************9090dc",
3 aliasName: Virtual Machine CPU Monitor,
4 "region": "bj",
5 "scope": "BCE_BCC",
6 "policies": [
7 {
8 "rules": [
9 {
10 "metricName": "CpuUsage",
11 "metricDimensions": [],
12 "operator": ">",
13 "statistics": "average",
14 "threshold": 80,
15 "window": 60,
16 },
17 ],
18 "alarmPendingPeriodCount": 3
19 }
20 ],
21
22 "insufficientDataPendingPeriod": 300,
23 "alarmRepeatInterval": 300,
24 "alarmRepeatCount": 10,
25 "targetType": "TARGET_TYPE_MULTI_INSTANCES",
26 "targetInstances": [
27 {
28 "region": "bj",
29 "identifiers": [
30 {
31 "key": "InstanceId",
32 "value": "i-FYc6EU**"
33 }
34 ]
35 }
36 ],
37 "resourceType": "Instance",
38 "alarmLevel": "NOTICE",
39 "actions": [
40 {
41 "name": "notifyRdTeam",
42 "id": "0262f103-****-****-****-078d0f2d80c5",
43 },
44 ]
45}
Response example
Successful response example
JSON
1{
2 "success": true,
3 "msg": "",
4 "result": {
5 // Strategy name, a unique index for the Alarm Strategy, used for subsequent deletion and update operations
6 "alarmName": "5cc380********************268123",
7 }
8}
Unsuccessful response example
JSON
1{
2 "success": false,
3 "msg": "Invalid parameter, aliasName is empty!",
4 "result": {
5 "alarmName": null
6 }
7}
Update Alarm Strategy
Request structure
- method:PUT
- URL:/csm/api/v2/userId/{userId}/services/{service}/alarm/config/update
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Path |
| service | String | Cloud product name | Yes | Path |
| alarmConfigV2 | AlarmConfigV2 | Alarm configuration | Yes | RequestBody |
Request example
JSON
1// Request
2{
3 // Strategy name, returned by the strategy creation API
4 "alarmName": "5cc380********************268123",
5
6 // Other fields are the same as the strategy creation API
7 // Note: Currently, Alarm Strategy does not support partial updates; only full updates are allowed
8}
Shield Alarm Strategy
Request structure
- method:POST
- URL: /csm/api/v2/userId/{userId}/services/{service}/alarm/config/block?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Path |
| service | String | Cloud product name | Yes | Path |
| alarmName | String | Strategy name (refer to the value returned by the Alarm Strategy creation API) | Yes | Query |
Request example
JSON
1POST /csm/api/v2/userId/453bf9********************9090dc/services/BCE_BCC/alarm/config/block?
2alarmName=5cc380********************268123
Enable Alarm Strategy
Request structure
- method:POST
- URL: /csm/api/v2/userId/{userId}/services/{service}/alarm/config/unblock?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Path |
| service | String | Cloud product name | Yes | Path |
| alarmName | String | Strategy name (refer to the value returned by the Alarm Strategy creation API) | Yes | Query |
Request example
JSON
1POST /csm/api/v2/userId/453bf9********************9090dc/services/BCE_BCC/alarm/config/unblock?
2alarmName=5cc380********************268123
View Alarm Strategy
Request structure
- Method:GET
- URL: /csm/api/v2/userId/{userId}/services/{service}/alarm/config?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Query |
| service | String | Cloud product name | Yes | Query |
| alarmName | String | Alarm name | Yes | Query |
Request example
JSON
1GET /csm/api/v2/userId/453bf9********************9090dc/services/BCE_BCC/alarm/config?
2alarmName=5cc380********************268123
Response example
JSON
1{
2 alarmName: 5cc380********************268123, // Unique identifier for Alarm Strategy, UUID type
3 // For other fields, refer to AlarmConfigV2 in the appendix
4}
View Alarm Strategy List
Request structure
- Method:GET
- URL: /csm/api/v2/userId/{userId}/services/{service}/alarm/config/list?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID is used to specify the user being queried. | Yes | Query |
| service | String | Cloud product for which alerts need to be queried, based on the scope parameter | Yes | Query |
| order | String | Sorting method (e.g., ascending or descending). | Yes | Query |
| pageNo | Integer | Page number for pagination queries | Yes | Query |
| pageSize | Integer | Number of entries returned per page | Yes | Query |
| scope | String | Specify cloud product for alerts | No | Query |
| region | String | Specify the region to which the alert belongs | No | Query |
| dimensions | String | Filter Alerts by specified Dimensions | No | Query |
| metricDimensions | String | Filter Alerts by Metric Dimensions | No | Query |
| actionEnabled | Boolean | Whether Alert is enabled | No | Query |
| typeName | String | Resource Type of Alert | No | Query |
| id | String | ID | Resource ID | Query |
| uuid | String | UUID | Resource UUID | Query |
| alarmNamePrefix | String | Alarm name prefix, enabling fuzzy queries | No | Query |
Request example
JSON
1GET /csm/api/v2/userId/453bf**********9090dc/services/BCE_BCC/alarm/config/list?order=desc&pageNo=1&pageSize=2®ion=bj&typeName=Instance&id=i-O8WtQNyQ
Response example
JSON
1// Response
2{
3 "orderBy": "",
4 "order": "",
5 "pageNo": 1,
6 "pageSize": 2,
7 "totalCount": 455,
8 "result": [
9 {
10 "userId": "453bf95**************090dc",
11 "aliasName": "test-gz-rmq-0311",
12 "alarmName": "85ffe3ee34bf4ab0bcf0958d33c461cb",
13 "scope": "BCE_ROCKETMQ",
14 "targetType": "TARGET_TYPE_ALL_INSTANCES",
15 "resourceType": "Cluster",
16 "alarmLevel": "MAJOR",
17 "targetInstanceGroups": [],
18 "targetInstanceTags": [],
19 "callbackUrl": "",
20 "callbackToken": "",
21 "insufficientDataPendingPeriod": 0,
22 "alarmRepeatInterval": 0,
23 "alarmRepeatCount": 0,
24 "source": "",
25 "alarmMergeIntervalSecond": 0,
26 "policies": [
27 {
28 "rules": [
29 {
30 "metricName": "ClusterTopicCount",
31 "metricDimensions": [],
32 "operator": ">",
33 "statistics": "average",
34 "threshold": 50.0,
35 "window": 60
36 }
37 ],
38 "alarmPendingPeriodCount": 1
39 }
40 ],
41 "targetInstances": [],
42 "actions": []
43 },
44 {
45 "userId": "453bf9588c9e488f9ba2c984129090dc",
46 "aliasName": "sandbox_test_notify",
47 "alarmName": "34cf2c7f34b447fb86ee51203931ab2c",
48 "scope": "BCE_BCC",
49 "targetType": "TARGET_TYPE_MULTI_INSTANCES",
50 "resourceType": "Instance",
51 "alarmLevel": "MAJOR",
52 "targetInstanceGroups": [],
53 "targetInstanceTags": [],
54 "callbackUrl": "",
55 "callbackToken": "",
56 "insufficientDataPendingPeriod": 0,
57 "alarmRepeatInterval": 0,
58 "alarmRepeatCount": 0,
59 "source": "",
60 "alarmMergeIntervalSecond": 0,
61 "policies": [
62 {
63 "rules": [
64 {
65 "metricName": "CPUUsagePercent",
66 "metricDimensions": [],
67 "operator": ">",
68 "statistics": "average",
69 "threshold": 0.0,
70 "window": 60
71 }
72 ],
73 "alarmPendingPeriodCount": 1
74 }
75 ],
76 "targetInstances": [
77 {
78 "region": "bj",
79 "identifiers": [
80 {
81 "key": "InstanceId",
82 "value": "i-O8WtQNyQ"
83 }
84 ],
85 "metricDimensions": []
86 },
87 {
88 "region": "bj",
89 "identifiers": [
90 {
91 "key": "InstanceId",
92 "value": "i-Hk4ejWVT"
93 }
94 ],
95 "metricDimensions": []
96 },
97 {
98 "region": "bj",
99 "identifiers": [
100 {
101 "key": "InstanceId",
102 "value": "i-amuAeiKM"
103 }
104 ],
105 "metricDimensions": []
106 },
107 {
108 "region": "bj",
109 "identifiers": [
110 {
111 "key": "InstanceId",
112 "value": "i-M96hN3s1"
113 }
114 ],
115 "metricDimensions": []
116 },
117 {
118 "region": "bj",
119 "identifiers": [
120 {
121 "key": "InstanceId",
122 "value": "i-wAxU6sDS"
123 }
124 ],
125 "metricDimensions": []
126 }
127 ],
128 "actions": []
129 }
130 ]
131}
Appendix
AlarmConfigV2
| Name | Types | Description |
|---|---|---|
| userId | String | User ID, required |
| aliasName | String | Alarm Strategy display name, required |
| region | String | Region to which the Alarm Strategy belongs, required. For multi-instance type Alarm Strategies, the Region here must be consistent with the Region to which the Instance belongs |
| scope | String | Cloud Product Name, required |
| insufficientDataPendingPeriod | int | No-data check period, unit: second, optional; if not set or set to 0, no-data alarm is disabled |
| alarmRepeatInterval | int | Repeated alarm period, value must be ≥ 300, unit: second, optional. If not set or set to 0, repeated alarm is disabled |
| alarmRepeatCount | int | Maximum number of repeated alarms, optional |
| resourceType | String | Sub-product type of the cloud product, optional, default value: Instance |
| alarmLevel | String | Alarm level, optional, default: CRITICAL, options: NOTICE (Notice), WARNING (Warning), MAJOR (Major), CRITICAL (Critical) |
| targetType | String | Alarm target type, required, options: TARGET_TYPE_ALL_INSTANCES (All Instances) TARGET_TYPE_INSTANCE_GROUP (Instance Group) TARGET_TYPE_MULTI_INSTANCES (Multiple Instances) TARGET_TYPE_INSTANCE_TAGS (Tags)) |
| targetInstanceGroups | List<String> | Alarm Instance Group list, required if targetType=TARGET_TYPE_INSTANCE_GROUP |
| targetInstances | List<AlarmInstanceV2> | Alarm Instance list, required if targetType=TARGET_TYPE_MULTI_INSTANCES |
| targetInstanceTags | List<CommonKV> | Alarm tag list, required if targetType=TARGET_TYPE_INSTANCE_TAGS |
| policies | List<AlarmPolicyV2> | Alarm Strategy list, required. Multiple strategies are in an OR relationship |
| actions | List<AlarmActionV2> | Notification Template list, required. This template list will be uniformly used for anomaly notifications, recovery notifications, and repeated alarm notifications |
AlarmPolicyV2
| Name | Types | Description |
|---|---|---|
| rules | List<AlarmConfigPolicyRuleV2> | Alarm rule list, required. Multiple rules are in an AND relationship |
| alarmPendingPeriodCount | int | Trigger alarm after consecutive alarmPendingPeriodCount detection anomalies, required, value must be greater than 0 |
AlarmConfigPolicyRuleV2
| Name | Types | Description |
|---|---|---|
| metricName | String | Metric name, required |
| metricDimensions | List<CommonKV> | Metric dimension, optional |
| operator | String | Threshold comparison method, required, options: 1. General comparison operators: >, >=, =, <, <=, != 2. MoM comparison operators: MoM increase >, MoM increase >=, MoM increase =, MoM increase <, MoM increase <=, MoM increase !=, MoM decrease >, MoM decrease >=, MoM decrease =, MoM decrease <, MoM decrease <=, MoM decrease != |
| statistics | String | Metric aggregation method, required, options: average, maximum, minimum, and sum |
| threshold | double | Alarm threshold, required |
| window | int | Metric aggregation window, unit: second, optional, default value: 60 |
AlarmActionV2
| Name | Types | Description |
|---|---|---|
| name | String | Notification Template name, required, Template names can be duplicated |
| id | String | Notification Template ID, optional |
AlarmInstanceV2
| Name | Types | Description |
|---|---|---|
| region | String | Region, required |
| identifiers | List<CommonKV> | Instance dimension, required |
| metricDimensions | List<CommonKV> | Metric dimension, optional |
CommonKV
| Name | Types |
|---|---|
| key | String |
| value | String |
