This API is used to query alarm records.
Function
This API is used to query alarm records.
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 /v2/{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 |
|---|---|---|---|
| alarm_id | No | Array of strings | Definition: List of alarm IDs. Alarm ID. It starts with al and is followed by 22 characters, including letters or digits. Constraints: The list can contain a maximum of 50 alarm IDs. |
| record_id | No | String | Definition Alarm SN. The rule for generating alarm SNs is optimized from ah1655717086704DEnBrJ999 to ah251222T092004SAD2yARym. Constraints N/A Range The value can contain 24 characters. It starts with ah and is followed by 22 characters, including letters or digits. Default Value N/A |
| name | No | String | Definition: Alarm rule name. Constraints: None Value range: The value can contain a maximum of 128 characters. Default value: None |
| status | No | Array of strings | Definition Alarm rule statuses. Range The value can be: Constraints You can specify up to three statuses. |
| level | No | Integer | Definition Alarm severity. 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. The values of service and item must start with a letter and contain only letters, digits, and underscores (_). It can contain 3 to 32 characters. Default Value N/A |
| resource_id | No | String | Definition ID of a resource in an alarm rule. Constraints N/A Range If the resource has multiple dimensions, the resource IDs are sorted in ascending alphabetical order and separated by commas (,). 0 to 2,048 characters. Default Value N/A |
| from | No | String | Definition Start time of the period during which alarm records are updated, for example, 2022-02-10T10:05:46+08:00. Constraints N/A Range 0 to 64 characters. Default Value N/A |
| to | No | String | Definition End time of the period during which alarm records are updated, for example, 2022-02-10T10:05:47+08:00. Constraints N/A Range 0 to 64 characters. Default Value N/A |
| alarm_type | No | String | Definition Alarm type. Constraints N/A Range The value can be: Default Value N/A |
| create_time_from | No | String | Definition Start time of the period during which alarm records are generated, for example, 2022-02-10T10:05:46+08:00. Constraints N/A Range 0 to 64 characters. Default Value N/A |
| create_time_to | No | String | Definition End time of the period during which alarm records are created, for example, 2022-02-10T10:05:47+08:00. Constraints N/A Range 0 to 64 characters. Default Value N/A |
| offset | No | Integer | Definition Pagination offset. Constraints N/A Range An integer ranging from 0 to 1,000,000,000. Default Value 0 |
| limit | No | Integer | Definition Pagination offset. Constraints N/A Range An integer ranging from 1 to 100. Default Value 100 |
| order_by | No | String | Definition Keyword for sorting alarms. Constraints N/A Range The value can be: Default Value update_time |
| mask_status | No | String | Definition Alarm rule masking status. Constraints N/A Range Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | No | String | Definition MIME type of the request body. Constraints: None Value range: The value can contain 1 to 64 characters. Default value: The default type is application/json; charset=UTF-8. |
| X-Auth-Token | No | String | Definition User token. Constraints: None Value range: The value can contain 1 to 16,384 characters. Default value: None |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| alarm_histories | Array of AlarmHistoryItemV2 objects | Definition Alarm records. |
| count | Integer | Definition Total number of alarm records. Range [0,2147483647] |
| Parameter | Type | Description |
|---|---|---|
| record_id | String | Definition Alarm SN. The rule for generating alarm SNs is optimized from ah1655717086704DEnBrJ999 to ah251222T092004SAD2yARym. Range The value can contain 24 characters. It starts with ah and is followed by 22 characters, including letters or digits. |
| alarm_id | String | Definition Alarm rule ID. Range The value starts with al and is followed by 22 characters of letters, digits, or a combination of both. |
| name | String | Definition Alarm name. Range The value allows 1 to 128 characters and can only contain letters, digits, underscores (_), and hyphens (-). |
| status | String | Definition Alarm rule status. Range The value can be: |
| level | Integer | Definition Alarm severity. Range The value can be: |
| type | String | Definition Alarm rule type. Range The value can be: |
| action_enabled | Boolean | Definition Whether to send notifications. Range |
| begin_time | String | Definition: UTC time when the alarm was generated. Value range: None |
| end_time | String | Definition: Alarm end time (UTC time). Value range: None |
| first_alarm_time | String | Definition: UTC time when the alarm was generated for the first time. Value range: None |
| last_alarm_time | String | Definition: UTC time when the alarm was generated for the last time. Value range: None |
| alarm_recovery_time | String | Definition: UTC time when the alarm was cleared. Value range: None |
| metric | metric object | Definition Metric information. |
| condition | condition object | Definition: Alarm triggering condition. |
| additional_info | AdditionalInfo object | Definition: Additional field of an alarm record. This is only intended for alarm records generated in event monitoring. |
| alarm_actions | Array of alarm_actions objects | Definition Information about the notification group or topic subscription when the alarm is triggered. A structure example is as follows: { "type": "notification", "notification_list": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } |
| ok_actions | Array of ok_actions objects | Definition Information about the notification group or topic subscription when the alarm is cleared. A structure example is as follows: { "type": "notification", "notification_list": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } |
| data_points | Array of DataPointInfo objects | Definition Time when the resource monitoring data is reported and the monitoring data in the alarm record. |
| mask_status | String | Definition Alarm masking status. Range |
| Parameter | Type | Description |
|---|---|---|
| namespace | String | Definition Namespace of the service. For details, see Services Interconnected with Cloud Eye. Range The value is in the service.item format. The values of service and item must start with a letter and contain only letters, digits, and underscores (_). It can contain up to 32 characters. |
| metric_name | String | Definition Metric name of a resource. For details about the metric names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Range The value must start with a letter and can only contain letters, digits, underscores (_), and hyphens (-). It allows 1 to 96 characters. For example, the ECS metric cpu_util indicates the CPU usage of an ECS. The DDS metric mongo001_command_ps indicates the command execution frequency. |
| dimensions | Array of dimensions objects | Definition Resources. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition Dimension name of a resource. For example, the dimension of an ECS is instance_id . For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Range The value must start with a letter and can only contain letters, digits, underscores (_), and hyphens (-). It can contain 1 to 32 characters. |
| value | String | Definition: Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Value range: The value can contain 1 to 256 characters. |
| Parameter | Type | Description |
|---|---|---|
| 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 0: default value. For example, this value can be used for event alarms. 1: original metric period. For example, if the original period of an RDS metric is 60s, the metric data is collected and calculated every 60s. 300: The metric data is collected and calculated every 5 minutes. 1200: The metric data is collected and calculated every 20 minutes. 3600: The metric data is collected and calculated every 60 minutes. 14400: The metric data is collected and calculated every 4 hours. 86400: The metric data is collected and calculated every day. |
| filter | String | Definition Aggregation method. Range |
| comparison_operator | String | Definition Threshold symbol. Range The value can be: 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. |
| value | Double | Definition Alarm threshold. 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 . -1.7976931348623157e+108 to 1.7976931348623157e+108 |
| unit | String | Definition: Data unit. Value range: The value can contain a maximum of 32 characters. |
| count | Integer | Definition Number of consecutive alarm triggers. Range [1,180] |
| suppress_duration | Integer | Definition Alarm suppression duration (alarm interval), 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 |
|---|---|---|
| resource_id | String | Definition Resource ID corresponding to the alarm record, for example, 22d98f6c-16d2-4c2d-b424-50e79d82838f. Range 0 to 128 characters. |
| resource_name | String | Definition Resource name corresponding to the alarm record, for example, ECS-Test01. Range 0 to 128 characters. |
| event_id | String | Definition: ID of the event in the alarm record, for example, ev16031292300990kKN8p17J. Value range: The value can contain a maximum of 24 characters. |
| Parameter | Type | Description |
|---|---|---|
| type | String | Definition Notification type. Range The value can be: |
| notification_list | Array of strings | Definition: Recipients to be notified of the alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics". |
| Parameter | Type | Description |
|---|---|---|
| type | String | Definition Notification type. Range The value can be: |
| notification_list | Array of strings | Definition: Recipients to be notified of the alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics". |
| Parameter | Type | Description |
|---|---|---|
| time | String | Definition: UTC time when the resource monitoring data of the alarm record is reported. Value range: The value can contain 1 to 64 characters. |
| value | Double | Definition Resource monitoring data of the alarm record at the time point, for example, 7.019. Range An integer ranging from -1.7976931348623157e+108 to 1.7976931348623157e+108. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Status codes customized by each cloud service when a request error occurs. |
| error_msg | String | Request error message. |
| request_id | String | Request ID. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Status codes customized by each cloud service when a request error occurs. |
| error_msg | String | Request error message. |
| request_id | String | Request ID. |
Example Requests
Query the alarm records recorded from 2022-02-10T10:05:46+08:00 to 2022-02-10T12:05:46+08:00, where the alarm name is alarm-test01.
/v2/{project_id}/alarm-histories?limit=10&offset=0&from=2022-02-10T10:05:46+08:00&to=2022-02-10T12:05:46+08:00&alarm_name=alarm-test01 Example Responses
Status code: 200
Query succeeded.
{
"alarm_histories" : [ {
"alarm_id" : "al1604473987569z6n6nkpm1",
"record_id" : "ah251222T092004SAD2yARym",
"name" : "TC_CES_FunctionBaseline_Alarm_008",
"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,
"unit" : "",
"count" : 3,
"suppress_duration" : 3600
},
"level" : 2,
"type" : "ALL_INSTANCE",
"begin_time" : "2024-02-11T05:48:08+08:00",
"end_time" : "2024-02-11T08:48:08+08:00",
"first_alarm_time" : "2024-02-11T06:48:08+08:00",
"last_alarm_time" : "2024-02-11T08:48:08+08:00",
"alarm_recovery_time" : "2024-02-11T08:48:08+08:00",
"action_enabled" : false,
"alarm_actions" : [ ],
"ok_actions" : [ ],
"status" : "alarm",
"data_points" : [ {
"time" : "2022-06-22T16:38:02+08:00",
"value" : 873.1507798960139
}, {
"time" : "2022-06-22T16:28:02+08:00",
"value" : 883.1507798960139
}, {
"time" : "2022-06-22T16:18:02+08:00",
"value" : 873.4
} ],
"additional_info" : {
"resource_id" : "",
"resource_name" : "",
"event_id" : ""
},
"mask_status" : "UN_MASKED"
} ],
"count" : 103
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Query succeeded. |
| 400 | Parameter verification failed. |
| 500 | Internal system error. |
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