Modifies an alert template.

This topic provides an example to show how to modify an alert template whose version is 1 and ID is 123456. The alert level is changed to Critical. The statistical method is changed to Average. The alert threshold comparator is changed to GreaterThanOrEqualToThreshold. The alert threshold is changed to 90. The number of alert retries is changed to 3. The response shows that the alert template is modified.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyMetricRuleTemplate

The operation that you want to perform. Set the value to ModifyMetricRuleTemplate.

TemplateId Long Yes 123456

The ID of the alert template.

For more information about how to query the IDs of alert templates, see DescribeMetricRuleTemplateList.

RestVersion Long Yes 1

The version of the alert template. The version changes with the number of times that the alert template is modified.

For more information about how to query the versions of alert templates, see DescribeMetricRuleTemplateList.

Name String No Template_123

The name of the alert template.

For more information about how to query the names of alert templates, see DescribeMetricRuleTemplateList.

Description String No ECS_template1

The description of the alert template.

AlertTemplates.N.MetricName String No cpu_total

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

Note You can call the DescribeSystemEventMetaList operation to query the names of metrics. For more information, see DescribeSystemEventMetaList.
AlertTemplates.N.RuleName String No Rule_123

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

AlertTemplates.N.Category String No ecs

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

  • PolarDB: PolarDB
  • NewBGPDDoS: Anti-DDoS Pro
  • IoTDevice: IoT Platform
  • DRDS: PolarDB-X
  • VS: Video Surveillance System
  • AMQP: Alibaba Cloud Message Queue for AMQP
  • ADS: AnalyticDB
  • APIGateway: API Gateway
  • InternetSharedBandwidth: EIP Bandwidth Plan
  • CDN: Alibaba Cloud Content Delivery Network (CDN)
  • CEN: Cloud Enterprise Network (CEN)
  • DCDN: Dynamic Route for CDN (DCDN)
  • DDoS: Anti-DDoS
  • ECS: Elastic Compute Service (ECS)
  • DirectMail: Direct Mail
  • Elasticsearch: Elasticsearch
  • EMR: E-MapReduce (EMR)
  • ESS: Auto Scaling
  • FunctionCompute: Function Compute
  • RealtimeCompute: Realtime Compute for Apache Flink
  • GlobalAcceleration: Global Accelerator (GA)
  • Hbase: ApsaraDB for HBase
  • TSDB: Time Series Database (TSDB)
  • IPv6trans: IPv6 Translation Service
  • Kafka: Message Queue for Apache Kafka
  • Kubernetes: Container Service for Kubernetes (ACK)
  • KVstore: ApsaraDB for Redis
  • MNS: Message Service (MNS)
  • MongoDB: ApsaraDB for MongoDB
  • MQ: Message Queue
  • NAT: NAT Gateway
  • OpenAd: Open Ad
  • OpenSearch: Open Search
  • OSS: Object Storage Service (OSS)
  • PCDN: P2P CDN
  • petadata: HybridDB for MySQL
  • RDS: ApsaraDB RDS
  • SCDN: Secure CDN
  • SLB: Server Load Balancer (SLB)
  • SLS: Log Service
  • VideoLive: ApsaraVideo Live
  • VOD: ApsaraVideo VOD
  • EIP: Elastic IP Address (EIP)
  • VPN: VPN Gateway
  • AIRec: Artificial Intelligence Recommendation
  • GPDB: AnalyticDB for PostgreSQL
  • DBS: Database Backup (DBS)
  • SAG: Smart Access Gateway (SAG)
  • Memcache: ApsaraDB for Memcache
  • IOT_EDGE: Link IoT Edge
  • OCS: ApsaraDB for Memcache (previous version)
  • VPC: Express Connect
  • EHPC: Elastic High Performance Computing (E-HPC)
  • MPS: ApsaraVideo Media Processing
  • ENS: Edge Node Service (ENS)
  • MaxCompute_Prepay: MaxCompute
  • IoT_Kubernetes: Edge Application Hosting
  • CMS: CloudMonitor
  • ContainerServiceforSwarm: Container Service for Swarm
  • batchcomputenew: Batch Compute
  • HBaseUE: ApsaraDB for HBase Performance-enhanced Edition
  • UIS: Ultimate Internet Service (UIS)
  • nls: Intelligent Speech Interaction
  • ots: Tablestore
  • NAS: Apsara File Storage NAS
  • ECI: Elastic Container Instance (ECI)
  • OpenAPI: OpenAPI Explorer
  • pvtzpost: Alibaba Cloud DNS PrivateZone
  • blinkonk8s: Flink on Kubernetes
  • FunctionFlow: Serverless Workflow (SWF)
  • SMC: Server Migration Center (SMC)
  • ddosbgp: Anti-DDoS Origin
  • baas: Blockchain as a Service
  • privatelink: PrivateLink
  • cds: ApsaraDB for Cassandra
  • DDH: Dedicated Host
  • RocketMQ: Message Queue for Apache RocketMQ
  • ECC: Express Cloud Connect
  • hbaseserverless: ApsaraDB for HBase Serverless Edition
  • mns_tmp: Message Service
  • hdr: Hybrid Disaster Recovery (HDR)
  • hbr: Hybrid Backup Recovery (HBR)
  • ADB: AnalyticDB for MySQL V3.0
  • tag: Tag Service
  • GDB: Graph Database
  • WAF: Web Application Firewall (WAF)
  • hcs_sgw: Cloud Storage Gateway (CSG)
  • ipv6gateway: IPv6 Gateway
  • RDS_SAR: ApsaraDB Exclusive Host Group
  • learn: Machine Learning Platform for AI
  • ROS: Resource Orchestration Service (ROS)
  • OOS: Operation Orchestration Service (OOS)
  • bds: Data Synchronization for HBase
  • cfw: Cloud Firewall
  • ddosDip: Anti-DDoS Premium
  • datahub: DataHub
  • hologres: Hologres
  • ExpressConnect: Express Connect
  • dbfs: Database File System (DBFS)
  • clickhouse: ApsaraDB for ClickHouse
  • k8s: Container Service for Kubernetes (ACK)
  • DTS: Data Transmission Service (DTS)
  • AnycastEIP: Anycast Elastic IP Address
  • Lindorm: ApsaraDB for Lindorm
  • config: Cloud Config
  • spark: Databricks DataInsight (DDI)
  • serverless: Serverless App Engine (SAE)
  • alb: Application Load Balancer (ALB)
  • oceanbase: ApsaraDB for OceanBase
  • KMS: Key Management Service (KMS)
  • lvwang: Content Moderation
  • LinkVisual: LinkVisual
  • tair: ApsaraDB for Redis Enhanced Edition (Tair)
  • dlf: Data Lake Formation (DLF)
  • networkmonitor: Site Monitoring
  • pnc: Physical Network Change
  • AIS: Alibaba Cloud Infrastructure
  • cloudgame: Cloud Gaming Platform
  • RTC: Real-Time Communication
  • cloudbox: CloudBox
  • actiontrail: ActionTrail
  • cc: Cloud Connector
  • disk: Elastic Block Storage (EBS)
  • easygene: Genomics Computing Platform
  • cloudphone: Elastic Cloud Phone
  • BMS: Bare Metal Management Service
  • swas: Simple Application Server
  • AvailabilityMonitoring: Availability Monitoring of CloudMonitor
AlertTemplates.N.Namespace String No acs_ecs_dashboard

The namespace of the cloud service. Valid values of N: 1 to 200.

For information about how to obtain the namespace of a cloud service, see DescribeMetricMetaList or Appendix 1: Metrics.

AlertTemplates.N.Period Integer No 60

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

Note If the value is set to 300 seconds, the monitoring data is collected every 300 seconds. If the monitoring data is reported every 1 minute, the alert system calculates the average, maximum, and minimum values of the monitoring data of 5 minutes and checks whether the aggregated values exceed the threshold. To prevent unexpected alerts, we recommend that you set this parameter together with other parameters.
AlertTemplates.N.Selector String No {"disk":"/"}

The dimension of the alert. It is an extended field. Valid values of N: 1 to 200.

For example, an alert template is applied to an application group, this parameter is set to {"disk":"/"}, and the MetricName parameter is set to DiskUtilization. In this case, the generated alert rule is applied to the root disk partition ("/") of all instances in the application group to which the alert template is applied.

Note You can call the DescribeSystemEventMetaList operation to query the valid values of this parameter. For more information, see DescribeSystemEventMetaList.
AlertTemplates.N.Escalations.Critical.Statistics String No Average

The statistical methods for Critical-level alerts. Separate multiple statistical methods with commas (,). Valid values of N: 1 to 200. Valid values:

  • Average: the average value
  • Minimum: the minimum value
  • Maximum: the maximum value
Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Critical.ComparisonOperator String No GreaterThanOrEqualToThreshold

The comparison operator that is used to compare the metric value with the threshold. Valid values of N: 1 to 200. 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 last monitoring cycle
  • LessThanLastPeriod: less than the metric value in the last monitoring cycle
Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Critical.Threshold String No 90

The threshold for Critical-level alerts. Valid values of N: 1 to 200.

Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Critical.Times Integer No 3

The consecutive number of times for which the metric value meets the alert condition before a Critical-level alert is triggered. Valid values of N: 1 to 200.

Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Warn.Statistics String No Average

The statistical methods for Warn-level alerts. Separate multiple statistical methods with commas (,). Valid values of N: 1 to 200. Valid values:

  • Average: the average value
  • Minimum: the minimum value
  • Maximum: the maximum value
Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Warn.ComparisonOperator String No GreaterThanOrEqualToThreshold

The comparison operator that is used to compare the metric value with the threshold. Valid values of N: 1 to 200. 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 last monitoring cycle
  • LessThanLastPeriod: less than the metric value in the last monitoring cycle
Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Warn.Threshold String No 90

The threshold for Warn-level alerts. Valid values of N: 1 to 200.

Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Warn.Times Integer No 3

The consecutive number of times for which the metric value meets the alert condition before a Warn-level alert is triggered. Valid values of N: 1 to 200.

Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Info.Statistics String No Average

The statistical methods for Info-level alerts. Separate multiple statistical methods with commas (,). Valid values of N: 1 to 200. Valid values:

  • Average: the average value
  • Minimum: the minimum value
  • Maximum: the maximum value
Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Info.ComparisonOperator String No GreaterThanOrEqualToThreshold

The comparison operator that is used to compare the metric value with the threshold. Valid values of N: 1 to 200. 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 last monitoring cycle
  • LessThanLastPeriod: less than the metric value in the last monitoring cycle
Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Info.Threshold String No 90

The threshold for Info-level alerts. Valid values of N: 1 to 200.

Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Escalations.Info.Times Integer No 3

The consecutive number of times for which the metric value meets the alert condition before an Info-level alert is triggered. Valid values of N: 1 to 200.

Note You must select at least one of the Critical, Warn, and Info alert levels and specify the Statistics, ComparisonOperator, Threshold, and Times parameters for the selected alert level.
AlertTemplates.N.Webhook String No http://www.aliyun.com

The callback URL. Valid values of N: 1 to 200.

The callback URL must be accessible over the Internet. CloudMonitor pushes an alert notification to the specified callback URL by sending an HTTP POST request. Only the HTTP protocol is supported.

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

Response parameters

Parameter Type Example Description
RequestId String 9E07117F-F6AE-4F1C-81E8-36FBB4892235

The ID of the request.

Success Boolean true

Indicates whether the call is successful. Valid values:

  • true: The call is successful.
  • false: The call fails.
Code Integer 200

The HTTP status code.

Note The status code 200 indicates that the call is successful.
Message String The Request is not authorization.

The error message.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ModifyMetricRuleTemplate
&TemplateId=123456
&RestVersion=0
&<Common request parameters>

Sample success responses

XML format

<ModifyMetricRuleTemplateResponse>
		  <RequestId>97EAC0E2-CD54-4183-95AC-F0C113024E18</RequestId>
		  <Code>200</Code>
		  <Success>true</Success>
</ModifyMetricRuleTemplateResponse>

JSON format

{
	"RequestId": "5F78F035-3369-4360-810E-D5CC5E774336",
	"Code": 200,
	"Success": true
}

Error codes

For a list of error codes, visit the API Error Center.