Alarm History-related APIs
Last Updated:2025-11-14
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
// build client
ak := "ALTA*********CYG"
sk := "b2c5*********3ac1"
endpoint := "bcm.bj.baidubce.com"
bcmClient, _ := bcm.NewClient(ak, sk, endpoint)
req := &model.AlarmListQuery{
UserID: "a0d*********52ce4",
Scope: "BCE_BCC",
AlarmType: "ALARM_TYPE_CLOUD",
StartTime: 1722927729703,
EndTime: 1723532529703,
PageNo: 1,
PageSize: 10,
Sort: "startTime",
}
response, _ := bcmClient.GetAlarmList(req)
// Response
{
"success": true,
"result": {
"alarms": [
{
"id": "4d38c*********4ede387",
"userId": "a0d*********ce4",
"seriesId": "8e7e04*********40198097c0",
"state": "OK",
"initState": "ALERT",
"startTime": 1723531319999,
"endTime": 1723531379999,
"alarmType": "ALARM_TYPE_CLOUD",
"resource": {
"scope": "BCE_BCC",
"resourceType": "Instance",
"region": "bj",
"identifiers": {
"InstanceId": "i-21*********"
},
"properties": {
"application": "bcc",
"shortInstanceId": "i-21*********"
}
},
"policy": {
"id": 226086,
"name": "b905*********343f",
"indexedName": "b905*********343f@0",
"aliasName": "qg*********",
"updateTime": 1715872066000,
"content": "CPU average usage \u003e3% within 1 minute, triggering an alarm after 1 consecutive occurrence",
"contentEn": "the average of CPUUsagePercent within 1 minute \u003e 3%, occurring 1 time in a row",
"level": "ALARM_LEVEL_MAJOR"
},
"actions": [
{
"name": "li*********",
"type": "ACTION_TYPE_ALERT",
"executedTime": 1723531384,
"alias": "li*********",
"notifications": [
"EMAIL",
"SMS"
],
"callBacks": [
"http://apiin.im**************90b0"
],
"members": [
"li*********"
]
}
]
}
],
"pageNo": 1,
"pageSize": 1,
"totalCount": 45
}
}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
// build client
ak := "ALTA*********CYG"
sk := "b2c5*********3ac1"
endpoint := "bcm.bj.baidubce.com"
bcmClient, _ := bcm.NewClient(ak, sk, endpoint)
req := &model.AlarmDetailQuery{
UserID: "a0d*********ce4",
AlarmID: "4d38c*********f35c4ede387",
}
response, _ := bcmClient.GetAlarmDetail(req)
// Response
{
"success": true,
"result": {
"id": "4d38c971ca**********35c4ede387",
"userId": "a0d**********52ce4",
"seriesId": "8e7e040**********4c40198097c0",
"state": "OK",
"initState": "ALERT",
"startTime": 1723531319999,
"endTime": 1723531379999,
"alarmType": "ALARM_TYPE_CLOUD",
"resource": {
"scope": "BCE_BCC",
"resourceType": "Instance",
"region": "bj",
"identifiers": {
"InstanceId": "i-21**********"
},
"properties": {
"application": "bcc",
"shortInstanceId": "i-21**********"
}
},
"policy": {
"id": 226086,
"name": "b905**********343f",
"indexedName": "b905e**********43f@0",
"aliasName": "qg**********o",
"updateTime": 1715872066000,
"content": "CPU average utilization \u003e3% within 1 minute, triggering an alarm after 1 consecutive occurrence",
"contentEn": "the average of CPUUsagePercent within 1 minute \u003e 3%, occurring 1 time in a row",
"level": "ALARM_LEVEL_MAJOR"
},
"actions": [
{
"name": "li**********",
"type": "ACTION_TYPE_ALERT",
"executedTime": 1723531384,
"alias": "li**********",
"notifications": [
"EMAIL",
"SMS"
],
"callBacks": [
"http://apiin.im**********f10b72df694790b0"
],
"members": [
"l**********"
]
}
],
"alertMetrics": [
{
"metric": {
"name": "CPUUsagePercent",
"value": 3.4226478835923735,
"aliasName": "CPU average utilization within 1 minute",
"aliasNameEn": "1 min average of CPUUsagePercent",
"unit": "%"
},
"rule": {
"seq": 0,
"metricName": "thirdparty.bcm.CPUUsagePercent",
"operator": "OPERATOR_TYPE_GT",
"threshold": 3,
"statistics": "STATISTICS_TYPE_AVG",
"window": 60
}
}
]
}
}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
ak, sk, endpoint := "ak", "sk", "bcm.bj.baidubce.com"
c, _ := bcm.NewClient(ak, sk, endpoint)
req := &model.EventAlarmListQuery{
AccountID: "a0d04d**************752ce4",
ServiceName: "BCE_ALL",
PageNo: 1,
PageSize: 10,
StartTime: "2025-06-11T07:49:08Z",
EndTime: "2025-06-18T07:49:08Z",
}
resp, _ := c.GetEventAlarmList(req)
// Response
{
"content": [
{
"serviceName": "BCE_BCC",
"policyName": "policy1",
"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'}'}",
"timestamp": "2025-06-17T08:48:58Z",
"region": "bj"
},
{
"serviceName": "BCE_BCC",
"policyName": "policy1",
"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'}",
"timestamp": "2025-06-17T08:48:58Z",
"region": "bj"
}
],
"query": null,
"fields": [],
"orderBy": [],
"pageNumber": 1,
"pageSize": 10,
"pageElements": 10,
"last": true,
"first": true,
"totalPages": 1,
"totalElements": 10
}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 |
