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
String endpoint = "http://bcm.bj.baidubce.com";
String userId = "a0d04d7c***************7b6752ce4";
String ak = "ALTAK***************3hVCYG";
String sk = "b2c53*******************f9993ac1";
BcmClientConfiguration config = new BcmClientConfiguration();
config.setCredentials(new DefaultBceCredentials(ak, sk));
config.setEndpoint(endpoint);
bcmClient = new BcmClient(config);
AlarmListRequest request = new AlarmListRequest();
request.setUserId(userId);
request.setAlarmType("ALARM_TYPE_CLOUD");
request.setPageNo(1);
request.setPageSize(10);
request.setRegion("bj");
request.setScope("BCE_BCC");
request.setStartTime(1722844725412L);
request.setEndTime(1723449525412L);
AlarmListResponse alarmList = bcmClient.getAlarmList(request);
// Response
{
"result": {
"alarms": [
{
"id": "9f7718dd**********82675ee",
"seriesId": "8e7e040**********994c40198097c0",
"startTime": 1723446539999,
"state": "OK",
"userId": "a0d04**********52ce4",
"endTime": 1723446599999,
"initState": "ALERT",
"policy": {
"aliasName": "qgg**********",
"content": "CPU average usage >3% within 1 minute, triggering an alarm after 1 consecutive occurrence.",
"contentEn": "the average of CPUUsagePercent within 1 minute > 3%, occurring 1 time in a row",
"name": "b905**********b343f"
},
"resource": {
"identifiers": {
"InstanceId": "i-21**********N"
},
"properties": {
"application": "bcc",
"shortInstanceId": "i-21**********N"
},
"region": "bj",
"resourceType": "Instance",
"scope": "BCE_BCC"
},
"actions": [
{
"alias": "li**********",
"callBacks": [
"http://api*******************4790b0"
],
"executedTime": 1723446605,
"members": [
"li**********"
],
"name": "li**********",
"notifications": [
"EMAIL"
],
"type": "ACTION_TYPE_ALERT"
}
]
}
],
"pageNo": 1,
"pageSize": 1,
"totalCount": 5039
},
"success": true
}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
String endpoint = "http://bcm.bj.baidubce.com";
String userId = "a0d04d7c***************7b6752ce4";
String ak = "ALTAK***************3hVCYG";
String sk = "b2c53*******************f9993ac1";
BcmClientConfiguration config = new BcmClientConfiguration();
config.setCredentials(new DefaultBceCredentials(ak, sk));
config.setEndpoint(endpoint);
bcmClient = new BcmClient(config);
AlarmDetailRequest request = new AlarmDetailRequest();
request.setAlarmId("4d38c9**********c4ede387");
request.setUserId(userId);
AlarmDetailResponse alarmDetail = bcmClient.getAlarmDetail(request);
// Response
{
"success": true,
"result": {
"id": "4d38c9**********c4ede387",
"seriesId": "8e7e04034**********198097c0",
"userId": "a0d04**********752ce4",
"initState": "ALERT",
"state": "OK",
"closeReason": null,
"startTime": 1723531319999,
"endTime": 1723531379999,
"resource": {
"scope": "BCE_BCC",
"resourceType": "Instance",
"region": "bj",
"identifiers": {
"InstanceId": "i-21**********N"
},
"properties": {
"application": "bcc",
"shortInstanceId": "i-21**********N"
}
},
"policy": {
"name": "b905**********b343f",
"aliasName": "q**********",
"content": "CPU average usage >3% within 1 minute, triggering an alarm after 1 consecutive occurrence.",
"contentEn": "the average of CPUUsagePercent within 1 minute > 3%, occurring 1 time in a row"
},
"actions": [
{
"type": "ACTION_TYPE_ALERT",
"name": "li**********",
"executedTime": 1723531384,
"alias": "li**********",
"notifications": [
"EMAIL",
"SMS"
],
"callBacks": [
"http://api*******************4790b0"
],
"members": [
"li**********"
]
}
],
"alertMetrics": [
{
"metric": {
"name": "CPUUsagePercent",
"value": 3,
"aliasName": "Average CPU Usage Within 1 Minute",
"aliasNameEn": "1 min average of CPUUsagePercent",
"unit": "%"
},
"rule": {
"seq": 0,
"operator": "OPERATOR_TYPE_GT",
"threshold": 3
}
}
]
}
}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 |
