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
GO
1// build client
2ak := "ALTA*********CYG"
3sk := "b2c5*********3ac1"
4endpoint := "bcm.bj.baidubce.com"
5bcmClient, _ := bcm.NewClient(ak, sk, endpoint)
6req := &model.AlarmListQuery{
7 UserID: "a0d*********52ce4",
8 Scope: "BCE_BCC",
9 AlarmType: "ALARM_TYPE_CLOUD",
10 StartTime: 1722927729703,
11 EndTime: 1723532529703,
12 PageNo: 1,
13 PageSize: 10,
14 Sort: "startTime",
15}
16response, _ := bcmClient.GetAlarmList(req)
17// Response
18{
19 "success": true,
20 "result": {
21 "alarms": [
22 {
23 "id": "4d38c*********4ede387",
24 "userId": "a0d*********ce4",
25 "seriesId": "8e7e04*********40198097c0",
26 "state": "OK",
27 "initState": "ALERT",
28 "startTime": 1723531319999,
29 "endTime": 1723531379999,
30 "alarmType": "ALARM_TYPE_CLOUD",
31 "resource": {
32 "scope": "BCE_BCC",
33 "resourceType": "Instance",
34 "region": "bj",
35 "identifiers": {
36 "InstanceId": "i-21*********"
37 },
38 "properties": {
39 "application": "bcc",
40 "shortInstanceId": "i-21*********"
41 }
42 },
43 "policy": {
44 "id": 226086,
45 "name": "b905*********343f",
46 "indexedName": "b905*********343f@0",
47 "aliasName": "qg*********",
48 "updateTime": 1715872066000,
49 "content": "CPU average usage \u003e3% within 1 minute, triggering an alarm after 1 consecutive occurrence",
50 "contentEn": "the average of CPUUsagePercent within 1 minute \u003e 3%, occurring 1 time in a row",
51 "level": "ALARM_LEVEL_MAJOR"
52 },
53 "actions": [
54 {
55 "name": "li*********",
56 "type": "ACTION_TYPE_ALERT",
57 "executedTime": 1723531384,
58 "alias": "li*********",
59 "notifications": [
60 "EMAIL",
61 "SMS"
62 ],
63 "callBacks": [
64 "http://apiin.im**************90b0"
65 ],
66 "members": [
67 "li*********"
68 ]
69 }
70 ]
71 }
72 ],
73 "pageNo": 1,
74 "pageSize": 1,
75 "totalCount": 45
76 }
77}
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
GO
1// build client
2ak := "ALTA*********CYG"
3sk := "b2c5*********3ac1"
4endpoint := "bcm.bj.baidubce.com"
5bcmClient, _ := bcm.NewClient(ak, sk, endpoint)
6req := &model.AlarmDetailQuery{
7 UserID: "a0d*********ce4",
8 AlarmID: "4d38c*********f35c4ede387",
9}
10response, _ := bcmClient.GetAlarmDetail(req)
11// Response
12{
13 "success": true,
14 "result": {
15 "id": "4d38c971ca**********35c4ede387",
16 "userId": "a0d**********52ce4",
17 "seriesId": "8e7e040**********4c40198097c0",
18 "state": "OK",
19 "initState": "ALERT",
20 "startTime": 1723531319999,
21 "endTime": 1723531379999,
22 "alarmType": "ALARM_TYPE_CLOUD",
23 "resource": {
24 "scope": "BCE_BCC",
25 "resourceType": "Instance",
26 "region": "bj",
27 "identifiers": {
28 "InstanceId": "i-21**********"
29 },
30 "properties": {
31 "application": "bcc",
32 "shortInstanceId": "i-21**********"
33 }
34 },
35 "policy": {
36 "id": 226086,
37 "name": "b905**********343f",
38 "indexedName": "b905e**********43f@0",
39 "aliasName": "qg**********o",
40 "updateTime": 1715872066000,
41 "content": "CPU average utilization \u003e3% within 1 minute, triggering an alarm after 1 consecutive occurrence",
42 "contentEn": "the average of CPUUsagePercent within 1 minute \u003e 3%, occurring 1 time in a row",
43 "level": "ALARM_LEVEL_MAJOR"
44 },
45 "actions": [
46 {
47 "name": "li**********",
48 "type": "ACTION_TYPE_ALERT",
49 "executedTime": 1723531384,
50 "alias": "li**********",
51 "notifications": [
52 "EMAIL",
53 "SMS"
54 ],
55 "callBacks": [
56 "http://apiin.im**********f10b72df694790b0"
57 ],
58 "members": [
59 "l**********"
60 ]
61 }
62 ],
63 "alertMetrics": [
64 {
65 "metric": {
66 "name": "CPUUsagePercent",
67 "value": 3.4226478835923735,
68 "aliasName": "CPU average utilization within 1 minute",
69 "aliasNameEn": "1 min average of CPUUsagePercent",
70 "unit": "%"
71 },
72 "rule": {
73 "seq": 0,
74 "metricName": "thirdparty.bcm.CPUUsagePercent",
75 "operator": "OPERATOR_TYPE_GT",
76 "threshold": 3,
77 "statistics": "STATISTICS_TYPE_AVG",
78 "window": 60
79 }
80 }
81 ]
82 }
83}
Cloud product event alarm history query API
API description
This API retrieves the cloud product event alarm history list information
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| accountId | String | User ID | Yes | Path parameter |
| serviceName | String | Cloud product name; to query all cloud products, enter BCE_ALL | Yes | Path parameter |
| pageNo | Integer | Page number, starting from 1 | Yes | RequestBody |
| pageSize | Integer | Number of items per page, maximum: 100 | Yes | RequestBody |
| startTime | String | Query start time, UTC format | Yes | RequestBody |
| endTime | String | Query end time, UTC format | Yes | RequestBody |
| region | String | Region, optional. Return alarm history of all regions if not set | No | RequestBody |
| policyName | String | Alarm policy name filter; if not set, return alarm history for all policies | No | RequestBody |
| resourceId | String | Alarm resource filter; if not set, return alarm history for all resources | No | RequestBody |
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| pageNumber | int | Pagination page number |
| pageSize | int | Page size |
| pageElements | int | Count of results returned per page |
| last | boolean | Whether it is the last page |
| first | boolean | Whether it is the first page |
| totalPages | int | Total number of pages |
| totalElements | int | Total count of results |
| content | List |
Response result |
EventAlarm
| Parameter name | Types | Description |
|---|---|---|
| serviceName | String | Cloud product name |
| policyName | String | Belonging alarm policy name |
| content | String | Alarm content |
| timestamp | String | Alarm time |
| region | String | Region |
Request example
GO
1ak, sk, endpoint := "ak", "sk", "bcm.bj.baidubce.com"
2c, _ := bcm.NewClient(ak, sk, endpoint)
3req := &model.EventAlarmListQuery{
4 AccountID: "a0d04d**************752ce4",
5 ServiceName: "BCE_ALL",
6 PageNo: 1,
7 PageSize: 10,
8 StartTime: "2025-06-11T07:49:08Z",
9 EndTime: "2025-06-18T07:49:08Z",
10}
11resp, _ := c.GetEventAlarmList(req)
12// Response
13{
14 "content": [
15 {
16 "serviceName": "BCE_BCC",
17 "policyName": "policy1",
18 "content": "[Event Alarm] Baidu Cloud Compute (BCC) of your account triggered an event alarm. Alarm event: BCC status change notification. Monitor object: . Time: 2025-06-17 16:48:58. Additional content: {'info': 'BCC instance status change', 'advice': 'Your BCC instance status has changed to running'}'}",
19 "timestamp": "2025-06-17T08:48:58Z",
20 "region": "bj"
21 },
22 {
23 "serviceName": "BCE_BCC",
24 "policyName": "policy1",
25 "content": "[Event Alarm] Baidu Cloud Compute (BCC) of your account triggered an event alarm. Alarm event: BCC status change notification. Monitor object: . Time: 2025-06-17 16:48:58. Additional content: {'info': 'BCC instance status change', 'advice': 'Your BCC instance status has changed to running'}",
26 "timestamp": "2025-06-17T08:48:58Z",
27 "region": "bj"
28 }
29 ],
30 "query": null,
31 "fields": [],
32 "orderBy": [],
33 "pageNumber": 1,
34 "pageSize": 10,
35 "pageElements": 10,
36 "last": true,
37 "first": true,
38 "totalPages": 1,
39 "totalElements": 10
40}
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 |
