Querying Alarm Rules (Recommended)
Function
This API is used to query the alarm rule list.
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:alarms:list
List
-
g:EnterpriseProjectId
-
-
URI
GET /v2/{project_id}/alarms
| 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 | 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. Default Value N/A |
| name | No | String | Definition Alarm rule name. Constraints N/A Range The value allows 1 to 128 characters and can only contain letters, digits, underscores (_), and hyphens (-). 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 up 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 (,). The value can contain 0 to 700 characters. Default Value N/A |
| enterprise_project_id | No | String | Definition Enterprise project ID. Constraints N/A 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). Default Value N/A |
| product_name | No | String | Definition Name of the cloud product that the resource belongs to. Generally, the value format is Service namespace,First-level dimension of the service, for example, SYS.ECS,instance_id. Constraints N/A Range 0 to 128 characters. Default Value N/A |
| resource_level | No | String | Definition Resource level of the alarm rule to create. The value product indicates the cloud product type. An empty value or the value dimension indicates the specific dimension type. Constraints N/A Range The value can be: Default Value N/A |
| offset | No | Integer | Definition Pagination offset. Constraints N/A Range [0,10,000] Default Value 0 |
| limit | No | Integer | Definition Number of records displayed on each page. Constraints N/A Range [1,100] Default Value 10 |
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 |
|---|---|---|
| alarms | Array of alarms objects | Definition Alarm rules. Range Max. 100 alarm rules. |
| count | Integer | Definition Total number of alarm rules. Range [0,10000] |
| Parameter | Type | Description |
|---|---|---|
| alarm_id | String | Definition Alarm rule ID. Example: al123232232341232132 Range The value starts with al and is followed by 22 characters of letters, digits, or a combination of both. It contains 24 characters. |
| name | String | Definition Alarm rule name. Range The value allows 1 to 128 characters and can only contain letters, digits, underscores (_), and hyphens (-). |
| description | String | Definition Alarm description. Range [0,256] |
| 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 (_). The value can contain up to 32 characters. |
| policies | Array of PolicyResp objects | Definition Alarm policy. Range Max. 100 policies |
| resources | Array of ResourcesInListResp objects | Definition Resource list. Associated resources can be obtained by calling the API for Querying Resources in an Alarm Rule. Range Max. 3,000 resources. |
| type | String | Definition Alarm rule type. Range The value can be: |
| enabled | Boolean | Definition Whether to enable the alarm rule. Range A boolean value. |
| notification_enabled | Boolean | Definition Whether to enable alarm notifications. Range A boolean value. |
| alarm_notifications | Array of NotificationResp objects | Definition Notification group or topic subscription for alarm notifications. |
| ok_notifications | Array of NotificationResp objects | Definition Information about the notification group or topic subscription when the alarm is cleared. |
| notification_begin_time | String | Definition Time when alarm notifications were enabled. Example: 00:00 Range The value allows 1 to 64 characters and can only contain digits and colons (:). |
| notification_end_time | String | Definition Time when alarm notifications were disabled. Example: 08:00 Range The value allows 1 to 64 characters and can only contain digits and colons (:). |
| effective_timezone | String | Definition Time zone, for example, GMT-08:00, GMT+08:00, or GMT+0:00. Range 1 to 16 characters |
| enterprise_project_id | String | Definition Enterprise project ID. Range The value can only contain lowercase letters, digits, and hyphens (-). 0 indicates the ID of the default enterprise project. |
| alarm_template_id | String | Definition ID of the alarm template associated with the alarm rule. Range The value starts with at and allows 2 to 64 characters. It can only contain letters and digits. |
| product_name | String | Definition Name of a cloud product when the resource level is cloud product. Generally, the value format is Service namespace,First-level dimension of the service, for example, SYS.ECS,instance_id. Range 0 to 128 characters. |
| resource_level | String | Definition Resource level. Range The value can be: |
| tags | Array of ResourceTagResp objects | Definition Tenant tags. Range A maximum of 20 tags |
| Parameter | Type | Description |
|---|---|---|
| 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. |
| 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: |
| filter | String | Definition Aggregation method. Range |
| 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. |
| value | Number | Definition Alarm threshold. For details, see Services Interconnected with Cloud Eye. Range -1.7976931348623157e+108 to 1.7976931348623157e+108 |
| hierarchical_value | HierarchicalValueResp object | Definition Multi-level alarm threshold. |
| unit | String | Definition Data unit. Range [0,32] |
| count | Integer | Definition Number of times that the alarm triggering conditions are met. Range For event alarms, the value ranges from 1 to 180. For metric and website alarms, the value can be 1, 2, 3, 4, 5, 10, 15, 30, 60, 90, 120, or 180. |
| 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:
|
| level | Integer | Definition Alarm severity. Range The value can be: |
| namespace | String | Definition namespace and dimension_name need to be specified for cloud product-level rules. This is to specify the resources that the policies apply to. 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 (_). The value can contain up to 32 characters. |
| dimension_name | String | Definition Dimension name of a resource. For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. namespace and dimension_name need to be specified for cloud product-level rules to specify the resources to which the policy applies. Range A maximum of four dimensions are supported. Example: instance_id for single-dimension scenarios and instance_id,disk for multi-dimension scenarios. |
| Parameter | Type | Description |
|---|---|---|
| critical | Double | Definition Threshold for critical alarms. Range [-1.7976931348623157e+108, 1.7976931348623157e+108] |
| major | Double | Definition Threshold for major alarms. Range [-1.7976931348623157e+108, 1.7976931348623157e+108] |
| minor | Double | Definition Threshold for minor alarms. Range [-1.7976931348623157e+108, 1.7976931348623157e+108] |
| info | Double | Definition Threshold for warnings. Range [-1.7976931348623157e+108, 1.7976931348623157e+108] |
| Parameter | Type | Description |
|---|---|---|
| resource_group_id | String | Definition Resource group ID. This parameter is available when the monitoring scope is Resource groups. Range The value starts with rg and is followed by 22 characters of letters, digits, or a combination of both. |
| resource_group_name | String | Definition Resource group name. This parameter is available when the monitoring scope is Resource groups. Range 1 to 128 characters. |
| dimensions | Array of MetricDimensionResp objects | Definition Dimension information. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition Resource dimension name. Range The value must start with a letter and can contain 1 to 32 characters. |
| value | String | Definition Resource dimension value. Range 0 to 256 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 |
|---|---|---|
| key | String | Definition Tag name. Range 1 to 128 Unicode characters. |
| value | String | Definition Tag value. Range 0 to 255 Unicode characters. |
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 alarm rules.
/v2/{project_id}/alarms?offset=0&limit=10 Example Responses
Status code: 200
Query succeeded.
{
"alarms" : [ {
"alarm_id" : "al16558829757444BVVxr999",
"name" : "alarm01",
"description" : "",
"namespace" : "SYS.ECS",
"policies" : [ {
"metric_name" : "disk_device_read_bytes_rate",
"period" : 1,
"filter" : "average",
"comparison_operator" : ">",
"value" : 75,
"unit" : "byte/s",
"count" : 3,
"suppress_duration" : 10800,
"level" : 2
} ],
"resources" : [ {
"dimensions" : [ {
"name" : "disk_name"
} ]
} ],
"type" : "ALL_INSTANCE",
"enabled" : true,
"notification_enabled" : true,
"alarm_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:xxx:xxx70e7359:topic_xxx" ]
} ],
"ok_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:xxx:xxx70e7359:topic_xxx" ]
} ],
"notification_begin_time" : "00:00",
"notification_end_time" : "23:59",
"enterprise_project_id" : "0",
"tags" : [ {
"key" : "Usage",
"value" : "project1"
} ]
} ],
"count" : 1
} 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