Modifying All Fields in an Alarm Policy
Function
This API is used to modify all fields in an alarm policy.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
PUT /v2/{project_id}/alarms/{alarm_id}/policies
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the tenant ID. Minimum: 1 Maximum: 64 |
alarm_id |
Yes |
String |
Specifies the alarm rule ID. Regex Pattern: ^al([0-9A-Za-z]){22}$ |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
No |
String |
Specifies the MIME type of the request body. The default type is application/json; charset=UTF-8. Default: application/json; charset=UTF-8 Minimum: 1 Maximum: 64 |
X-Auth-Token |
No |
String |
Specifies the user token. Minimum: 1 Maximum: 16384 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
policies |
Yes |
Array of UpdatePolicy objects |
Specifies the policy information. Array Length: 1 - 50 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
metric_name |
Yes |
String |
Specifies the metric name of a resource. The name must start with a letter and contain only digits, letters, and underscores. The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in DDS indicates the command execution frequency. For details about the metric name of each service, see Service metric name. |
period |
Yes |
Integer |
Specifies the rollup period of a metric, in seconds. The default value is 0. For an event alarm, set this parameter to 0. 1 indicates the original rollup period of a metric. For example, if the original rollup period of an RDS metric is 60s, its data point is calculated every 60 seconds. For details about the original rollup period of each cloud service metric, see Services Interconnected with Cloud Eye. 300 indicates that the metric rollup period is 5 minutes. Minimum: 0 Maximum: 86400 Enumeration values:
|
filter |
Yes |
String |
Specifies the rollup method. The value can be average, min, max, or sum. |
comparison_operator |
Yes |
String |
Specifies the threshold symbol. The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease compared with the last period, cycle_increase indicates the increase compared with the last period, and cycle_wave indicates the increase or decrease compared with the last period. All of them can be used in alarm rules for metrics. >, <, >=, <=, =, and != can be used for alarm rules for events. |
value |
Yes |
Number |
Specifies the threshold. |
unit |
No |
String |
Specifies the metric unit. |
type |
No |
String |
Specifies the alarm policy type. This parameter is left blank by default. Minimum: 0 Maximum: 32 |
count |
Yes |
Integer |
Specifies the number of times that the alarm triggering conditions are met. 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 |
No |
Integer |
Specifies the alarm suppression time, in seconds. This parameter corresponds to the last field in the alarm policy when an alarm rule is created on the Cloud Eye console. This field is used to avoid frequent alarms. 0 indicates that the alarm is not suppressed and alarms are generated as long as the conditions are met. 300 indicates that an alarm is generated every 5 minutes as long as the alarm triggering conditions are met. Minimum: 0 Maximum: 86400 Enumeration values:
|
level |
No |
Integer |
Specifies the alarm severity, which can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational). |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
policies |
Array of UpdatePolicy objects |
Specifies the policy information. Array Length: 1 - 50 |
Parameter |
Type |
Description |
---|---|---|
metric_name |
String |
Specifies the metric name of a resource. The name must start with a letter and contain only digits, letters, and underscores. The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in DDS indicates the command execution frequency. For details about the metric name of each service, see Service metric name. |
period |
Integer |
Specifies the rollup period of a metric, in seconds. The default value is 0. For an event alarm, set this parameter to 0. 1 indicates the original rollup period of a metric. For example, if the original rollup period of an RDS metric is 60s, its data point is calculated every 60 seconds. For details about the original rollup period of each cloud service metric, see Services Interconnected with Cloud Eye. 300 indicates that the metric rollup period is 5 minutes. Minimum: 0 Maximum: 86400 Enumeration values:
|
filter |
String |
Specifies the rollup method. The value can be average, min, max, or sum. |
comparison_operator |
String |
Specifies the threshold symbol. The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease compared with the last period, cycle_increase indicates the increase compared with the last period, and cycle_wave indicates the increase or decrease compared with the last period. All of them can be used in alarm rules for metrics. >, <, >=, <=, =, and != can be used for alarm rules for events. |
value |
Number |
Specifies the threshold. |
unit |
String |
Specifies the metric unit. |
type |
String |
Specifies the alarm policy type. This parameter is left blank by default. Minimum: 0 Maximum: 32 |
count |
Integer |
Specifies the number of times that the alarm triggering conditions are met. 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 |
Specifies the alarm suppression time, in seconds. This parameter corresponds to the last field in the alarm policy when an alarm rule is created on the Cloud Eye console. This field is used to avoid frequent alarms. 0 indicates that the alarm is not suppressed and alarms are generated as long as the conditions are met. 300 indicates that an alarm is generated every 5 minutes as long as the alarm triggering conditions are met. Minimum: 0 Maximum: 86400 Enumeration values:
|
level |
Integer |
Specifies the alarm severity, which can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational). |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Example Requests
Modifying an alarm policy whose metric name is disk_device_read_bytes_rate
{ "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 } ] }
Example Responses
Status code: 200
Alarm policy modified.
{ "policies" : [ { "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 |
Alarm policy modified. |
400 |
Failed to verify parameters. |
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