This API is used to query the alarm history of an alarm rule based on the alarm rule ID.
GET /V1.0/{project_id}/alarm-histories
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Minimum: 1 Maximum: 64 Regular expression matching: ^[a-zA-Z0-9-]{1,64}$ |
group_id |
No |
String |
Specifies the resource group ID, for example, rg1603107497873DK4O2pXbn. |
alarm_id |
No |
String |
Specifies the alarm rule ID, for example, al1603088932912v98rGl1al. |
alarm_name |
No |
String |
Specifies the alarm rule name, for example, alarm-test01. |
alarm_status |
No |
String |
Specifies the alarm status, which can be ok, alarm, or insufficient_data. |
alarm_level |
No |
Integer |
Specifies the alarm severity, which can be 1 (critical), 2 (major), 3 (minor), or 4 (informational). |
namespace |
No |
String |
Specifies the resource namespace. For example, the ECS namespace is SYS.ECS. To view the namespace of each service, see Services Interconnected with Cloud Eye. |
from |
No |
String |
Specifies the time from when you want to query the alarm history. The time is a UNIX timestamp (ms), for example, 1602501480905. If you do not configure from or to, to is the current time by default, and from is the timestamp of seven days earlier than the current time. |
to |
No |
String |
Specifies when you want your alarm history query to end. The value is a UNIX timestamp in milliseconds. from must be earlier than to. If you do not configure from or to, to is the current time by default, and from is the timestamp of seven days earlier than the current time. |
start |
No |
Integer |
Specifies the start value of pagination. The value is an integer. The default value is 0. |
limit |
No |
Integer |
Specifies the maximum number of records that can be queried at a time. Supported range: 1 to 100 (default) |
GET https://{Cloud Eye endpoint}/V1.0/{project_id}/alarm-histories?limit=10&start=0&from=1602494921346&to=1603099721346&alarm_name=alarm-test01
None
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
alarm_histories |
No |
Array of objects |
Specifies details about one or more alarm history records. For details, see Table 2. |
meta_data |
No |
MetaData object |
Specifies the total number of query results returned. For details, see Table 11. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
alarm_id |
No |
String |
Specifies the alarm rule ID, for example, al1603131199286dzxpqK3Ez. |
alarm_name |
No |
String |
Specifies the alarm rule name, for example, alarm-test01. |
alarm_description |
No |
String |
Provides supplementary information about the alarm rule. |
metric |
No |
Metric object |
Specifies the metric information. For details, see Table 3. |
condition |
No |
Condition object |
Specifies the alarm policy set in the alarm rule. For details, see Table 8. |
alarm_level |
No |
Integer |
Specifies the alarm severity, which can be 1 (critical), 2 (major), 3 (minor), or 4 (informational). |
alarm_type |
No |
String |
Specifies the alarm rule type. This parameter applies only to event alarms. The types are as follows: EVENT.SYS: system event alarm EVENT.CUSTOM: custom event alarm DNSHealthCheck: DNS health check alarm RESOURCE_GROUP: resource group alarm MULTI_INSTANCE: alarm for a specific resource |
alarm_enabled |
No |
Boolean |
Specifies whether the alarm rule has been enabled. Possible values are true and false. |
alarm_action_enabled |
No |
Boolean |
Specifies whether the alarm action has been triggered. Possible values are true and false. |
alarm_actions |
No |
Array of objects |
Specifies the action to be triggered by an alarm. The structure is as follows: {"type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } The value of type can be: notification: A notification will be sent. autoscaling: A scaling action will be triggered. notificationList indicates the list of recipients to be notified of alarm status changes. For details, see Table 5. |
ok_actions |
No |
Array of objects |
Specifies the action to be triggered after the alarm is cleared. The structure is as follows: {"type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } The value of type can be: notification: A notification will be sent. notificationList indicates the list of recipients to be notified of alarm status changes. For details, see Table 6. |
insufficientdata_actions |
No |
Array of objects |
Specifies the action triggered by data insufficiency. The structure is as follows: {"type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"]} The value of type can be: notification: An alarm is triggered due to insufficient data. notificationList: Specifies the ID list of the notification objects when an alarm notification is triggered due to insufficient data. For details, see Table 7. |
update_time |
No |
Long |
Specifies when the alarm status changed. The time is a UNIX timestamp (ms), for example, 1603131199000. |
enterprise_project_id |
No |
String |
Specifies the enterprise project ID. Value all_granted_eps indicates all enterprise projects. Value 0 indicates enterprise project default. |
trigger_time |
No |
Long |
Specifies when the alarm was triggered. The time is a UNIX timestamp (ms), for example, 1603131199469. |
alarm_status |
No |
String |
Specifies the alarm status, which can be ok, alarm, or insufficient_data. |
datapoints |
No |
Array of objects |
Specifies when the monitoring data of the alarm history is reported and the monitoring data that is calculated. For details, see Table 9. |
additional_info |
No |
AdditionalInfo object |
Specifies the additional field of the alarm history, which applies only to the alarm history generated for event monitoring. For details, see Table 10. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
dimensions |
No |
Array of objects |
Specifies the metric dimension. For details, see Table 4. |
metric_name |
No |
String |
Specifies the metric name. Start with a letter. Enter 1 to 64 characters. Only letters, digits, and underscores (_) are allowed. For details, see the metric name queried in Services Interconnected with Cloud Eye. |
namespace |
No |
String |
Specifies the metric namespace in service.item format. service and item each must contain 3 to 32 characters, start with a letter, and contain only letters, digits, and underscores (_). NOTE:
You can leave this parameter blank when you set alarm_type to (EVENT.SYS| EVENT.CUSTOM). |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
name |
No |
String |
Specifies the monitoring dimension name. For example, the ECS dimension is instance_id. For details about the dimension of each monitored object, see the documentation of a specific cloud service. You can navigate there directly from the Services Interconnected with Cloud Eye page. |
value |
No |
String |
Specifies the dimension value, for example, an ECS ID. The value contains 1 to 256 characters. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
type |
Yes |
String |
Specifies the alarm notification type.
|
notificationList |
Yes |
Array of strings |
Specifies the list of objects to be notified of alarm status changes. NOTE:
The IDs in the list are strings. You can configure up to 5 object IDs. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
type |
Yes |
String |
Specifies the alarm notification type.
|
notificationList |
Yes |
Array of strings |
Specifies the list of objects to be notified of alarm status changes. NOTE:
The IDs in the list are strings. You can configure up to 5 object IDs. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
type |
Yes |
String |
Specifies the alarm notification type.
|
notificationList |
Yes |
Array of strings |
Specifies the list of objects to be notified of alarm status changes. NOTE:
The IDs in the list are strings. You can configure up to 5 object IDs. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
period |
No |
Integer |
Specifies how often Cloud Eye aggregates data, which can be
NOTE:
If you set period to 1, Cloud Eye uses raw data to determine whether to trigger an alarm. You can set this parameter to 0 when you set alarm_type to (EVENT.SYS| EVENT.CUSTOM). |
filter |
No |
String |
Specifies the data aggregation method. The value can be:
|
comparison_operator |
No |
String |
Specifies the alarm threshold operator, which can be >, =, <, >=, <=, or !=. |
value |
Yes |
Double |
Specifies the alarm threshold. Range: 0 to Number. MAX_VALUE (1.7976931348623157e+108) For detailed thresholds, see the value range of each metric in the appendix. For example, you can set ECS cpu_util in Services Interconnected with Cloud Eye to 80. |
unit |
No |
String |
Specifies the data unit. The value can contain a maximum of 32 characters. You can set this parameter based on your service needs. Minimum: 0 Maximum: 32 |
count |
No |
Integer |
Specifies the number of consecutive occurrence times that the alarm policy was met. Supported range: 1 to 5 |
suppress_duration |
No |
Integer |
Specifies the interval for triggering an alarm if the alarm persists. Possible intervals are as follows: 0: Cloud Eye triggers the alarm only once. 300: Cloud Eye triggers the alarm every 5 minutes. 600: Cloud Eye triggers the alarm every 10 minutes. 900: Cloud Eye triggers the alarm every 15 minutes. 1800: Cloud Eye triggers the alarm every 30 minutes. 3600: Cloud Eye triggers the alarm every hour. 10800: Cloud Eye triggers the alarm every 3 hours. 21600: Cloud Eye triggers the alarm every 6 hours. 43200: Cloud Eye triggers the alarm every 12 hours. 86400: Cloud Eye triggers the alarm every day. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
time |
No |
Long |
Specifies when the monitoring data of the alarm history is reported, which is a UNIX timestamp in milliseconds, for example, 1603131028000. |
value |
No |
Double |
Specifies the calculated monitoring data of the alarm history, for example, 7.019. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
resource_id |
No |
String |
Specifies the resource ID corresponding to the alarm history, for example, 22d98f6c-16d2-4c2d-b424-50e79d82838f. |
resource_name |
No |
String |
Specifies the resource name corresponding to the alarm history, for example, ECS-Test01. |
event_id |
No |
String |
Specifies the event ID of the alarm history, for example, ev16031292300990kKN8p17J. |
{
"alarm_histories": [
{
"alarm_id": "al1604473987569z6n6nkpm1",
"alarm_name": "TC_CES_FunctionBaseline_Alarm_008",
"alarm_description": "",
"metric": {
"namespace": "SYS.VPC",
"dimensions": [
{
"name": "bandwidth_id",
"value": "79a9cc0c-f626-4f15-bf99-a1f184107f88"
}
],
"metric_name": "downstream_bandwidth"
},
"condition": {
"period": 1,
"filter": "average",
"comparison_operator": ">=",
"value": 0,
"count": 3
},
"alarm_level": 2,
"alarm_type": "",
"alarm_enabled": false,
"alarm_action_enabled": false,
"alarm_actions": [],
"ok_actions": [],
"insufficientdata_actions": [],
"update_time": 1604473988000,
"enterprise_project_id": "0",
"trigger_time": 1604473987607,
"alarm_status": "alarm",
"datapoints": [
{
"time": 1604473860000,
"value": 0
},
{
"time": 1604473800000,
"value": 0
},
{
"time": 1604473740000,
"value": 0
}
],
"additional_info": {
"resource_id": "",
"resource_name": "",
"event_id": ""
}
},
{
"alarm_id": "al1604473978613MvlvlbVZD",
"alarm_name": "alarm_merge",
"alarm_description": "",
"metric": {
"namespace": "AGT.ECS",
"dimensions": [
{
"name": "instance_id",
"value": "22d98f6c-16d2-4c2d-b424-50e79d82838f"
}
],
"metric_name": "load_average5",
"resource_group_id": "rg160447397837330303XQbK",
"resource_group_name": "group1"
},
"condition": {
"period": 1,
"filter": "average",
"comparison_operator": ">=",
"value": 0,
"count": 3
},
"alarm_level": 2,
"alarm_type": "RESOURCE_GROUP",
"alarm_enabled": false,
"alarm_action_enabled": false,
"alarm_actions": [],
"ok_actions": [],
"insufficientdata_actions": [],
"update_time": 1604473979000,
"enterprise_project_id": "0",
"trigger_time": 1604473979070,
"alarm_status": "insufficient_data",
"datapoints": [],
"additional_info": {
"resource_id": "",
"resource_name": "",
"event_id": ""
}
}
],
"meta_data": {
"total": 2
}
}
Returned Value |
Description |
|---|---|
400 Bad Request |
Request error. |
401 Unauthorized |
The authentication information is not provided or is incorrect. |
403 Forbidden |
Access to the requested page is forbidden. |
408 Request Timeout |
The request timed out. |
429 Too Many Requests |
Concurrent requests are excessive. |
500 Internal Server Error |
Failed to complete the request because of an internal service error. |
503 Service Unavailable |
The service is currently unavailable. |
See Error Codes.