Modifying a Custom Alarm Template
Function
This API is used to modify a custom alarm template.
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}/alarm-templates/{template_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the tenant ID. Minimum: 1 Maximum: 64 |
template_id |
Yes |
String |
Specifies the ID of an alarm template. Minimum: 2 Maximum: 64 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the tenant token. Minimum: 1 Maximum: 16384 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
template_name |
Yes |
String |
Specifies the name of an alarm template. The name must start with a letter and can contain 1 to 128 characters, including letters, digits, underscores (_), and hyphens (-). |
template_description |
No |
String |
Provides supplementary information about an alarm template. The description can contain 0 to 256 characters and is left blank by default. |
policies |
Yes |
Array of Policies objects |
Specifies alarm policies in an alarm template. Array Length: 1 - 50 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
namespace |
Yes |
String |
Specifies the namespace of a service. For details about the namespace of each service, see Namespace. |
dimension_name |
No |
String |
Specifies the resource dimension, which must start with a letter. A dimension can contain up to 32 characters, including only digits, letters, underscores (_), and hyphens (-). Use commas (,) to separate multiple dimensions. DimensionName in event alarm templates must be left blank. |
metric_name |
Yes |
String |
Specifies the metric name. |
period |
Yes |
Integer |
Specifies the interval (seconds) for checking whether the alarm rule conditions are met. Enumeration values:
|
filter |
Yes |
String |
Specifies the data rollup method. Regex Pattern: ^(average|variance|min|max|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 |
No |
Number |
Specifies the alarm threshold. Minimum: 0 Maximum: 1.7976931348623156E108 |
unit |
No |
String |
Specifies the data unit. The value can contain up to 32 characters. Minimum: 0 Maximum: 32 |
count |
Yes |
Integer |
Specifies the number of consecutive alarm triggering times. 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. |
alarm_level |
No |
Integer |
Specifies the alarm severity, which can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational). |
suppress_duration |
Yes |
Integer |
Specifies the alarm suppression period, in seconds. When the period is 0, only one alarm is generated. Enumeration values:
|
Response Parameters
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: 401
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: 403
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: 404
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 a custom template whose template_name is my_template
{ "template_name" : "my_template", "template_description" : "hello world", "policies" : [ { "namespace" : "SYS.ECS", "dimension_name" : "instance_id", "metric_name" : "cpu_util", "period" : 300, "filter" : "sum", "comparison_operator" : ">", "value" : 2, "unit" : "bit/s", "count" : 2, "alarm_level" : 2, "suppress_duration" : 300 } ] }
Example Responses
None
Status Codes
Status Code |
Description |
---|---|
204 |
No Content |
400 |
Failed to verify parameters. |
401 |
Not authenticated. |
403 |
Authentication failed. |
404 |
Resource 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