Querying Alarm Policies
Function
This API is used to query alarm policies by alarm rule ID.
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:getPolicies
Read
alarm *
- 
           
g:ResourceTag/<tag-key>
 - 
           
g:EnterpriseProjectId
 
- ces:alarms:get
 
-
 - 
           
 
URI
GET /v2/{project_id}/alarms/{alarm_id}/policies
| 
        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  | 
     
| 
        alarm_id  | 
      
        Yes  | 
      
        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. The value can contain a total of 24 characters. Default Value N/A  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        offset  | 
      
        No  | 
      
        Integer  | 
      
        Definition Pagination offset. Constraints N/A Range 0-10000 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  | 
     
|---|---|---|
| 
        policies  | 
      
        Array of ListPolicyResp objects  | 
      
        Definition List of alarm policies.  | 
     
| 
        count  | 
      
        Integer  | 
      
        Definition Total number of policies in an alarm rule. Range 0-100  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        metric_name  | 
      
        String  | 
      
        Definition Metric name of a resource. For details about the metrics of each service, see Service Metric Names. Range The value must start with a letter and can only contain digits, letters, underscores (_), and hyphens (-). 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.  | 
     
| 
        extra_info  | 
      
        MetricExtraInfoResp object  | 
      
        Definition Additional information about the alarm policy.  | 
     
| 
        period  | 
      
        Integer  | 
      
        Definition Interval (seconds) for checking whether the alarm rule conditions are met. Range The value can be: 
  | 
     
| 
        filter  | 
      
        String  | 
      
        Definition Aggregation method. Range average, variance, min, max, or sum  | 
     
| 
        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 specific thresholds, see the value range of each metric in the appendix. Range The value ranges from 0 to 1.7976931348623157e+108.  | 
     
| 
        hierarchical_value  | 
      
        HierarchicalValueResp object  | 
      
        Definition Multi-level alarm threshold. Range When you create or modify an alarm rule, you can set only one threshold in the following scenarios: 
  | 
     
| 
        unit  | 
      
        String  | 
      
        Definition Data unit. Range [0,32]  | 
     
| 
        type  | 
      
        String  | 
      
        Definition Alarm policy type. This API has been deprecated. Constraints N/A Range [0,32] Default Value N/A  | 
     
| 
        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: 1 (critical), ** 2** (major), 3 (minor), or 4 (warning)  | 
     
| 
        namespace  | 
      
        String  | 
      
        Definition Service namespace. For details about the namespace of each service, see Service Namespaces. Range The value is in the service.item format. The values of service and item must be a string, starting with a letter and containing only digits (0–9), letters (case-insensitive), and underscores (_). The value contains 0 to 32 characters.  | 
     
| 
        dimension_name  | 
      
        String  | 
      
        Definition Metric dimension name. For details, see Service Dimension Names. Range The value must start with a letter. Each dimension allows a maximum of 32 characters and can only contain digits, letters, underscores (_), and hyphens (-). Multiple dimensions are separated by commas (,). A maximum of four dimensions are supported. Example: instance_id for single-dimension scenarios; instance_id,disk for multi-dimension scenarios.  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        origin_metric_name  | 
      
        String  | 
      
        Definition Original metric name. Range [0,4,096]  | 
     
| 
        metric_prefix  | 
      
        String  | 
      
        Definition Metric name prefix. Range [0,4,096]  | 
     
| 
        custom_proc_name  | 
      
        String  | 
      
        Definition Name of a process. Range [0,250]  | 
     
| 
        metric_type  | 
      
        String  | 
      
        Definition Metric type. Range [0,32]  | 
     
| 
        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]  | 
     
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: 404
| 
        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 an alarm policy whose alarm_id is alCzk8o9dtSQHtiDgb44Eepw and limit is 10.
/v2/{project_id}/alarms/alCzk8o9dtSQHtiDgb44Eepw/policies?offset=0&limit=10
 Example Responses
Status code: 200
Query succeeded.
{
  "policies" : [ {
    "namespace" : "AGT.ECS",
    "metric_name" : "disk_device_read_bytes_rate",
    "extra_info" : { },
    "period" : 1,
    "filter" : "average",
    "comparison_operator" : ">",
    "value" : 75,
    "hierarchical_value" : {
      "critical" : 1
    },
    "unit" : "byte/s",
    "count" : 3,
    "type" : "",
    "suppress_duration" : 10800,
    "level" : 2
  } ],
  "count" : 10
}
 Status Codes
| 
        Status Code  | 
      
        Description  | 
     
|---|---|
| 
        200  | 
      
        Query succeeded.  | 
     
| 
        400  | 
      
        Parameter verification failed.  | 
     
| 
        404  | 
      
        Alarm rule not found.  | 
     
| 
        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