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
POST /csm/api/v1/services/alarm/config/create
body
{
"alarmActions": [
"0262f103-****-****-****-078d0f2d80c5"
],
"aliasName": "test_all_instance",
"level": "MAJOR",
"monitorObject": {
"names": [],
"type": "APP"
},
"okActions": [],
"region": "bj",
"rules": [
[
{
"comparisonOperator": ">",
"evaluationPeriodCount": 10,
"index": 1,
"metric": "OutBytes",
"metricDimensions": [],
"periodInSecond": 900,
"statistics": "average",
"threshold": "1111"
}
]
],
"scope": "BCE_CDN",
"srcType": "ALL_INSTANCE",
"type": "NORMAL",
"userId": "453bf9********************9090dc"
}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.
POST /csm/api/v1/services/alarm/config/delete?
userId=453bf9********************9090dc
&scope=BCE_CDN
&alarmName=b9444b********************f04dacUpdate 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
POST /csm/api/v1/services/alarm/config/update
body
{
"alarmActions": [
"0262f103-****-****-****-078d0f2d80c5"
],
"alarmName": "b9444b********************f04dac",
"aliasName": "fgh678",
"level": "MAJOR",
"monitorObject": {
"names": [],
"type": "APP"
},
"okActions": [],
"region": "bj",
"rules": [
[
{
"comparisonOperator": ">=",
"evaluationPeriodCount": 1,
"index": 1,
"metric": "OutBytes",
"metricDimensions": [],
"periodInSecond": 60,
"statistics": "average",
"threshold": "11"
}
]
],
"scope": "BCE_CDN",
"srcType": "ALL_INSTANCE",
"type": "NORMAL",
"userId": "453bf9********************9090dc"
}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.
POST /csm/api/v1/services/alarm/config/block?
userId=453bf9********************9090dc
&scope=BCE_CDN
&alarmName=b9444b********************f04dacEnable 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.
POST /csm/api/v1/services/alarm/config/unblock?
userId=453bf9********************9090dc
&scope=BCE_CDN
&alarmName=b9444b********************f04dacView 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.
GET /csm/api/v1/services/alarm/config?
alarmName=AllDomain-102
&scope=BCE_CDN
&userId=453bf9********************9090dcResponse example
Successful response example
{
"alarmDescription": "",
"alarmName": "AllDomain-102",
"aliasName": "AllDomain-102",
"userId": "453bf9********************9090dc",
"scope": "BCE_CDN",
"region": "bj",
"monitorObject": {
"type": "INSTANCE",
"names": [
"DomainId:www.****.com"
],
"typeName": "Instance"
},
"type": "NORMAL",
"level": "MAJOR",
"actionEnabled": true,
"rules": [
[
{
"id": null,
"index": 0,
"metric": "HttpRetCodeCount4xx",
"periodInSecond": 60,
"statistics": "maximum",
"threshold": "1 ",
"comparisonOperator": ">=",
"evaluationPeriodCount": 1,
"metricDimensions": []
},
{
"id": null,
"index": 0,
"metric": "HttpRetCodeCount4xx",
"periodInSecond": 60,
"statistics": "maximum",
"threshold": "3",
"comparisonOperator": ">=",
"evaluationPeriodCount": 1,
"metricDimensions": []
}
]
],
"alarmActions": [
"edd825df-****-****-****-181ef0953523"
],
"okActions": [],
"insufficientActions": [],
"insufficientCycle": 60,
"srcName": "",
"srcType": "",
"repeatAlarmCycle": 300,
"maxRepeatCount": 2,
"callbackUrl": "",
"callbackToken": ""
}Unsuccessful response example
Case 1: Incorrect parameters. The following example is missing a scope value.
{
"requestId": "4d619a********************9ff6db",
"code": "ServletRequestBinding",
"message": "Servlet Request Binding Exception: Required String parameter 'scope' is not present"
}Case 2: Incorrect parameter format. The following example shows a scope error.
{
"requestId": "4d619a********************9ff6db",
"code": "ResourceNotExistException",
"message": "The resource does not exist."
}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.
GET /csm/api/v1/services/alarm/config/list?
userId=453bf9********************9090dc
&pageSize=10
&pageNo=1
&scope=BCE_CDN
&order=desc
&dimensions=DomainId%3Abcm5-********.sys-qa.com
&actionEnabled=
&alarmNamePrefix=
®ion=bjResponse example
Successful response example
{
"orderBy": "",
"order": "",
"pageNo": 1,
"pageSize": 10,
"totalCount": 599,
"result": [
{
"alarmDescription": "",
"alarmName": "025bc1********************5093c0",
"aliasName": "test_cdn_ymd_0831_01",
"userId": "453bf9********************9090dc",
"scope": "BCE_CDN",
"region": "bj",
"monitorObject": {
"type": "INSTANCE",
"names": [
"DomainId:bcm5-********.sys-qa.com"
],
"typeName": "Instance"
},
"type": "NORMAL",
"level": "MAJOR",
"actionEnabled": true,
"rules": [
[
{
"id": null,
"index": 0,
"metric": "ProvIspReqCount",
"periodInSecond": 60,
"statistics": "average",
"threshold": "10",
"comparisonOperator": ">",
"evaluationPeriodCount": 1,
"metricDimensions": [
{
"name": "Isp",
"value": "pbs"
},
{
"name": "Prov",
"value": "hubei"
}
]
},
{
"id": null,
"index": 0,
"metric": "ProvIspReqCount",
"periodInSecond": 60,
"statistics": "average",
"threshold": "5",
"comparisonOperator": ">",
"evaluationPeriodCount": 1,
"metricDimensions": [
{
"name": "Isp",
"value": "pbs"
},
{
"name": "Prov",
"value": "beijing"
}
]
}
]
],
"alarmActions": [
"yangmoda_test"
],
"okActions": [],
"insufficientActions": [],
"insufficientCycle": 0,
"srcName": "",
"srcType": "INSTANCE",
"repeatAlarmCycle": 0,
"maxRepeatCount": 0,
"callbackUrl": "",
"callbackToken": ""
},
...
{
"alarmDescription": "",
"alarmName": "ba39ee********************ad28aa",
"aliasName": "TestCDNRepeat0824_3",
"userId": "453bf9********************9090dc",
"scope": "BCE_CDN",
"region": "bj",
"monitorObject": {
"type": "INSTANCE",
"names": [
"DomainId:bcm5-********.sys-qa.com"
],
"typeName": "Instance"
},
"type": "NORMAL",
"level": "MAJOR",
"actionEnabled": true,
"rules": [
[
{
"id": null,
"index": 0,
"metric": "OutBytes",
"periodInSecond": 60,
"statistics": "average",
"threshold": "3",
"comparisonOperator": ">",
"evaluationPeriodCount": 1,
"metricDimensions": []
}
]
],
"alarmActions": [
"test_wenqing"
],
"okActions": [],
"insufficientActions": [],
"insufficientCycle": 0,
"srcName": "",
"srcType": "INSTANCE",
"repeatAlarmCycle": 300,
"maxRepeatCount": 5,
"callbackUrl": "",
"callbackToken": ""
}
]
}Unsuccessful response example
Case 1: Incorrect parameters. pageSize is empty.
{
"requestId": "4a7643********************7ae904",
"code": "ServletRequestBinding",
"message": "Servlet Request Binding Exception: Required Integer parameter 'pageSize' is not present"
}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
GET /csm/api/v1/services/alarm/config/metrics?
userId=453bf9********************9090dc
scope=BCE_CDN
region=bjResponse example
[
{
alias: Traffic,
"name": "OutBytes",
"unitCategory": "Percent",
"unitName": "Bytes",
"cycle": 60,
"metricDimensions": [
[]
],
"scope": "BCE_CDN",
"typeName": "Instance"
},
...
{
alias: Valid requests by province and carrier,
"name": "ProvIspReqCount",
"unitCategory": "Percent",
unitName: times,
"cycle": 60,
"metricDimensions": [
[
"Prov",
"Isp"
]
],
"scope": "BCE_CDN",
"typeName": "Instance"
}
]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 |
