All Products
Search
Document Center

CloudMonitor:CreateMetricRuleTemplate

Last Updated:Mar 01, 2024

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.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
NamestringYes

The name of the alert template.

Template1
DescriptionstringNo

The description of the alert template.

ECS_Template1
AlertTemplatesobject []No
Escalations.Info.ThresholdstringNo

The threshold for Info-level alerts.

20
MetricNamestringYes

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

Note For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
cpu_total
WebhookstringNo

The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.

http://ww.aliyun.com
Escalations.Warn.ThresholdstringNo

The threshold for Warn-level alerts.

30
NamespacestringYes

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

Note For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
acs_ecs_dashboard
PeriodintegerNo

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.

60
RuleNamestringYes

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

Escalations.Critical.TimesintegerNo

The consecutive number of times for which the metric value meets the alert condition before a Critical-level alert is triggered.

2
SelectorstringNo

The extended field selectors. Valid values of N: 1 to 200.

{"disk":"/"}
Escalations.Info.StatisticsstringNo

The statistical method for Info-level alerts.

Average
Escalations.Warn.TimesintegerNo

The consecutive number of times for which the metric value meets the alert condition before a Warn-level alert is triggered.

1
Escalations.Info.ComparisonOperatorstringNo

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

The abbreviation of the Alibaba Cloud service name.

To obtain the abbreviation of an Alibaba Cloud service name, call the DescribeProjectMeta operation. The metricCategory tag in the Labels response parameter indicates the abbreviation of the Alibaba Cloud service name.

ecs
Escalations.Critical.ThresholdstringNo

The threshold for Critical-level alerts.

30
Escalations.Critical.StatisticsstringNo

The statistical method for Critical-level alerts.

Average
Escalations.Critical.ComparisonOperatorstringNo

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

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

The consecutive number of times for which the metric value meets the alert condition before an Info-level alert is triggered.

1
Escalations.Warn.StatisticsstringNo

The statistical method for Warn-level alerts.

Average

Response parameters

ParameterTypeDescriptionExample
object
Codeinteger

The HTTP status code.

Note The status code 200 indicates that the call was successful.
200
Messagestring

The error message.

The Request is not authorization.
RequestIdstring

The ID of the request.

9763ED1A-4D09-41BF-851E-310421750204
Successboolean

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
true
Idlong

The ID of the alert template.

12345

Examples

Sample success responses

JSONformat

{
  "Code": 200,
  "Message": "The Request is not authorization.",
  "RequestId": "9763ED1A-4D09-41BF-851E-310421750204",
  "Success": true,
  "Id": 12345
}

Error codes

HTTP status codeError codeError message
206%s%s
400InvalidQueryParameter%s
401AccessDeniedExceptionYou donot have sufficient access to perform this action.
402LimitExceededThe quota for this customer had been reached.
403InvalidClientTokenIdThe X.509 certificate or cms access key ID provided does not exist in our records.
409ResourceConflictConcurrent modification of resources.
409ResourceExistResources already exist.
412ResourcesOverLimitResources over limit.
429Throttli∂ngExceptionThe request was denied due to request throttling.
500InternalFailure%s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history