Alarm Management API
Create Alarm Strategy
API description
Create Alarm Strategy
Request structure
- method:POST
- URL:/csm/api/v1/services/alarm/config/create
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| alarmConfig | AlarmConfig | Alarm configuration | Yes | RequestBody |
Request example
1POST /csm/api/v1/services/alarm/config/create
2body
3{
4 "alarmActions": [
5 "0262f103-****-****-****-078d0f2d80c5"
6 ],
7 "aliasName": "test_all_instance",
8 "level": "MAJOR",
9 "monitorObject": {
10 "names": [],
11 "type": "APP"
12 },
13 "okActions": [],
14 "region": "bj",
15 "rules": [
16 [
17 {
18 "comparisonOperator": ">",
19 "evaluationPeriodCount": 10,
20 "index": 1,
21 "metric": "OutBytes",
22 "metricDimensions": [],
23 "periodInSecond": 900,
24 "statistics": "average",
25 "threshold": "1111"
26 }
27 ]
28 ],
29 "scope": "BCE_CDN",
30 "srcType": "ALL_INSTANCE",
31 "type": "NORMAL",
32 "userId": "453bf9********************9090dc"
33}
Delete Alarm Strategy
API description
Delete Alarm Strategy
Request structure
- method:POST
- URL: /csm/api/v1/services/alarm/config/delete?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | No | Query |
| scope | String | Cloud Product Scope, limited to the following character set: 0~9, A~Z, a~z, _ | No | Query |
| alarmName | String | Alarm name | No | Query |
Request example
For clarity, the request example has been line-wrapped. In actual request construction, the URL path and query parameters should be written on a single line.
1POST /csm/api/v1/services/alarm/config/delete?
2userId=453bf9********************9090dc
3&scope=BCE_CDN
4&alarmName=b9444b********************f04dac
Update Alarm Strategy
API description
Edit Alarm Strategy
Request structure
- method:POST
- URL:/csm/api/v1/services/alarm/config/update
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| alarmConfig | AlarmConfig | Alarm configuration | Yes | RequestBody |
Request example
1POST /csm/api/v1/services/alarm/config/update
2body
3{
4 "alarmActions": [
5 "0262f103-****-****-****-078d0f2d80c5"
6 ],
7 "alarmName": "b9444b********************f04dac",
8 "aliasName": "fgh678",
9 "level": "MAJOR",
10 "monitorObject": {
11 "names": [],
12 "type": "APP"
13 },
14 "okActions": [],
15 "region": "bj",
16 "rules": [
17 [
18 {
19 "comparisonOperator": ">=",
20 "evaluationPeriodCount": 1,
21 "index": 1,
22 "metric": "OutBytes",
23 "metricDimensions": [],
24 "periodInSecond": 60,
25 "statistics": "average",
26 "threshold": "11"
27 }
28 ]
29 ],
30 "scope": "BCE_CDN",
31 "srcType": "ALL_INSTANCE",
32 "type": "NORMAL",
33 "userId": "453bf9********************9090dc"
34}
Shield Alarm Strategy
API description
Shield Alarm Strategy
Request structure
- method:POST
- URL: /csm/api/v1/services/alarm/config/block?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | No | Query |
| scope | String | Cloud Product Scope, limited to the following character set: 0~9, A~Z, a~z, _ | No | Query |
| alarmName | String | Alarm name | No | Query |
Request example
For clarity, the request example has been line-wrapped. In actual request construction, the URL path and query parameters should be written on a single line.
1POST /csm/api/v1/services/alarm/config/block?
2userId=453bf9********************9090dc
3&scope=BCE_CDN
4&alarmName=b9444b********************f04dac
Enable alarm configuration
API description
Enable alarm notification
Request structure
- method:POST
- URL: /csm/api/v1/services/alarm/config/unblock?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | No | Query |
| scope | String | Cloud Product Scope, limited to the following character set: 0~9, A~Z, a~z, _ | No | Query |
| alarmName | String | Alarm name | No | Query |
Request example
For clarity, the request example has been line-wrapped. In actual request construction, the URL path and query parameters should be written on a single line.
1POST /csm/api/v1/services/alarm/config/unblock?
2userId=453bf9********************9090dc
3&scope=BCE_CDN
4&alarmName=b9444b********************f04dac
View Alarm Strategy
API description
View Alarm Strategy details
Request structure
- Method:GET
- URL: /csm/api/v1/services/alarm/config?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Query |
| scope | String | Cloud Product Scope, limited to the following character set: 0~9, A~Z, a~z, _ | Yes | Query |
| alarmName | String | Alarm name | Yes | Query |
Return field description
| Types | Description |
|---|---|
| AlarmConfig | Alarm configuration |
Request example
For clarity, the request example has been line-wrapped. In actual request construction, the URL path and query parameters should be written on a single line.
1GET /csm/api/v1/services/alarm/config?
2alarmName=AllDomain-102
3&scope=BCE_CDN
4&userId=453bf9********************9090dc
Response example
Successful response example
1{
2 "alarmDescription": "",
3 "alarmName": "AllDomain-102",
4 "aliasName": "AllDomain-102",
5 "userId": "453bf9********************9090dc",
6 "scope": "BCE_CDN",
7 "region": "bj",
8 "monitorObject": {
9 "type": "INSTANCE",
10 "names": [
11 "DomainId:www.****.com"
12 ],
13 "typeName": "Instance"
14 },
15 "type": "NORMAL",
16 "level": "MAJOR",
17 "actionEnabled": true,
18 "rules": [
19 [
20 {
21 "id": null,
22 "index": 0,
23 "metric": "HttpRetCodeCount4xx",
24 "periodInSecond": 60,
25 "statistics": "maximum",
26 "threshold": "1 ",
27 "comparisonOperator": ">=",
28 "evaluationPeriodCount": 1,
29 "metricDimensions": []
30 },
31 {
32 "id": null,
33 "index": 0,
34 "metric": "HttpRetCodeCount4xx",
35 "periodInSecond": 60,
36 "statistics": "maximum",
37 "threshold": "3",
38 "comparisonOperator": ">=",
39 "evaluationPeriodCount": 1,
40 "metricDimensions": []
41 }
42 ]
43 ],
44 "alarmActions": [
45 "edd825df-****-****-****-181ef0953523"
46 ],
47 "okActions": [],
48 "insufficientActions": [],
49 "insufficientCycle": 60,
50 "srcName": "",
51 "srcType": "",
52 "repeatAlarmCycle": 300,
53 "maxRepeatCount": 2,
54 "callbackUrl": "",
55 "callbackToken": ""
56}
Unsuccessful response example
Case 1: Incorrect parameters. The following example is missing a scope value.
1{
2 "requestId": "4d619a********************9ff6db",
3 "code": "ServletRequestBinding",
4 "message": "Servlet Request Binding Exception: Required String parameter 'scope' is not present"
5}
Case 2: Incorrect parameter format. The following example shows a scope error.
1{
2 "requestId": "4d619a********************9ff6db",
3 "code": "ResourceNotExistException",
4 "message": "The resource does not exist."
5}
View Alarm List API for a Single Instance
API description
View Alarm Strategy List for a Single Instance
Request structure
- Method:GET
- URL: /csm/api/v1/services/alarm/config/list?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Query |
| scope | String | Cloud Product Scope, limited to the following character set: 0~9, A~Z, a~z, _ | Yes | Query |
| region | String | Region, default: bj | No | Query |
| dimensions | String | A dimension consists of dimensionName:dimensionValue. When a metric includes multiple dimensions, connect them using semicolons, e.g., dimensionName:dimensionValue;dimensionName:dimensionValue. Only one value can be specified per dimension. | No | Query |
| order | String | Sorting method | Yes | Query |
| pageSize | int | Number per page | Yes | Query |
| pageNo | int | Page number | Yes | Query |
| actionEnabled | boolean | Whether it is enabled | No | Query |
| alarmNamePrefix | String | Alarm name prefix | No | Query |
Parameter explanation
- For concepts like Scope, Metric, Statistic, and Dimension, refer to Core Concepts.
Return field description
| Types | Description |
|---|---|
| PageResultResponse<AlarmConfig> | Alarm Strategy List |
Request example
For clarity, the request example has been line-wrapped. In actual request construction, the URL path and query parameters should be written on a single line.
1GET /csm/api/v1/services/alarm/config/list?
2userId=453bf9********************9090dc
3&pageSize=10
4&pageNo=1
5&scope=BCE_CDN
6&order=desc
7&dimensions=DomainId%3Abcm5-********.sys-qa.com
8&actionEnabled=
9&alarmNamePrefix=
10®ion=bj
Response example
Successful response example
1{
2 "orderBy": "",
3 "order": "",
4 "pageNo": 1,
5 "pageSize": 10,
6 "totalCount": 599,
7 "result": [
8 {
9 "alarmDescription": "",
10 "alarmName": "025bc1********************5093c0",
11 "aliasName": "test_cdn_ymd_0831_01",
12 "userId": "453bf9********************9090dc",
13 "scope": "BCE_CDN",
14 "region": "bj",
15 "monitorObject": {
16 "type": "INSTANCE",
17 "names": [
18 "DomainId:bcm5-********.sys-qa.com"
19 ],
20 "typeName": "Instance"
21 },
22 "type": "NORMAL",
23 "level": "MAJOR",
24 "actionEnabled": true,
25 "rules": [
26 [
27 {
28 "id": null,
29 "index": 0,
30 "metric": "ProvIspReqCount",
31 "periodInSecond": 60,
32 "statistics": "average",
33 "threshold": "10",
34 "comparisonOperator": ">",
35 "evaluationPeriodCount": 1,
36 "metricDimensions": [
37 {
38 "name": "Isp",
39 "value": "pbs"
40 },
41 {
42 "name": "Prov",
43 "value": "hubei"
44 }
45 ]
46 },
47 {
48 "id": null,
49 "index": 0,
50 "metric": "ProvIspReqCount",
51 "periodInSecond": 60,
52 "statistics": "average",
53 "threshold": "5",
54 "comparisonOperator": ">",
55 "evaluationPeriodCount": 1,
56 "metricDimensions": [
57 {
58 "name": "Isp",
59 "value": "pbs"
60 },
61 {
62 "name": "Prov",
63 "value": "beijing"
64 }
65 ]
66 }
67 ]
68 ],
69 "alarmActions": [
70 "yangmoda_test"
71 ],
72 "okActions": [],
73 "insufficientActions": [],
74 "insufficientCycle": 0,
75 "srcName": "",
76 "srcType": "INSTANCE",
77 "repeatAlarmCycle": 0,
78 "maxRepeatCount": 0,
79 "callbackUrl": "",
80 "callbackToken": ""
81 },
82 ...
83 {
84 "alarmDescription": "",
85 "alarmName": "ba39ee********************ad28aa",
86 "aliasName": "TestCDNRepeat0824_3",
87 "userId": "453bf9********************9090dc",
88 "scope": "BCE_CDN",
89 "region": "bj",
90 "monitorObject": {
91 "type": "INSTANCE",
92 "names": [
93 "DomainId:bcm5-********.sys-qa.com"
94 ],
95 "typeName": "Instance"
96 },
97 "type": "NORMAL",
98 "level": "MAJOR",
99 "actionEnabled": true,
100 "rules": [
101 [
102 {
103 "id": null,
104 "index": 0,
105 "metric": "OutBytes",
106 "periodInSecond": 60,
107 "statistics": "average",
108 "threshold": "3",
109 "comparisonOperator": ">",
110 "evaluationPeriodCount": 1,
111 "metricDimensions": []
112 }
113 ]
114 ],
115 "alarmActions": [
116 "test_wenqing"
117 ],
118 "okActions": [],
119 "insufficientActions": [],
120 "insufficientCycle": 0,
121 "srcName": "",
122 "srcType": "INSTANCE",
123 "repeatAlarmCycle": 300,
124 "maxRepeatCount": 5,
125 "callbackUrl": "",
126 "callbackToken": ""
127 }
128 ]
129}
Unsuccessful response example
Case 1: Incorrect parameters. pageSize is empty.
1{
2 "requestId": "4a7643********************7ae904",
3 "code": "ServletRequestBinding",
4 "message": "Servlet Request Binding Exception: Required Integer parameter 'pageSize' is not present"
5}
Get Metric List
API description
Get Metric List
Request structure
- method:GET
- URL: /csm/api/v1/services/alarm/config/metrics?{Query}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Query |
| scope | String | Cloud Product Scope, limited to the following character set: 0~9, A~Z, a~z, _ | Yes | Query |
| region | String | Region | Yes | Query |
| dimensions | String | A dimension consists of dimensionName:dimensionValue. When a metric includes multiple dimensions, connect them using semicolons, e.g., dimensionName:dimensionValue;dimensionName:dimensionValue. Only one value can be specified per dimension. | No | Query |
| type | String | Type for obtaining the Metric list, default: INSTANCE | No | Query |
| locale | String | Country/Region, default: zh-cn | No | Query |
Return field description
| Types | Description |
|---|---|
| List<AlarmMetric> | Alarm Metric List |
Request example
1GET /csm/api/v1/services/alarm/config/metrics?
2userId=453bf9********************9090dc
3scope=BCE_CDN
4region=bj
Response example
1[
2 {
3 alias: Traffic,
4 "name": "OutBytes",
5 "unitCategory": "Percent",
6 "unitName": "Bytes",
7 "cycle": 60,
8 "metricDimensions": [
9 []
10 ],
11 "scope": "BCE_CDN",
12 "typeName": "Instance"
13 },
14 ...
15 {
16 alias: Valid requests by province and carrier,
17 "name": "ProvIspReqCount",
18 "unitCategory": "Percent",
19 unitName: times,
20 "cycle": 60,
21 "metricDimensions": [
22 [
23 "Prov",
24 "Isp"
25 ]
26 ],
27 "scope": "BCE_CDN",
28 "typeName": "Instance"
29 }
30]
Appendix
AlarmConfig
| Name | Types | Description |
|---|---|---|
| alarmDescription | String | Automatically generated, alarm rule description |
| alarmName | String | Unique alarm name under userId |
| aliasName | String | For frontend display use, duplicates are allowed |
| userId | String | User ID |
| scope | String | Associated Cloud Product Scope |
| region | String | Region |
| monitorObject | MonitorObject | Monitor Object |
| type | AlarmType(enum) | Alarm type, options: NORMAL (Metric alarm) EVENT (Event alarm) |
| eventTypeList | List< String > | Event type list |
| level | AlarmLevel(enum) | Alarm levels, options: NOTICE (Notice) WARNING (Warning) MAJOR (Major) CRITICAL (Critical) |
| actionEnabled | Boolean | Alarm notification status |
| rules | List< List<AlarmRule> > | Alarm rule list |
| alarmActions | Set< String > | Actions to be taken in the alarm status |
| okActions | Set< String > | Actions to be taken in the normal status |
| insufficientActions | Set< String > | Actions under insufficient data collection status |
| insufficientCycle | int | No-data alarm judgment period |
| srcName | String | Instance group ID |
| srcType | String | Instance group type |
| repeatAlarmCycle | int | Repeated alarm period |
| maxRepeatCount | int | Maximum alarm repetition count |
| callbackUrl | String | Alarm callback address |
| callbackToken | String | Alarm callback token |
MonitorObject
| Name | Types | Description |
|---|---|---|
| type | MonitorObjectType(enum) | Monitor Object cloud service types, options: APP (Application Monitor type) SERVICE (Instance Group type) CUSTOM (Custom Monitor type) INSTANCE (Instance type) DOMAIN (Site Monitor type) |
| names | List< String > | Monitor Object name list |
| resources | List<PolicyResource> | Monitor Object resource list |
| typeName | String | Monitor Object type name |
AlarmRule
| Name | Types | Description |
|---|---|---|
| id | long | Alarm rule ID |
| index | long | Alarm rule index. When multiple rules collectively form the same alarm rule, they share the same index |
| metric | String | Monitor Metric name |
| periodInSecond | long | Interval for evaluating whether each alarm rule is satisfied, i.e., the duration of a single evaluation period, unit: s |
| statistics | String | Statistic method, options: maximum, minimum, sum, and average |
| threshold | String | Alarm rule threshold |
| comparisonOperator | String | Operators for comparison with thresholds, with values of >=, >, =, <, <= |
| evaluationPeriodCount | int | Number of consecutive occurrences required to trigger an alarm |
| metricDimensions | List<Dimension> | Metric dimension |
PolicyResource
| Name | Types | Description |
|---|---|---|
| identifiers | List<Dimension> | Instance dimension list |
| metricDimensions | List<Dimension> | Metric dimension list |
Dimension
| Name | Types | Description |
|---|---|---|
| name | String | Metric name |
| value | String | Metric dimension |
AlarmMetric
| Name | Types | Description |
|---|---|---|
| alias | String | Metric frontend display naming |
| name | String | Monitor Metric name |
| unitCategory | String | Unit category |
| unitName | String | Unit name |
| cycle | int | Interval for evaluating whether each alarm rule is satisfied, i.e., the duration of a single evaluation period, unit: s |
| metricDimensions | Set< MetricDimensions > | Metric dimension |
| scope | String | Cloud Product Scope, limited to the following character set: 0~9, A~Z, a~z, _ |
| typeName | String | Alarm metric type name |
pageInfo
| Name | Types | Description |
|---|---|---|
| perPage | int | Number per page |
| totalCount | int | Total number of pages |
| currentPage | int | Current page number |
PageResultResponse
| Name | Types | Description |
|---|---|---|
| orderBy | String | Sorting rules |
| order | String | Sorting items |
| pageNo | int | Current page |
| pageSize | int | Number per page |
| totalCount | int | Total number of pages |
| result | List< T > | Result set |
