Alarm History-related APIs
Updated at:2025-11-03
Alarm History-related APIs
Alarm History List Query APIs
API description
This API retrieves the Alarm History List information for Cloud Product Monitor, Site Monitor, and associated alarms.
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | RequestBody |
| alarmType | String | Alarm type, required, options: ALARM_TYPE_CLOUD (Cloud Product Monitor) ALARM_TYPE_SITE (Site Monitor) ALARM_TYPE_CUSTOM (Custom Monitor) ALARM_TYPE_APP (Application Monitor) |
Yes | RequestBody |
| pageNo | Int | Page number, starting from 1, required | Yes | RequestBody |
| pageSize | Int | Number of items per page, required, maximum: 100 | Yes | RequestBody |
| startTime | Int | Start time, Unix Timestamp, unit: millisecond, optional; default to 40 days ago if not set | No | RequestBody |
| endTime | Int | End time, Unix Timestamp, unit: millisecond, optional; default to the current time if not set | No | RequestBody |
| scope | String | Cloud product, optional; return alarms for all cloud products if not set | No | RequestBody |
| resourceType | String | Monitor object type, optional; return alarms for all monitor object types if not set | No | RequestBody |
| states | List<String> | Alarm status, optional. Multiple statuses can be filtered simultaneously. Return alarms for all statuses if not set. Options: OK (Recovery) ALERT (Abnormal) INSUFFICIENT_DATA (Insufficient Data) CLOSED (Closed) |
No | RequestBody |
| sort | String | Sort field, optional. Default to startTime if not set. Options: startTime |
No | RequestBody |
| ascending | Boolean | Is it in ascending order? Optional, it is false by default. | No | RequestBody |
| level | String | Alarm level, optional. Return alarms for all levels if not set. Options: ALARM_LEVEL_NOTICE (Notice) ALARM_LEVEL_WARNING (Warning) ALARM_LEVEL_MAJOR (Major) ALARM_LEVEL_CRITICAL (Critical) |
No | RequestBody |
| region | String | Region, optional. Return alarms for all Regions if not set | No | RequestBody |
| alarmAliasName | String | Fuzzy query by strategy name, optional | No | RequestBody |
| resource | ResourceKV | Search by Instance, optional | No | RequestBody |
| resources | List<ResourceKV> | Search by multiple Instances, optional | No | RequestBody |
ResourceKV
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| InstanceId | String | Instance ID, optional | No | RequestBody |
| taskId | String | Site Monitor Task ID, specify the Site Monitor task by filling in taskId | No | RequestBody |
Response parameters
| Name | Types | Description |
|---|---|---|
| success | Boolean | Whether the request succeeded |
| msg | String | If failed, return the reason for failure |
| result | PageResult | Paginated results |
PageResult
| Name | Types | Description |
|---|---|---|
| alarms | List<Alarm> | Alarm History List |
| pageNo | Int | Page number |
| pageSize | Int | Page size |
| totalCount | Int | Total number of Alarm History records |
Request example
JAVA
1// build client
2String endpoint = "http://bcm.bj.baidubce.com";
3String userId = "a0d04d7c***************7b6752ce4";
4String ak = "ALTAK***************3hVCYG";
5String sk = "b2c53*******************f9993ac1";
6BcmClientConfiguration config = new BcmClientConfiguration();
7config.setCredentials(new DefaultBceCredentials(ak, sk));
8config.setEndpoint(endpoint);
9bcmClient = new BcmClient(config);
10AlarmListRequest request = new AlarmListRequest();
11request.setUserId(userId);
12request.setAlarmType("ALARM_TYPE_CLOUD");
13request.setPageNo(1);
14request.setPageSize(10);
15request.setRegion("bj");
16request.setScope("BCE_BCC");
17request.setStartTime(1722844725412L);
18request.setEndTime(1723449525412L);
19AlarmListResponse alarmList = bcmClient.getAlarmList(request);
20// Response
21{
22 "result": {
23 "alarms": [
24 {
25 "id": "9f7718dd**********82675ee",
26 "seriesId": "8e7e040**********994c40198097c0",
27 "startTime": 1723446539999,
28 "state": "OK",
29 "userId": "a0d04**********52ce4",
30 "endTime": 1723446599999,
31 "initState": "ALERT",
32 "policy": {
33 "aliasName": "qgg**********",
34 "content": "CPU average usage >3% within 1 minute, triggering an alarm after 1 consecutive occurrence.",
35 "contentEn": "the average of CPUUsagePercent within 1 minute > 3%, occurring 1 time in a row",
36 "name": "b905**********b343f"
37 },
38 "resource": {
39 "identifiers": {
40 "InstanceId": "i-21**********N"
41 },
42 "properties": {
43 "application": "bcc",
44 "shortInstanceId": "i-21**********N"
45 },
46 "region": "bj",
47 "resourceType": "Instance",
48 "scope": "BCE_BCC"
49 },
50 "actions": [
51 {
52 "alias": "li**********",
53 "callBacks": [
54 "http://api*******************4790b0"
55 ],
56 "executedTime": 1723446605,
57 "members": [
58 "li**********"
59 ],
60 "name": "li**********",
61 "notifications": [
62 "EMAIL"
63 ],
64 "type": "ACTION_TYPE_ALERT"
65 }
66 ]
67 }
68 ],
69 "pageNo": 1,
70 "pageSize": 1,
71 "totalCount": 5039
72 },
73 "success": true
74}
Alarm History Details Query API
Request Description
Alarm details can be retrieved based on the alarm ID
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | RequestBody |
| alarmId | String | Alarm ID, globally unique, obtain from the Alarm History List API | Yes | RequestBody |
Response parameters
| Name | Types | Description |
|---|---|---|
| success | Boolean | Whether the request succeeded |
| msg | String | If failed, return the reason for failure |
| result | Alarm | Alarm detail content |
Request example
JAVA
1// build client
2String endpoint = "http://bcm.bj.baidubce.com";
3String userId = "a0d04d7c***************7b6752ce4";
4String ak = "ALTAK***************3hVCYG";
5String sk = "b2c53*******************f9993ac1";
6BcmClientConfiguration config = new BcmClientConfiguration();
7config.setCredentials(new DefaultBceCredentials(ak, sk));
8config.setEndpoint(endpoint);
9bcmClient = new BcmClient(config);
10AlarmDetailRequest request = new AlarmDetailRequest();
11request.setAlarmId("4d38c9**********c4ede387");
12request.setUserId(userId);
13AlarmDetailResponse alarmDetail = bcmClient.getAlarmDetail(request);
14// Response
15{
16 "success": true,
17 "result": {
18 "id": "4d38c9**********c4ede387",
19 "seriesId": "8e7e04034**********198097c0",
20 "userId": "a0d04**********752ce4",
21 "initState": "ALERT",
22 "state": "OK",
23 "closeReason": null,
24 "startTime": 1723531319999,
25 "endTime": 1723531379999,
26 "resource": {
27 "scope": "BCE_BCC",
28 "resourceType": "Instance",
29 "region": "bj",
30 "identifiers": {
31 "InstanceId": "i-21**********N"
32 },
33 "properties": {
34 "application": "bcc",
35 "shortInstanceId": "i-21**********N"
36 }
37 },
38 "policy": {
39 "name": "b905**********b343f",
40 "aliasName": "q**********",
41 "content": "CPU average usage >3% within 1 minute, triggering an alarm after 1 consecutive occurrence.",
42 "contentEn": "the average of CPUUsagePercent within 1 minute > 3%, occurring 1 time in a row"
43 },
44 "actions": [
45 {
46 "type": "ACTION_TYPE_ALERT",
47 "name": "li**********",
48 "executedTime": 1723531384,
49 "alias": "li**********",
50 "notifications": [
51 "EMAIL",
52 "SMS"
53 ],
54 "callBacks": [
55 "http://api*******************4790b0"
56 ],
57 "members": [
58 "li**********"
59 ]
60 }
61 ],
62 "alertMetrics": [
63 {
64 "metric": {
65 "name": "CPUUsagePercent",
66 "value": 3,
67 "aliasName": "Average CPU Usage Within 1 Minute",
68 "aliasNameEn": "1 min average of CPUUsagePercent",
69 "unit": "%"
70 },
71 "rule": {
72 "seq": 0,
73 "operator": "OPERATOR_TYPE_GT",
74 "threshold": 3
75 }
76 }
77 ]
78 }
79}
Appendix
Alarm
| Name | Types | Description |
|---|---|---|
| id | String | Alarm ID, globally unique |
| seriesId | String | User ID |
| userId | String | Alarm sequence ID |
| initState | String | Initial alarm status, possible values: OK (Recovery) ALERT (Abnormal) INSUFFICIENT_DATA (Insufficient Data) CLOSED (Closed) |
| state | String | Current status; an alarm can have up to two statuses. If current status = initial status, the alarm remains in its initial status |
| closeReason | String | If the alarm is closed, this field indicates the reason for closure, possible values: INSUFFICIENT_DATA (No Data) POLICY_MODIFIED (Policy Modified or Deleted) |
| startTime | Int | Alarm start time, Unix Timestamp, unit: millisecond |
| endTime | Int | Alarm end time, Unix Timestamp, unit: millisecond; if the alarm hasn't ended, fill this field with 0 |
| resource | Resource | Resources associated with the alarm |
| policy | Policy | Alarm Strategy corresponding to the alarm |
| actions | List<Action> | Alarm action list |
| alertMetrics | List<AlertMetrics> | Metric information that triggered the alarm, returned when querying historical details |
Resource
| Name | Types | Description |
|---|---|---|
| scope | String | Associated cloud product |
| resourceType | String | Cloud product sub-resource type |
| region | String | Region |
| identifiers | Map<String, String> | Resource identifier. Different cloud products have different identifiers |
| properties | Map<String, String> | Resource attributes. Different cloud products have different resource attributes |
Policy
| Name | Types | Description |
|---|---|---|
| name | String | Strategy name, used to query strategy details |
| aliasName | String | Strategy display name |
| content | String | Strategy content |
| contentEn | String | English strategy content |
| extra | Map<String, String> | Additional attributes of the Alarm Strategy, which will be returned if present |
Action
| Name | Types | Description |
|---|---|---|
| type | String | Action types, options: ACTION_TYPE_OK (Recovery notification) ACTION_TYPE_ALERT (Anomaly notification) ACTION_TYPE_INSUFFICIENT_DATA (Insufficient data notification) ACTION_TYPE_CALLBACK (Alarm callback) |
| name | String | Action name, when type=ACTION_TYPE_CALLBACK, this field should be filled with the callback address |
| executedTime | Int | Action execution time, Unix Timestamp, unit: millisecond. If this field is 0 or not set, the action has not been executed |
| alias | String | Name of notification template |
| notifications | List<String> | Notification methods, including only three: email, SMS, phone |
| callBacks | List<String> | Alarm callback URL |
| members | List<String> | User/Group information |
AlertMetrics
| Name | Types | Description |
|---|---|---|
| metric | Metric | Metric information that triggered the alarm |
| rule | Rule | Rules for triggering metric alarms |
Metric
| Name | Types | Description |
|---|---|---|
| name | String | Metric name |
| value | Int | Metric value when the alarm is triggered |
| dimensions | Map<String,String> | Metric dimension |
| aliasName | String | Metric name in Chinese |
| aliasNameEn | String | Metric name in English |
| unit | String | Metric unit |
Rule
| Name | Types | Description |
|---|---|---|
| seq | Int | In the Alarm Strategy rules, sequences with the same seq value indicate they belong to the same rule |
| operator | String | Comparison methods, possible values: OPER_TYPE_GT(greater than) OPER_TYPE_GE(greater than or equal) OPER_TYPE_LT(less than) OPER_TYPE_LE(less than or equal) OPER_TYPE_EQ(equal) OPER_TYPE_NE(not equal) MoM increase: OPER_TYPE_INC_RATE_GT(MoM increase rate greater than) OPER_TYPE_INC_RATE_GE(MoM increase rate greater than or equal) OPER_TYPE_INC_RATE_LT(MoM increase rate less than) OPER_TYPE_INC_RATE_LE(MoM increase rate less than or equal) OPER_TYPE_INC_RATE_EQ(MoM increase rate equal) OPER_TYPE_INC_RATE_NE(MoM increase rate not equal) MoM decrease: OPER_TYPE_DEC_RATE_GT(MoM decrease rate greater than) OPER_TYPE_DEC_RATE_GE(MoM decrease rate greater than or equal) OPER_TYPE_DEC_RATE_LT(MoM decrease rate less than) OPER_TYPE_DEC_RATE_LE(MoM decrease rate less than or equal) OPER_TYPE_DEC_RATE_EQ(MoM decrease rate equal) OPER_TYPE_DEC_RATE_NE(MoM decrease rate not equal) |
| threshold | Int | Alarm threshold |
