Alarm history
Updated at:2025-11-03
Alarm History List
Request structure
- method:POST
- URL:/ah-api/v1/alarmhouse/alarm/list
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
JSON
1POST /ah-api/v1/alarmhouse/alarm/list
2{
3 "userId": "453bf9********************9090dc",
4 "startTime": 1722319915374,
5 "endTime": 1722924715374,
6 "alarmType": "ALARM_TYPE_CLOUD",
7 "scope": "BCE_BCC",
8 "resourceType": "Instance",
9 "states": ["OK"],
10 "sort": "startTime",
11 "ascending": false,
12 "level": "ALARM_LEVEL_NOTICE",
13 "region": "bj",
14 alarmAliasName: Test strategy,
15 "resource": {
16 "InstanceId": "i-12*****7",
17 "taskId": "yotKl***************MBsNgSmBZ",
18 },
19 "resources": [
20 {"InstanceId": "i-12*****7"},
21 {"InstanceId": "i-83*****e"},
22 ],
23 "pageNo": 1,
24 "pageSize": 10,
25}
26// Response
27{
28 "success": true,
29 "msg": "",
30 "result": {
31 "alarms": [
32 {
33 "id": "f54c9563fe32**********680d381f9f68931",
34 "userId": "453bf9********************9090dc",
35 "seriesId": "ab910517974c*********79e79f46200f25cb",
36 "startTime": 1722924659999,
37 "endTime": 1722924719999,
38 "state": "ALERT",
39 "closeReason": "INSUFFICIENT_DATA",
40 "policy": {
41 "name": "919ad2628dad**********85f4132ad9e",
42 "aliasName": "eip-all-test",
43 "updateTime": 1722425024000,
44 content: 1-minute average Internet ingress traffic > 100 Bytes, 1 consecutive occurrence,
45 "contentEn": "The average internet input traffic > 100Bytes, ocurring once in a row",
46 "level": "ALARM_LEVEL_MAJOR",
47 "checkPeriod": 60
48 }
49 "resource": {
50 "scope": "BCE_BCC",
51 "resourceType": "Instance",
52 "region": "bj",
53 "identifiers": {
54 "InstanceId": "ip-12*****7",
55 },
56 "properties": {
57 "application": "bcc",
58 "internalIp": "192.168.16.10",
59 "shortInstanceId": "i-I8*****J"
60 }
61 }
62 "actions": [
63 {
64 "type": "ACTION_TYPE_OK",
65 "name": "test_action",
66 "executedTime": 1722924721,
67 alias: Default action
68 "notifications": [
69 "EMAIL",
70 "SMS",
71 "PHONE"
72 ],
73 "callBacks": [
74 "http://apiin.im.baidu.com/api/msg/xxxxx"
75 ],
76 "members": [
77 "zsli",
78 "test_user"
79 ]
80 }
81 ]
82 }
83 ]
84 "pageNo": 1,
85 "pageSize": 10,
86 "totalCount": 12345,
87 }
88}
Alarm History details
Request structure
- method:GET
- URL:/ah-api/v1/alarmhouse/alarm?alarmId=${alarmId}&userId=${userId}
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Path |
| alarmId | String | Alarm ID, globally unique, obtain from the Alarm History List API | Yes | Path |
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
JSON
1GET ah-api/v1/alarmhouse/alarm?
2alarmId=f54c9563fe32**********680d381f9f68931&
3userId=453bf9********************9090dc
4// Response
5{
6 "success": true,
7 "msg": "",
8 "result": {
9 "id": "f54c9563fe32**********680d381f9f68931",
10 "userId": "453bf9********************9090dc",
11 "seriesId": "ab910517974c*********79e79f46200f25cb",
12 "startTime": 1659534994121,
13 "endTime": 0,
14 "initState": "ALERT",
15 "state": "ALERT",
16 "closeReason": "INSUFFICIENT_DATA",
17 "policy": {
18 "name": "919ad2628dad42f78280c85f4132ad9e",
19 "aliasName": "eip-all-test",
20 "updateTime": 1722425024000,
21 content: 1-minute average Internet ingress traffic > 100 Bytes, 1 consecutive occurrence,
22 "contentEn": "The average internet input traffic > 100Bytes, ocurring once in a row",
23 "level": "ALARM_LEVEL_MAJOR",
24 "checkPeriod": 60,
25 },
26 "resource": {
27 "scope": "BCE_BCC",
28 "resourceType": "Instance",
29 "region": "bj",
30 "identifiers": {
31 "instanceId": "ip-12*****7",
32 }
33 },
34 "actions": [
35 {
36 "type": "ACTION_TYPE_OK",
37 "name": "test_action",
38 "executedTime": 1659534994121,
39 "notifications" : [
40 "EMAIL",
41 "SMS",
42 "PHONE"
43 ],
44 "callBacks" : [
45 "http://apiin.im.baidu.com/api/msg/xxxxx"
46 ],
47 "members" : [
48 "zxj",
49 "test_user"
50 ]
51 }
52 ],
53 "alertMetrics": [
54 {
55 "metric": {
56 "name": "CpuUsage",
57 "value": 50,
58 "dimensions": {
59 "dimension_key": "dimension_value"
60 },
61 aliasName: 1-minute average CPU usage,
62 "aliasNameEn": "1 min average of cpu usage",
63 "unit": "%",
64 },
65 "rule": {
66 "seq": 0,
67 "operator": "OPERATOR_TYPE_LE",
68 "threshold": 10,
69 "statistics": "STATISTICS_TYPE_AVG",
70 "window": 60
71 }
72 }
73 ]
74 }
75}
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 |
