Querying Alarm Records
Function
This API is used to query alarm records.
URI
GET /v2/{project_id}/alarm-histories
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the tenant ID. Minimum: 1 Maximum: 64 Regex Pattern: ^[a-zA-Z0-9-]{1,64}$ |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
alarm_id |
No |
String |
Specifies an alarm ID, which starts with al and is followed by a 22-digit string consisting of letters and digits. Minimum: 24 Maximum: 24 |
name |
No |
String |
Specifies the alarm rule name. Minimum: 0 Maximum: 128 |
status |
No |
String |
Specifies the alarm rule status. The value can be ok, alarm or invalid. Minimum: 0 Maximum: 64 Regex Pattern: ^(ok|alarm|invalid)$ |
level |
No |
Integer |
Specifies the alarm severity, which can be: 1 (critical), 2 (major), 3 (minor) or 4 (informational). Minimum: 1 Maximum: 4 |
namespace |
No |
String |
Specifies the namespace of a service. For details about the namespace of each service, see the Namespace column. Minimum: 3 Maximum: 32 |
resource_id |
No |
String |
Specifies the alarm resource ID. If a resource has multiple dimensions, the resource IDs are sorted in ascending alphabetical order and separated by commas (,). Minimum: 0 Maximum: 2048 |
from |
No |
String |
Specifies the start time for querying alarm records, for example, 2022-02-10T10:05:46+08:00. Minimum: 0 Maximum: 64 |
to |
No |
String |
Specifies the end time for querying alarm records, for example, 2022-02-10T10:05:47+08:00. Minimum: 0 Maximum: 64 |
offset |
No |
Integer |
Specifies the pagination offset. Minimum: 0 Maximum: 999 Default: 0 Regex Pattern: ^(0|[1-9]|[1-9][0-9])$ |
limit |
No |
Integer |
Specifies the page size. Minimum: 1 Maximum: 100 Default: 10 Regex Pattern: ^([1-9]|[1-9][0-9]|100)$ |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Specifies the MIME type of a request body. The default type is application/json; charset=UTF-8. Default: application/json; charset=UTF-8 Minimum: 1 Maximum: 64 |
X-Auth-Token |
Yes |
String |
Specifies the user token. Minimum: 1 Maximum: 16384 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
alarm_histories |
Array of AlarmHistoryItemV2 objects |
Specifies the alarm histories. |
count |
Integer |
Specifies the total number of alarm records. Minimum: 0 Maximum: 2147483647 |
Parameter |
Type |
Description |
---|---|---|
record_id |
String |
Specifies the alarm record ID. Minimum: 24 Maximum: 24 |
alarm_id |
String |
Specifies the alarm rule ID, for example, al1603131199286dzxpqK3Ez. Minimum: 24 Maximum: 24 |
name |
String |
Specifies the alarm rule name, for example, alarm-test01. Minimum: 1 Maximum: 128 |
status |
String |
Specifies the status of an alarm record. The value can be ok, alarm, or invalid. Enumeration values:
|
level |
Integer |
Specifies the severity of an alarm record. The value can be 1 (critical), 2 (major), 3 (minor), or 4 (informational). Enumeration values:
|
type |
String |
Specifies the alarm rule type. Enumeration values:
|
action_enabled |
Boolean |
Specifies whether to send a notification. The value can be true or false. |
begin_time |
String |
Specifies when an alarm record is generated (UTC time). |
end_time |
String |
Specifies when an alarm record becomes invalid (UTC time). |
metric |
Metric object |
Specifies the metric information. |
condition |
AlarmCondition object |
Specifies the alarm triggering condition. |
additional_info |
AdditionalInfo object |
Specifies the additional field of an alarm record, which applies only to alarm records generated in the event monitoring scenario. |
alarm_actions |
Array of Notification objects |
Specifies the action to be triggered by an alarm. The structure is as follows: { "type": "notification", "notification_list": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }. type can be notification, autoscaling, or notification_list. notification: indicates that a notification action will be triggered. autoscaling: indicates that a scaling action will be triggered. notification_list: When the alarm rule status changes, Cloud Eye will notify users in the notification list. |
ok_actions |
Array of Notification objects |
Specifies the action to be triggered after the alarm is cleared. The structure is as follows: { "type": "notification", "notification_list": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }. type can be notification or notification_list. notification: indicates that a notification action will be triggered. notification_list: When the alarm rule status changes, Cloud Eye will notify users in the notification list. |
data_points |
Array of DataPointInfo objects |
Specifies the time when the resource monitoring data is reported and the monitoring data in the alarm record. |
Parameter |
Type |
Description |
---|---|---|
namespace |
String |
Specifies the namespace of a service. For details about the namespace of each service, see the Namespace column. Minimum: 3 Maximum: 32 |
metric_name |
String |
Specifies the metric name of a resource. The name must start with a letter and contain only letters, digits, and underscores (_). The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in Distribute Data Service (DDS) indicates the command execution frequency. For details about the metric name of each service, see Service metric name. Minimum: 1 Maximum: 64 |
dimensions |
Array of Dimension objects |
Specifies the metric dimension. A maximum of four dimensions can be added. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Resource dimension. For example, the dimension of an ECS is instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Service metric dimension. Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){1,32}$ |
value |
String |
Specifies the value of a resource dimension, which is the resource instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Regex Pattern: ^((([a-z]|[A-Z]|[0-9]){1}([a-z]|[A-Z]|[0-9]|_|-|\.)*)|\*){1,256}$ |
Parameter |
Type |
Description |
---|---|---|
period |
Integer |
Specifies the monitoring period of a metric, in seconds. The default value is 0. For example, for an event alarm, set this parameter to 0. 1 indicates the original monitoring period of the metric. For example, if the original period of an RDS metric is 60s, the Relational Database Service (RDS) metric is calculated every 60 seconds as a data point. For details about the original period of each cloud service metric, see the Namespace column. 300 indicates that the metric is calculated every 5 minutes as a data point. Enumeration values:
|
filter |
String |
Specifies the aggregation method. The value can be average, min, max, or sum. Minimum: 1 Maximum: 15 Regex Pattern: ^(average|min|max|sum)$ |
comparison_operator |
String |
Specifies the threshold operator. Minimum: 1 Maximum: 10 Regex Pattern: ^(>|<|>=|<=|=)$ |
value |
Double |
Specifies the alarm threshold. Supported 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 Elastic Cloud Server (ECS) cpu_util to 80. Minimum: 0 Maximum: 1.174271E108 |
unit |
String |
Specifies the data unit. Enter up to 32 characters. Minimum: 0 Maximum: 32 |
count |
Integer |
Specifies the number of counts that the threshold is met. Minimum: 1 Maximum: 100 |
suppress_duration |
Integer |
Specifies the alarm suppression time, in seconds. This field corresponds to the last field of the alarm policy when an alarm rule is created on the Cloud Eye console. This field is used to avoid frequent alarms. 0 indicates that the alarm is not suppressed and an alarm is generated when the condition is met. 300 indicates that an alarm is generated every 5 minutes after the alarm triggering condition is met. Enumeration values:
Regex Pattern: ^(0|300|600|900|1800|3600|10800|21600|43200|86400)$ |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Specifies the resource ID corresponding to the alarm record, for example, 22d98f6c-16d2-4c2d-b424-50e79d82838f. Minimum: 0 Maximum: 128 |
resource_name |
String |
Specifies the resource name corresponding to the alarm record, for example, ECS-Test01. Minimum: 0 Maximum: 128 |
event_id |
String |
Specifies the ID of the event in the alarm record, which is the event generated by the resource, for example, ev16031292300990kKN8p17. Minimum: 24 Maximum: 24 |
Parameter |
Type |
Description |
---|---|---|
type |
String |
Specifies the notification type. notification indicates that notifications are sent through Simple Message Notification (SMN). Regex Pattern: ^(notification|autoscaling|ecsRecovery|contact|contactGroup|iecAction)$ |
notification_list |
Array of strings |
Specifies the list of objects to be notified if the alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics". When type is set to notification, notification_list cannot be left blank. Note: If alarm_action_enabled is set to true, alarm_actions, ok_actions, or both of them must be specified. If alarm_actions and ok_actions coexist, their notification_list values must be the same. |
Parameter |
Type |
Description |
---|---|---|
time |
String |
Specifies the UTC time when the resource monitoring data of the alarm record is reported. Minimum: 1 Maximum: 64 |
value |
Double |
Specifies the resource monitoring value of the alarm record at the time point, for example, 7.019. Minimum: 0 Maximum: 1.7976931348623157E308 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Example Requests
/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" : "ah1655717086704DEnBrJ999", "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, "count" : 3, "suppress_duration" : 3600 }, "level" : 2, "type" : "ALL_INSTANCE", "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" : "" } } ], "count" : 103 }
Status Codes
Status Code |
Description |
---|---|
200 |
Query succeeded. |
400 |
Parameter verification failed. |
500 |
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