Creates an alert template.

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 CreateMetricRuleTemplate

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

Name String Yes Template1

The name of the alert template.

Description String No ECS_Template1

The description of the alert template.

AlertTemplates.N.Escalations.Info.Threshold String No 20

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.MetricName String Yes cpu_total

The name of the metric.

Valid values of N: 1 to 200.

For information about how to obtain metrics, see DescribeMetricMetaList or Appendix 1: Metrics.

AlertTemplates.N.Webhook String No http://ww.aliyun.com

The callback URL.

Valid values of N: 1 to 200.

The callback URL must be accessible over the Internet. CloudMonitor sends a POST request to push an alert notification to the callback URL that you specify. Only HTTP requests are supported.

AlertTemplates.N.Escalations.Warn.Threshold String No 30

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.Namespace String Yes 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 aggregation period of monitoring data. Unit: seconds.

The default value is the minimum aggregation period. Generally, you do not need to specify the minimum aggregation period.

Valid values of N: 1 to 200.

AlertTemplates.N.RuleName String Yes ECS_Rule1

The name of the alert rule.

Valid values of N: 1 to 200.

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.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 For more information about the values of extended fields, see DescribeMetricRuleTemplateAttribute.
AlertTemplates.N.Escalations.Info.Statistics String No Average

The statistical method for Info-level alerts.

Valid values of N: 1 to 200.

The value of this parameter is determined by the Statistics column corresponding to the MetricName parameter of the specified cloud service. The value of this parameter can be Maximum, Minimum, or Average. For more information about how to obtain the value of this parameter, see Appendix 1: Metrics.

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 1

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.ComparisonOperator String No GreaterThanOrEqualToThreshold

The operator that is used to compare the metric value with the threshold for Info-level alerts. 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

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.Category String Yes ecs

The abbreviation of the cloud service name.

Valid values of N: 1 to 200.

For more information about how to obtain the abbreviation of a cloud service name, see metricCategory in the response parameter Labels of the DescribeProjectMeta operation.

AlertTemplates.N.Escalations.Critical.Threshold String No 30

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.Statistics String No Average

The statistical method for Critical-level alerts.

Valid values of N: 1 to 200.

The value of this parameter is determined by the Statistics column corresponding to the MetricName parameter of the specified cloud service. The value of this parameter can be Maximum, Minimum, or Average. For more information about how to obtain the value of this parameter, see Appendix 1: Metrics.

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 operator that is used to compare the metric value with the threshold for Critical-level alerts. 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

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.ComparisonOperator String No GreaterThanOrEqualToThreshold

The operator that is used to compare the metric value with the threshold for Warn-level alerts. 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

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 1

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.Escalations.Warn.Statistics String No Average

The statistical method for Warn-level alerts.

Valid values of N: 1 to 200.

The value of this parameter is determined by the Statistics column corresponding to the MetricName parameter of the specified cloud service. The value of this parameter can be Maximum, Minimum, or Average. For more information about how to obtain the value of this parameter, see Appendix 1: Metrics.

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.

Response parameters

Parameter Type Example Description
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 returned message.

RequestId String 9763ED1A-4D09-41BF-851E-310421750204

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.
Id Long 12345

The ID of the alert template.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateMetricRuleTemplate
&Name=Template1
&AlertTemplates.1.MetricName=cpu_total
&AlertTemplates.1.RuleName=My CPU monitoring
&AlertTemplates.1.Category=ecs
&AlertTemplates.1.1amespace=acs_ecs_dashboard
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateMetricRuleTemplateResponse>
		<RequestId>9763ED1A-4D09-41BF-851E-310421750204</RequestId>
		<Id>12345</Id>
		<Success>true</Success>
		<Code>200</Code>
</CreateMetricRuleTemplateResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "9763ED1A-4D09-41BF-851E-310421750204",
  "Id" : 12345,
  "Success" : true,
  "Code" : 200
}

Error codes

For a list of error codes, see Service error codes.