Modifying All Fields in an Alarm Policy
Function
This API is used to modify all fields in an alarm rule.
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.
URI
PUT /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 24 characters of letters, digits, or a combination of both. 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 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| policies | Yes | Array of UpdatePolicyReq objects | Definition Policy information. Constraints You can specify 1 to 50 policies. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| metric_name | Yes | 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 |
| extra_info | No | MetricExtraInfo object | Definition Additional information about the policy. Constraints If the policy does not contain additional information, extra_info does not need to be transferred. |
| period | Yes | Integer | Definition Metric period, in seconds. For details about the original metric period for each cloud service, see Services Interconnected with Cloud Eye.
Default Value N/A Constraints N/A Range The value can be: |
| filter | Yes | 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 | Yes | 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 | No | 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 | No | 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 | No | String | Definition Data unit. Constraints N/A Range [0,32] Default Value N/A |
| type | No | String | Definition Alarm policy type. This parameter has been deprecated. Constraints N/A Range N/A Default Value N/A |
| count | Yes | 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 | No | Integer | Definition Alarm suppression duration, in seconds. This parameter is used to mitigate frequent alarms. Constraints N/A Range The value can be:
Default Value N/A |
| level | No | Integer | Definition Alarm severity. Constraints N/A Range The value can be: Default Value 2 |
| namespace | No | String | Definition For details about service namespaces, see Services Interconnected with Cloud Eye. Constraints This parameter is mandatory. namespace and dimension_name need to be specified for cloud product-level rules to specify the resources to which the policy applies. 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 (_). 0 to 32 characters. Default Value N/A |
| dimension_name | No | String | Definition Dimension information 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. Constraints This parameter is mandatory. 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. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| origin_metric_name | Yes | String | Definition Original metric name. Constraints N/A Range 0 to 4,096 characters Default Value N/A |
| metric_prefix | No | String | Definition Metric name prefix. Constraints N/A Range 0 to 4,096 characters Default Value N/A |
| custom_proc_name | No | String | Definition Name of a process. Constraints N/A Range [0,250] Default Value N/A |
| metric_type | No | String | Definition Metric type. Constraints N/A Range 0 to 32 characters Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| critical | No | Double | Definition Threshold for critical alarms. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
| major | No | Double | Definition Threshold for major alarms. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
| minor | No | Double | Definition Threshold for minor alarms. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
| info | No | Double | Definition Threshold for warnings. Constraints N/A Range [-1.7976931348623157e+108, 1.7976931348623157e+108] Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| policies | Array of UpdatePolicyResp objects | Definition Policy information. |
| 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. |
| extra_info | MetricExtraInfoResp object | Definition Additional information about the policy. If the policy does not contain additional information, extra_info does not need to be transferred. |
| 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] |
| type | String | Definition Alarm policy type. This parameter has been deprecated. Range 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 is used to mitigate frequent alarms. Range The value can be:
|
| level | Integer | Definition Alarm severity. Range The value can be: |
| namespace | String | Definition For details about service namespaces, see 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 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 (_). 0 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. 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 |
|---|---|---|
| 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: 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
Modify an alarm policy whose metric name is disk_device_read_bytes_rate, including its metric period, aggregation method, threshold, unit, count, alarm suppression duration, and alarm severity.
{
"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,
"namespace" : "AGT.ECS",
"dimension_name" : "instance_id"
} ]
} Example Responses
Status code: 200
Modification succeeded.
{
"policies" : [ {
"namespace" : "AGT.ECS",
"dimension_name" : "instance_id",
"metric_name" : "disk_device_read_bytes_rate",
"period" : 1,
"filter" : "average",
"comparison_operator" : ">",
"value" : 75,
"unit" : "byte/s",
"count" : 3,
"type" : "",
"suppress_duration" : 10800,
"level" : 2
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Modification 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