ModifyMetricRuleTemplate

Updated at:

Modifies an alert template.

Operation description

This topic provides an example on how to modify the alert template 123456 of version 1. In this example, the alert level is modified to Critical, the statistical method to Average, the threshold comparison operator to GreaterThanOrEqualToThreshold, the alert threshold to 90, and the number of alert retries to 3. The response indicates that the alert template is successfully modified.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cms:ModifyMetricRuleTemplate

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

TemplateId

integer

Yes

The ID of the alert template.

123456

Name

string

No

The name of the alert template.

test123

Description

string

No

The description of the alert template.

ECS_template1

RestVersion

integer

Yes

The version of the alert template to be modified.

Note

This parameter is automatically updated based on the number of modifications.

0

AlertTemplates

array<object>

No

The list of alert templates.

object

No

The list of alert templates.

Escalations.Info.Threshold

string

No

The threshold for info-level alerts.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

20

MetricName

string

No

The name of the metric. Valid values of N: 1 to 200.

Note

For more information about the valid values of the metric name, see DescribeSystemEventMetaList.

cpu_total

Webhook

string

No

The webhook URL to which a POST request is sent when an alert is triggered.

https://apiwebhook.hipac.cn/api/v1/alarm/aly/eregfeeferrtbnmkdszp

Escalations.Warn.Threshold

string

No

The threshold for warning-level alerts.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

30

Namespace

string

No

The namespace of the Alibaba Cloud service, which is used to distinguish different services. Valid values of N: 1 to 200.

Format: acs_.

Note

To obtain the namespace of each Alibaba Cloud service, call the DescribeProjectMeta operation.

acs_ecs_dashboard

Period

integer

No

The statistical period of the monitoring data. Valid values of N: 1 to 200.

Note

If you set this parameter to 300, the system collects and aggregates monitoring data every 300 seconds. If monitoring data is reported every minute, the system aggregates the data of 5 minutes, such as the average, maximum, and minimum values. Do not specify this parameter separately because the statistical period may cause unexpected alerts.

60

RuleName

string

No

The name of the alert rule. Valid values of N: 1 to 200.

rule1

Escalations.Critical.Times

integer

No

The number of times that the monitoring metrics must reach the alert threshold to send a critical-level alert notification.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

2

Selector

string

No

The options for the extended dimension fields. Valid values of N: 1 to 200.

For example, if the alert template is applied to an application group, this parameter is set to {"disk":"/"}, and the MetricName parameter is set to DiskUtilization, the root partition ("/") of the disks for all instances in the application group is associated with the corresponding alert rule.

Note

For more information about the valid values of the extended dimension fields, see DescribeSystemEventMetaList.

{"disk":"/"}

Escalations.Info.Statistics

string

No

The statistical method for info-level alerts.

Valid values of N: 1 to 200.

The valid values of this parameter are determined by the Statistics column that corresponds to the MetricName parameter of the specified Alibaba Cloud service, such as Maximum, Minimum, and Average. For more information about how to obtain the valid values of this parameter, see cloud service monitoring metrics.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

Average

Escalations.Warn.Times

integer

No

The number of times that the monitoring metrics must reach the alert threshold to send a warning-level alert notification.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

1

Escalations.Info.ComparisonOperator

string

No

The comparison operator for the info-level alert threshold. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.

  • GreaterThanThreshold: greater than the threshold.

  • LessThanOrEqualToThreshold: less than or equal to the threshold.

  • LessThanThreshold: less than the threshold.

  • NotEqualToThreshold: not equal to the threshold.

  • GreaterThanYesterday: greater than the metric value at the same time yesterday.

  • LessThanYesterday: less than the metric value at the same time yesterday.

  • GreaterThanLastWeek: greater than the metric value at the same time last week.

  • LessThanLastWeek: less than the metric value at the same time last week.

  • GreaterThanLastPeriod: greater than the metric value in the previous period.

  • LessThanLastPeriod: less than the metric value in the previous period.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

GreaterThanOrEqualToThreshold

Category

string

No

The abbreviation of the Alibaba Cloud service name. Valid values of N: 1 to 200. Valid values:

  • ecs: Alibaba Cloud and non-Alibaba Cloud hosts.

  • rds: ApsaraDB RDS database.

  • ads: AnalyticDB database.

  • slb: load balancing.

  • vpc: Elastic IP Address (EIP).

  • apigateway: API Gateway.

  • cdn: Content Delivery Network (CDN).

  • cs: Container Service for Swarm.

  • dcdn: Dynamic Route for CDN (DCDN).

  • ddos: Anti-DDoS.

  • eip: Elastic IP Address (EIP).

  • elasticsearch: Elasticsearch.

  • emr: E-MapReduce (EMR).

  • ess: elastic scaling.

  • hbase: ApsaraDB for HBase database.

  • iot_edge: IoT Edge.

  • kvstore_sharding: ApsaraDB for Redis Cluster Edition.

  • kvstore_splitrw: ApsaraDB for Redis Read/Write Splitting Edition.

  • kvstore_standard: ApsaraDB for Redis Standard Edition.

  • memcache: ApsaraDB for Memcache database.

  • mns: Message Service (MNS).

  • mongodb: MongoDB replica set instance.

  • mongodb_cluster: MongoDB cluster edition.

  • mongodb_sharding: MongoDB sharded cluster.

  • mq_topic: Message Service Topic.

  • ocs: legacy cloud database Memcache.

  • opensearch: OpenSearch.

  • oss: Object Storage Service (OSS).

  • polardb: PolarDB database.

  • petadata: HybridDB for MySQL.

  • scdn: secure acceleration.

  • sharebandwidthpackages: Internet Shared Bandwidth.

  • sls: Simple Log Service (SLS).

  • vpn: VPN Gateway.

ecs

Escalations.Critical.Threshold

string

No

The threshold that triggers a critical-level alert notification.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

30

Escalations.Critical.Statistics

string

No

The statistical method for critical-level alerts.

Valid values of N: 1 to 200.

The valid values of this parameter are determined by the Statistics column that corresponds to the MetricName parameter of the specified Alibaba Cloud service, such as Maximum, Minimum, and Average. For more information about how to obtain the valid values of this parameter, see cloud service monitoring metrics.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

Average

Escalations.Critical.ComparisonOperator

string

No

The comparison operator for the critical-level alert threshold. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.

  • GreaterThanThreshold: greater than the threshold.

  • LessThanOrEqualToThreshold: less than or equal to the threshold.

  • LessThanThreshold: less than the threshold.

  • NotEqualToThreshold: not equal to the threshold.

  • GreaterThanYesterday: greater than the metric value at the same time yesterday.

  • LessThanYesterday: less than the metric value at the same time yesterday.

  • GreaterThanLastWeek: greater than the metric value at the same time last week.

  • LessThanLastWeek: less than the metric value at the same time last week.

  • GreaterThanLastPeriod: greater than the metric value in the previous period.

  • LessThanLastPeriod: less than the metric value in the previous period.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

GreaterThanOrEqualToThreshold

Escalations.Warn.ComparisonOperator

string

No

The comparison operator for the warning-level alert threshold. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.

  • GreaterThanThreshold: greater than the threshold.

  • LessThanOrEqualToThreshold: less than or equal to the threshold.

  • LessThanThreshold: less than the threshold.

  • NotEqualToThreshold: not equal to the threshold.

  • GreaterThanYesterday: greater than the metric value at the same time yesterday.

  • LessThanYesterday: less than the metric value at the same time yesterday.

  • GreaterThanLastWeek: greater than the metric value at the same time last week.

  • LessThanLastWeek: less than the metric value at the same time last week.

  • GreaterThanLastPeriod: greater than the metric value in the previous period.

  • LessThanLastPeriod: less than the metric value in the previous period.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

GreaterThanOrEqualToThreshold

Escalations.Info.Times

integer

No

The number of times that the monitoring metrics must reach the alert threshold to send an info-level alert notification.

Valid values of N: 1 to 200.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

1

Escalations.Warn.Statistics

string

No

The statistical method for warning-level alerts.

Valid values of N: 1 to 200.

The valid values of this parameter are determined by the Statistics column that corresponds to the MetricName parameter of the specified Alibaba Cloud service, such as Maximum, Minimum, and Average. For more information about how to obtain the valid values of this parameter, see cloud service monitoring metrics.

Note

You must specify at least one of the following alert levels: Critical, Warn, and Info. The Statistics, ComparisonOperator, Threshold, and Times parameters must be specified at the same time for the specified alert level.

Average

For more information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

Code

integer

The HTTP status code.

Note

A status code of 200 indicates that the call is successful.

200

Message

string

The error message.

The Request is not authorization.

RequestId

string

The request ID.

9E07117F-F6AE-4F1C-81E8-36FBB4892235

Success

boolean

Indicates whether the operation is successful. Valid values:

  • true: The operation is successful.

  • false: The operation fails.

true

Examples

Success response

JSON format

{
  "Code": 200,
  "Message": "The Request is not authorization.",
  "RequestId": "9E07117F-F6AE-4F1C-81E8-36FBB4892235",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidQueryParameter %s
400 %s %s
401 AccessDeniedException You donot have sufficient access to perform this action.
412 %s %s
500 InternalFailure %s
402 LimitExceeded The quota for this customer had been reached.
403 InvalidClientTokenId The X.509 certificate or cms access key ID provided does not exist in our records.
206 %s %s
404 %s %s
503 %s %s
406 %s %s
429 Throttli∂ngException The request was denied due to request throttling.
409 %s %s

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.