Querying Details of an Alarm Rule
Function
This API is used to query details of an alarm rule based on its ID.

For API V1, only an alarm rule can be configured for a single resource. You are advised to use Querying Alarm Rules (Recommended) and Querying Resources in an Alarm Rule to work with the console.
Debugging
You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.
URI
GET /V1.0/{project_id}/alarms/{alarm_id}
- Parameter description
Table 1 Parameter description Parameter
Mandatory
Description
project_id
Yes
Project ID.
For details about how to obtain the project ID, see Obtaining a Project ID.
alarm_id
Yes
Alarm rule ID.
- Example
GET https://{Cloud Eye endpoint}/V1.0/{project_id}/alarms/al1441967036681YkazZ0deN
Request
None
Response
- Response parameters
Parameter
Type
Description
metric_alarms
Array of objects
List of alarm objects.
For details, see Table 2.
Table 2 metric_alarms data structure description Parameter
Type
Description
alarm_name
String
Alarm name.
alarm_description
String
Provides supplementary information about the alarm rule.
metric
Object
Alarm metric.
For details, see Table 3.
condition
Object
Alarm triggering condition.
For details, see Table 8.
alarm_enabled
Boolean
Whether to enable the alarm rule.
alarm_level
Integer
Alarm severity, which can be 1 (critical), 2 (major), 3 (minor) or 4 (warning). The default value is 2.
alarm_type
String
Alarm rule type.
- EVENT.SYS: The alarm rule is created for system events. EVENT.CUSTOM: The alarm rule is created for custom events.
- RESOURCE_GROUP: The alarm rule is created for resource groups.
- MULTI_INSTANCE: The alarm rule is created for specific resources.
alarm_action_enabled
Boolean
Whether to enable the action triggered by the alarm.
alarm_actions
Array of objects
Action to be triggered by the alarm.
For details, see Table 5.
ok_actions
Array of objects
Action to be triggered after an alarm is cleared.
For details, see Table 6.
insufficientdata_actions
Array of objects
Action triggered by data insufficiency.
For details, see Table 7.
alarm_action_begin_time
String
Time when an alarm rule is applied. Notifications are sent only within the validity period of the alarm rule.
For example, if alarm_action_begin_time is set to 08:00 and alarm_action_end_time is set to 20:00, notifications are sent only from 08:00 to 20:00.
alarm_action_end_time
String
Time when an alarm rule becomes invalid.
For example, if alarm_action_begin_time is set to 08:00 and alarm_action_end_time is set to 20:00, notifications are sent only from 08:00 to 20:00.
alarm_id
String
Alarm rule ID.
update_time
Long
Time when the alarm status changed. The value is a UNIX timestamp, in milliseconds.
alarm_state
String
Alarm status. The value can be:
- ok: The alarm status is normal.
- alarm: An alarm is generated.
- insufficient_data: The required data is insufficient.
enterprise_project_id
String
Enterprise project ID.
- Value all_granted_eps indicates all enterprise projects.
- Value 0 indicates the default enterprise project default.
Table 3 metric data structure description Parameter
Type
Description
namespace
String
Namespace of the queried service. For details, see Services Interconnected with Cloud Eye.
dimensions
Array of objects
List of metric dimensions.
For details, see Table 4.
metric_name
String
Metric ID. For example, metric_name of ECS CPU usage is cpu_util. For details about the metrics of each service, see Services Interconnected with Cloud Eye.
resource_group_id
String
ID of the resource group selected during the alarm rule creation, for example, rg1603786526428bWbVmk4rP.
resource_group_name
String
Name of the resource group selected during the alarm rule creation, for example, Resource-Group-ECS-01.
Table 4 dimensions data structure description Parameter
Type
Description
name
String
Monitoring dimension name. For example, the ECS dimension is instance_id. For details about the dimension of each service, see the key column in Services Interconnected with Cloud Eye.
value
String
Dimension value, for example, an ECS ID.
Enter 1 to 256 characters.
Table 5 alarm_actions data structure description Parameter
Type
Description
type
String
Alarm notification type. The value can be:- notification: indicates that a notification will be sent.
- autoscaling: indicates that a scaling action will be triggered.
notificationList
Array of strings
List of objects to be notified of alarm status changes.
NOTE:The IDs in the list are strings.
Table 6 ok_actions data structure description Parameter
Type
Description
type
String
Notification type when an alarm is triggered.- notification: A notification will be sent.
- autoscaling: A scaling action will be triggered.
notificationList
Array of strings
List of objects to be notified of alarm status changes.
NOTE:The IDs in the list are strings.
Table 7 insufficientdata_actions data structure description Parameter
Type
Description
type
String
Notification type when an alarm is cleared. The value is notification.
notificationList
Array of strings
List of objects to be notified of alarm status changes.
NOTE:The IDs in the list are strings.
Table 8 condition data structure description Parameter
Type
Description
period
Integer
Interval (seconds) for checking whether the alarm rule conditions are met.
filter
String
Data aggregation method. The value can be:
- average: average value of metric data within an aggregation period.
- max: maximum value of metric data in an aggregation period.
- min: minimum value of metric data within an aggregation period.
- sum: sum of metric data within an aggregation period.
- variance: variance value of metric data within an aggregation period.
comparison_operator
String
Operator of alarm thresholds, which can be >, =, <, >=, or <=.
value
Double
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 ECS cpu_util in Services Interconnected with Cloud Eye to 80.
unit
String
Data unit. The value contains a maximum of 32 characters.
count
Integer
Number of consecutive times that the alarm policy was met. Supported range: 1 to 5
suppress_duration
Integer
Interval for triggering an alarm if the alarm persists. The value can be: 0: alarm triggered only once. 300: alarm triggered every 5 minutes. 600: alarm triggered every 10 minutes. 900: alarm triggered every 15 minutes. 1800: alarm triggered every 30 minutes. 3600: alarm triggered every 1 hour. 10800: alarm triggered every 3 hours. 21600: alarm triggered every 6 hours. 43200: alarm triggered every 12 hours. 86400: alarm triggered every day.
- Example response
{ "metric_alarms": [ { "alarm_name":"alarm-ipwx", "alarm_description":"", "metric": { "namespace":"SYS.ELB", "dimensions": [ { "name":"lb_instance_id", "value":"44d06d10-bce0-4237-86b9-7b4d1e7d5621" } ], "metric_name":"m8_out_Bps" }, "condition": { "period":300, "filter":"sum", "comparison_operator":">=", "value":0, "unit":"", "count":1, "suppress_duration":1800 }, "alarm_enabled":true, "alarm_level": 2, "alarm_action_enabled":true, "alarm_actions": [ { "type":"notification", "notificationList":["urn:smn:region:68438a86d98e427e907e0097b7e35d48:sd"] } ], "ok_actions": [ { "type":"notification", "notificationList":["urn:smn:region:68438a86d98e427e907e0097b7e35d48:sd"] } ], "alarm_id":"al1498096535573r8DNy7Gyk", "update_time":1498100100000, "alarm_state":"alarm" } ] }
Returned Values
- Normal
- Abnormal
Returned Value
Description
400 Bad Request
Request error.
401 Unauthorized
The authentication information is not provided or is incorrect.
403 Forbidden
Access to the requested page is forbidden.
408 Request Timeout
The request timed out.
429 Too Many Requests
Concurrent requests are excessive.
500 Internal Server Error
Failed to complete the request because of an internal service error.
503 Service Unavailable
The service is currently 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