Querying Alarm History
Function
This API is used to query the alarm history.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
ces:alarmHistory:list
List
-
g:EnterpriseProjectId
-
-
URI
GET /V1.0/{project_id}/alarm-histories
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID. Constraints N/A Range 1 to 64 characters. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| group_id | No | String | Definition: Information about the group that the current resource belongs to. Constraints: N/A Range: The value starts with rg and is followed by 22 characters of letters, digits, or a combination of both. It can contain a total of 24 characters. Default Value: N/A |
| alarm_id | No | String | Definition: Alarm rule ID. Constraints: N/A Range: The value starts with al and is followed by 22 characters of letters, digits, or a combination of both. It can contain a total of 24 characters. Default Value: N/A |
| alarm_name | No | String | Definition: Alarm rule name. Constraints: N/A Range: The value allows 1 to 128 characters and can only contain digits, letters, underscores (_), and hyphens (-). Default Value: N/A |
| alarm_status | No | String | Definition: Alarm status. Constraints: N/A Range: The value can be: Default Value: N/A |
| alarm_level | No | Integer | Definition: Severity of the alarm record. The value can be 1, 2, 3, or 4. Constraints: N/A Range: The value can be: Default Value: N/A |
| namespace | No | String | Definition Namespace of the service. For details, see Services Interconnected with Cloud Eye. Constraints N/A Range The value is in the service.item format and allows 3 to 32 characters. The values of service and item must start with a letter and contain only letters, digits, and underscores (_). Default Value N/A |
| from | No | String | Definition: Start time of a time range used for filtering traces by time (including the time the traces were imported). The value is a timestamp. Constraints: N/A Range: 1 to 13 characters Default Value: N/A |
| to | No | String | Definition: End time of a time range used for filtering traces by time (including the time the traces were imported). The value is a timestamp. Constraints: N/A Range: 1 to 13 characters Default Value: N/A |
| start | No | String | Definition: Start position for pagination query, indicating the sequence number of the data record where the query starts. Constraints: N/A Range: An integer greater than or equal to 0 Default Value: 0 |
| limit | No | String | Definition: Maximum number of records being queried. Constraints: N/A Range: [1,100] Default Value: 100 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | No | String | Definition MIME type of the request body. Constraints N/A Range 1 to 64 characters Default Value Default value application/json; charset=UTF-8 is recommended. For APIs used to upload objects or images, the MIME type varies with the flow type. |
| X-Auth-Token | No | String | Definition User token. Constraints N/A Range 1 to 16,384 characters Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| alarm_histories | Array of AlarmHistoryInfoResp objects | Definition: Details about one or more alarm history records. |
| meta_data | MetaDataForAlarmHistoryResp object | Definition Total number of returned alarm history records. |
| Parameter | Type | Description |
|---|---|---|
| alarm_id | String | Definition: Alarm rule ID, for example, al1603131199286dzxpqK3Ez. Range: 24 characters |
| alarm_name | String | Definition: Alarm rule name, for example, alarm-test01. Range: 1 to 128 characters |
| alarm_description | String | Definition: Alarm rule description. Range: 0 to 256 characters |
| metric | MetricInfoResp object | Definition: Metric information. |
| condition | ConditionResp object | Definition Alarm policy configured in the alarm rule. |
| alarm_level | Integer | Definition: Alarm severity. Range: The value can be: |
| alarm_type | String | Definition: Alarm rule type. Range: The value can be: |
| alarm_enabled | Boolean | Definition: Whether the alarm rule is enabled. Range: The value can be: |
| alarm_action_enabled | Boolean | Definition: Whether to send notifications. Range: The value can be: |
| alarm_actions | Array of AlarmActionsResp objects | Definition Information about the notification group or topic subscription when the alarm is triggered. A structure example is as follows: { "type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } |
| ok_actions | Array of AlarmActionsResp objects | Definition Information about the notification group or topic subscription when the alarm is cleared. A structure example is as follows: { "type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } |
| insufficientdata_actions | Array of AlarmActionsResp objects | Definition Notification group or topic subscription when an alarm notification is triggered due to insufficient data. A structure example is as follows: { "type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } |
| update_time | Long | Definition: Time when the alarm status changed. The value is a UNIX timestamp in milliseconds, for example, 1603131199000. Range: N/A |
| enterprise_project_id | String | Definition: Enterprise project ID. Range: The value allows 36 characters. It can only contain lowercase letters, digits, hyphens (-), and underscores (_). You can customize an enterprise project ID. The value can also be 0 (default enterprise project ID) or all_granted_eps (all enterprise project IDs). |
| trigger_time | Long | Definition: Time when the monitoring data of the alarm history was reported. The value is a UNIX timestamp in milliseconds, for example, 1603131199469. Range: N/A |
| alarm_status | String | Definition Alarm rule status. Range Enumeration values: |
| datapoints | Array of DataPointForAlarmHistoryResp objects | Definition: An array of data about the time when the monitoring data of the alarm history is reported and the monitoring metric values that are calculated. |
| additional_info | AdditionalInfoResp object | Definition Additional field of the alarm history, which applies only to the alarm history generated for event monitoring. |
| notification_manner | String | Definition Notification method. Range: The value can be: |
| Parameter | Type | Description |
|---|---|---|
| namespace | String | Definition: Metric namespace. Range: 3 to 32 characters |
| metric_name | String | Definition: Metric name of the resource. Range: 1 to 96 characters |
| dimensions | Array of MetricsDimension objects | Definition Metric dimension. Constraints 1 to 4 metric dimension objects. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition Dimension of a resource. For example, the dimension of an ECS is instance_id . A maximum of four dimensions are supported. For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Constraints N/A Range The value starts with a letter and allows 1 to 32 characters. It can contain only letters, digits, underscores (_), and hyphens (-). Default Value N/A |
| value | String | Definition Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Constraints N/A Range 1 to 256 characters Default Value N/A |
| Parameter | Type | Description |
|---|---|---|
| comparison_operator | String | Definition Threshold symbol. Range The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease relative to the last period. cycle_increase indicates the increase relative to the last period. cycle_wave indicates the increase or decrease relative to the last period. |
| count | Integer | Definition Number of consecutive times that an alarm is triggered. Range An integer ranging from 1 to 5. |
| filter | String | Definition Data aggregation method. Range The value can be: |
| period | Integer | Definition Metric period, in seconds. For details about the original metric period for each cloud service, see Services Interconnected with Cloud Eye.
Range The value can be: |
| unit | String | Definition Data unit. Range 0 to 32 characters |
| value | Number | Definition Alarm threshold. 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 . Range -1.7976931348623157e+108 to 1.7976931348623157e+108 |
| suppress_duration | Integer | Definition Alarm suppression duration, in seconds. This parameter corresponds to the last field in the alarm policy when you create an alarm rule. This field is used to mitigate frequent alarm occurrences. Range The value can be:
|
| Parameter | Type | Description |
|---|---|---|
| [items] | Array of NotificationResp objects | Definition Information about the notification group or topic subscription when an alarm is triggered. |
| Parameter | Type | Description |
|---|---|---|
| type | String | Definition Alarm notification type. Range |
| notificationList | Array of strings | Definition Recipients to be notified of the alarm status changes. |
| Parameter | Type | Description |
|---|---|---|
| time | Long | Definition Time when the monitoring data of the alarm history is reported. It is a UNIX timestamp in milliseconds, for example, 1603131028000. Range: N/A |
| value | Double | Definition Resource monitoring data of the alarm history at a specific time point, for example, 7.019 . Range 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 . The value ranges from 0 to 1.7976931348623157e+108 . |
| Parameter | Type | Description |
|---|---|---|
| resource_id | String | Definition Resource ID corresponding to the alarm history, for example, 22d98f6c-16d2-4c2d-b424-50e79d82838f. Range: Max. 128 characters |
| resource_name | String | Definition Resource name corresponding to the alarm history, for example, ECS-Test01. Range: Max. 128 characters |
| event_id | String | Definition ID of the event in the alarm record, for example, ev16031292300990kKN8p17J. Range: 24 characters |
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Definition Total number of returned alarm history records. Range: N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| - | String | Request error. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| - | String | The authentication information is not provided or is incorrect. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| - | String | Access to the requested page is forbidden. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| - | String | The request timed out. |
Status code: 429
| Parameter | Type | Description |
|---|---|---|
| - | String | Too many requests. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| - | String | Failed to complete the request because of an internal service error. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| - | String | The system is currently unavailable. |
Example Requests
/V1.0/{project_id}/alarm-histories?limit=10&start=0&from=1602494921346&to=1603099721346&alarm_name=alarm-test01 Example Responses
Status code: 200
OK
{
"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" : ""
}
} ],
"meta_data" : {
"total" : 1
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 408 | Request Timeout |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot