Modifying an Alarm Rule
Function
This API is used to modify an alarm rule.
You can call the API V1 to configure only one alarm rule with one policy per resource. You are advised to use the console functions and APIs for Batch Adding Resources to an Alarm Rule, Batch Deleting Resources from an Alarm Rule, and Modifying Policies 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 /V1.0/{project_id}/alarms/{alarm_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| alarm_id | Yes | 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. It contains 24 characters. Default Value: N/A |
| 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 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | No | String | Definition MIME type of the request body. Constraints N/A Range 1 to 64 characters Default Value Default value application/json; charset=UTF-8 is recommended. For APIs used to upload objects or images, the MIME type varies with the flow type. |
| X-Auth-Token | No | String | Definition User token. Constraints N/A Range 1 to 16,384 characters Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| alarm_name | No | String | Definition Alert 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 |
| alarm_description | No | String | Definition Alarm description. Constraints N/A Range [0,256] Default Value N/A |
| condition | No | Condition object | Definition Alarm policy configured in the alarm rule. Constraints N/A |
| alarm_action_enabled | No | Boolean | Definition Whether to enable alarm notifications. Constraints If alarm_action_enabled is set to true, alarm_actions, ok_actions, or both of them must be specified. If alarm_actions and ok_actions coexist, their notificationList values must be the same. Range The value can be: Default Value false |
| alarm_level | No | Integer | Definition Alarm severity. Constraints N/A Range The value can be: Default Value 2 |
| alarm_type | No | String | Definition Alarm type. Constraints N/A Range
Default Value N/A |
| alarm_actions | No | Array of AlarmActions objects | Definition Information about the notification group or topic subscription when the alarm is triggered. A structure example is as follows: { "type": "notification","notificationList":["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } Constraints A maximum of 10 recipients are allowed. |
| insufficientdata_actions | No | Array of AlarmActions objects | Definition Notification group or topic subscription when an alarm notification is triggered due to insufficient data. (This parameter has been deprecated and does not need to be configured.) Constraints A maximum of 10 alarm actions can be configured. |
| ok_actions | No | Array of AlarmActions objects | Definition Information about the notification group or topic subscription when the alarm is cleared. A structure example is as follows: { "type": "notification","notificationList":["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } Constraints A maximum of 10 recipients are allowed. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| 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. |
| count | Yes | Integer | Definition Number of consecutive times that an alarm is triggered. Constraints N/A Range An integer ranging from 1 to 5. Default Value N/A |
| filter | Yes | String | Definition Data 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 The value can be: Default Value N/A |
| 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. ConstraintsThe value can be:
N/A Range N/A |
| unit | No | String | Definition Data unit. Constraints N/A Range 0 to 32 characters Default Value N/A |
| value | Yes | Number | Definition Alarm threshold. 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 . 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 |
| suppress_duration | No | 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 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| [items] | No | Array of Notification objects | Definition Notification group or topic subscription information. Constraints A maximum of 20 actions are supported. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Definition Alarm notification type. Constraints N/A Range The value can be: Default Value N/A |
| notificationList | Yes | Array of strings | Definition Recipients to be notified of the alarm status changes. Constraints A maximum of 20 recipients can be configured. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics." Note: If alarm_action_enabled is set to true, alarm_actions, ok_actions, or both of them must be specified. If alarm_actions and ok_actions coexist, their notificationList values must be the same. |
Response Parameters
Status code: 204
No Content
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| - | String | Request error. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| - | String | The authentication information is not provided or is incorrect. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| - | String | Access to the requested page is forbidden. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| - | String | The request timed out. |
Status code: 429
| Parameter | Type | Description |
|---|---|---|
| - | String | Too many requests. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| - | String | Failed to complete the request because of an internal service error. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| - | String | The system is currently unavailable. |
Example Requests
{
"alarm_name" : "alarm-update-test01",
"alarm_description" : "alarm-update-test01",
"condition" : {
"comparison_operator" : ">=",
"count" : 3,
"filter" : "average",
"period" : 1,
"value" : 95
},
"alarm_action_enabled" : false,
"alarm_level" : 2
} Example Responses
None
Status Codes
| Status Code | Description |
|---|---|
| 204 | No Content |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 408 | Request Timeout |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
| 503 | Service 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