Querying Alarm Rules of a Service in One-Click Monitoring
Function
This API is used to query alarm rules of a service in one-click monitoring.
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:listOneClickAlarms
List
-
g:EnterpriseProjectId
ces:oneClickAlarms:list
-
URI
GET /v2/{project_id}/one-click-alarms/{one_click_alarm_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 |
| one_click_alarm_id | Yes | String | Definition One-click monitoring ID for a service. Constraints N/A Range The value allows 1 to 64 characters and can contain only letters and digits. 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 |
|---|---|---|
| alarms | Array of alarms objects | Alarm rule list. |
| Parameter | Type | Description |
|---|---|---|
| alarm_id | String | Definition Alarm rule ID. Constraints N/A Range The value starts with al and is followed by 22 characters that may include letters, digits, or a combination of both. Default Value N/A |
| name | String | Definition Alarm 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 |
| description | String | Definition Alarm description. Constraints N/A Range [0,256] Default Value N/A |
| namespace | 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 |
| policies | Array of OneClickAlarmPolicy objects | Alarm policies. |
| resources | Array of ResourcesInListResp objects | Resource list. Associated resources can be obtained by calling the API for querying resources in an alarm rule. |
| type | String | Definition Alarm rule type. Constraints N/A Range The value can be:
Default Value N/A |
| enabled | Boolean | Definition Whether to enable the alarm rule. Constraints N/A Range A boolean value. Default Value true |
| notification_enabled | Boolean | Definition Whether to enable alarm notifications. If notification_enabled is set to true, you must specify either alarm_notifications or ok_notifications. Constraints N/A Range A boolean value, which can be: Default Value true |
| alarm_notifications | Array of Notification objects | Definition Notification group or topic subscription for alarm notifications. Constraints You can specify up to 10 notification groups or topic subscriptions. |
| ok_notifications | Array of Notification objects | Definition Information about the notification group or topic subscription when the alarm is cleared. Constraints You can specify up to 10 notification groups or topic subscriptions. |
| notification_begin_time | String | Definition Time when alarm notifications were enabled. Example: 00:00 Constraints N/A Range The value allows 1 to 64 characters and can only contain digits and colons (:). Default Value N/A |
| notification_end_time | String | Definition Time when alarm notifications were disabled. Example: 08:00 Constraints N/A Range The value allows 1 to 64 characters and can only contain digits and colons (:). Default Value N/A |
| effective_timezone | String | Definition Time zone, for example, GMT-08:00, GMT+08:00, or GMT+0:00. Constraints N/A Range 1 to 16 characters Default Value N/A |
| notification_manner | String | Notification mode, which can be NOTIFICATION_GROUP (notification groups), TOPIC_SUBSCRIPTION (topic subscriptions), or NOTIFICATION_POLICY (notification policies). |
| notification_policy_ids | Array of strings | Definition Associated notification policy IDs. Constraints You can specify up to 20 notification policy IDs. |
| Parameter | Type | Description |
|---|---|---|
| alarm_policy_id | String | Definition Alarm policy ID. Constraints N/A Range The value allows 1 to 64 characters and can contain only letters, digits, and hyphens (-). Default Value N/A |
| 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. Constraints N/A 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. Default Value N/A |
| period | Integer | Definition Interval (seconds) for checking whether the alarm rule conditions are met. Constraints N/A Range The value can be:
Default Value N/A |
| filter | String | Definition Aggregation method. Constraints When period is set to 1 (original value), the filter field does not take effect. The default value of filter is average. The filter parameter takes effect only when period is greater than 1. Range Default Value N/A |
| comparison_operator | String | Definition Threshold symbol. Constraints The threshold symbols for metric alarms are >, >=, <, <=, =, !=, cycle_decrease, cycle_increase, and cycle_wave. The threshold symbols for event alarms are >, >=, <, <=, =, and !=. 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. Default Value N/A |
| value | Number | Definition Alarm threshold. For details, see Services Interconnected with Cloud Eye. Constraints If there is only one threshold, value and alarm_level are used in pairs. If there are both hierarchical_value and value, hierarchical_value is used. Range -1.7976931348623157e+108 to 1.7976931348623157e+108 Default Value N/A |
| hierarchical_value | HierarchicalValue object | Definition Multi-level alarm threshold. Constraints If there are both hierarchical_value and value, hierarchical_value is used. When you create or modify an alarm rule, you can set only one threshold in the following scenarios: |
| unit | String | Definition Data unit. Constraints N/A Range [0,32] Default Value N/A |
| count | Integer | Definition Number of times that the alarm triggering conditions are met. Constraints N/A 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. Default Value N/A |
| 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. Constraints N/A Range The value can be:
Default Value N/A |
| level | Integer | Definition Alarm severity. Constraints N/A Range The value can be: Default Value 2 |
| enabled | Boolean | Definition Whether to enable one-click monitoring. Constraints N/A Range Default Value true |
| selected_unit | String | Definition The unit you selected, which is used for subsequent metric data display and calculation. A maximum of 64 characters are allowed. Constraints N/A Range 0 to 64 characters Default Value N/A |
| Parameter | Type | Description |
|---|---|---|
| critical | Double | Definition Threshold for critical alarms. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
| major | Double | Definition Threshold for major alarms. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
| minor | Double | Definition Threshold for minor alarms. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
| info | Double | Definition Threshold for warnings. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
| 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. Constraints N/A Range The value can be: Default Value N/A |
| 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." Constraints If type is set to notification, the value of notification_list cannot be left blank. If type is set to autoscaling, the value of notification_list must be left blank. If notification_enabled is set to true, you must specify either alarm_notifications or ok_notifications or both. If both alarm_notifications and ok_notifications are specified, their notification_list values must be the same. You can specify up to 20 recipients. |
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: 401
| 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: 403
| 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
None
Example Responses
Status code: 200
OK
{
"alarms" : [ {
"alarm_id" : "al123232232341232132",
"name" : "alarm1",
"description" : "hello world",
"namespace" : "SYS.ECS",
"policies" : [ {
"alarm_policy_id" : "alxdxxxdsw12321321",
"metric_name" : "cpu_util",
"period" : 0,
"filter" : "max",
"comparison_operator" : "",
"value" : 1.7976931348623156E108,
"unit" : "%",
"count" : 100,
"suppress_duration" : 0,
"level" : 2,
"enabled" : true
} ],
"resources" : [ {
"dimensions" : [ {
"name" : "string",
"value" : "string"
} ]
} ],
"type" : "EVENT.SYS",
"enabled" : true,
"notification_enabled" : true,
"alarm_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:123" ]
} ],
"ok_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:123" ]
} ],
"notification_begin_time" : "00:00",
"notification_end_time" : "23:59",
"notification_manner" : "NOTIFICATION_POLICY",
"notification_policy_ids" : [ "np15563156337845e8A2Wv63" ]
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Parameter verification failed. |
| 401 | Not authenticated. |
| 403 | Authentication 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