You can call this operation to create one or more alert rules for an application group.

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 CreateGroupMetricRules

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

GroupId Long Yes 123456

The ID of the application group.

GroupMetricRules.N.Category String Yes ecs

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

GroupMetricRules.N.MetricName String Yes cpu_total

The name of the metric. For more information, see the description of the Namespace parameter in DescribeMetricMetaList or Preset metric reference. Valid values of N: 1 to 200.

GroupMetricRules.N.Namespace String Yes acs_ecs_dashboard

The namespace of the service. For more information, see the description of the Namespace parameter inDescribeMetricMetaList or Preset metric reference. Valid values of N: 1 to 200.

GroupMetricRules.N.RuleId String Yes bfae2ca5b4e07d2c7278772eccda169808c7b****

The ID of the alert rule. The rule ID is generated by the caller to make sure that it is unique. Valid values of N: 1 to 200.

GroupMetricRules.N.RuleName String Yes Alert rule 1

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

GroupMetricRules.N.Dimensions String No [{"instanceId":"xxxxxx"}]

The expended resource dimensions. Valid values of N: 1 to 200.

GroupMetricRules.N.EffectiveInterval String No 00:00-23:59

The time period during which the alert rule is effective. Valid values of N: 1 to 200.

GroupMetricRules.N.EmailSubject String No An alert occurs.

The content of the alert sent through an email. Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Critical.ComparisonOperator String No GreaterThanOrEqualToThreshold

The comparison operator of 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: the number of times that the metric value exceeds the threshold is greater than that of the same time period yesterday.
  • LessThanYesterday: the number of times that the metric value exceeds the threshold is less than that of the same time period yesterday.
  • GreaterThanLastWeek: the number of times that the metric value exceeds the threshold is greater than that of the same time period last week.
  • LessThanLastWeek: the number of times that the metric value exceeds the threshold is less than that of the same time period last week.
  • GreaterThanLastPeriod: the number of times that the metric value exceeds the threshold is greater than that of the last statistical period.
  • LessThanLastPeriod: the number of times that the metric value exceeds the threshold is less than that of the last statistical period.

Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Critical.Statistics String No Average

The statistical method for critical-level alerts. Each monitor metric uses a different statistical method. Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Critical.Threshold String No 90

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

GroupMetricRules.N.Escalations.Critical.Times Integer No 3

The number of times that the specified threshold is consecutively met before triggering a critical-level alert. Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Info.ComparisonOperator String No GreaterThanOrEqualToThreshold

The comparison operator of 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: the number of times that the metric value exceeds the threshold is greater than that of the same time period yesterday.
  • LessThanYesterday: the number of times that the metric value exceeds the threshold is less than that of the same time period yesterday.
  • GreaterThanLastWeek: the number of times that the metric value exceeds the threshold is greater than that of the same time period last week.
  • LessThanLastWeek: the number of times that the metric value exceeds the threshold is less than that of the same time period last week.
  • GreaterThanLastPeriod: the number of times that the metric value exceeds the threshold is greater than that of the last statistical period.
  • LessThanLastPeriod: the number of times that the metric value exceeds the threshold is less than that of the last statistical period.

Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Info.Statistics String No Average

The statistical method for info-level alerts. Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Info.Threshold String No 90

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

GroupMetricRules.N.Escalations.Info.Times Integer No 3

The number of times that the specified threshold is consecutively met before triggering an info-level alert. Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Warn.ComparisonOperator String No GreaterThanOrEqualToThreshold

The number of retries before triggering warn-level alerts. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equals the threshold.
  • GreaterThanThreshold: greater than the threshold.
  • LessThanOrEqualToThreshold: less than or equals the threshold.
  • LessThanThreshold: less than the threshold.
  • NotEqualToThreshold: does not equal the threshold.
  • GreaterThanYesterday: the number of times that the metric value exceeds the threshold is greater than that of the same time period yesterday.
  • LessThanYesterday: the number of times that the metric value exceeds the threshold is less than that of the same time period yesterday.
  • GreaterThanLastWeek: the number of times that the metric value exceeds the threshold is greater than that of the same time period last week.
  • LessThanLastWeek: the number of times that the metric value exceeds the threshold is less than that of the same time period last week.
  • GreaterThanLastPeriod: the number of times that the metric value exceeds the threshold is greater than that of the last statistical period.
  • LessThanLastPeriod: the number of times that the metric value exceeds the threshold is less than that of the last statistical period.

Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Warn.Statistics String No Average

The statistical method for warn-level alerts. Valid values of N: 1 to 200.

GroupMetricRules.N.Escalations.Warn.Threshold String No 90

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

GroupMetricRules.N.Escalations.Warn.Times Integer No 3

The number of times that the specified threshold is consecutively met before triggering a warn-level alert. Valid values of N: 1 to 200.

GroupMetricRules.N.Interval String No 60

The time period during which the value of the specified metric is calculated. Valid values of N: 1 to 200.

GroupMetricRules.N.NoEffectiveInterval String No 00:00-05:30

The time period during which the alert rule is ineffective. Valid values of N: 1 to 200.

GroupMetricRules.N.Period String No 60

The aggregation period. Unit: seconds. Valid values of N: 1 to 200.

GroupMetricRules.N.SilenceTime Integer No 86400

The time period during which you do not receive notifications but the triggered alert remains effective. Unit: seconds. Default value: 86,400 seconds (one day). Minimum value: 3,600 seconds (one hour). Valid values of N: 1 to 200.

GroupMetricRules.N.Webhook String No http://www.aliyun.com

Specify the URL to which alerts are pushed. Valid values of N: 1 to 200.

You must specify at least one of the three conditions for triggering alerts. Otherwise, the alert rule cannot be created.

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code. The 200 code indicates that the request is successful. Other codes indicate that the request failed.

Message String success

The error message.

RequestId String 461CF2CD-2FC3-4B26-8645-7BD27E7D0F1D

The ID of the request, which can be used for troubleshooting.

Resources

The list of resources to which the created alert rules are applied.

AlertResult

The list of resources to which the created alert rules are applied.

Code Integer 200

The HTTP status code. The 200 code indicates that the request is successful. Other codes indicate that the request failed.

Message String success

The error message.

RuleId String a151cd6023eacee2f0978e03863cc1697c89508****

The ID of the alert rule.

RuleName String Alert rule 1

The name of the alert rule.

Success Boolean true

Indicates whether an individual rule is created.

Success Boolean true

Indicates whether all the rules are successfully created.

Examples

Sample requests


http(s)://[Endpoint]/? Action=CreateGroupMetricRules
&GroupId=123456
&GroupMetricRules.1.Category=ecs
&GroupMetricRules.1.MetricName=cpu_total
&GroupMetricRules.1.1amespace=acs_ecs_dashboard
&GroupMetricRules.1.RuleId=bfae2ca5b4e07d2c7278772eccda169808c7b****
&GroupMetricRules.1.RuleName=Alert rule 1
&<Common request parameters>

Sample success responses

XML format

<CreateGroupMetricRulesResponse>
      <RequestId>65D50468-ECEF-48F1-A6E1-D952E89D9436</RequestId>
      <Success>true</Success>
      <Code>200</Code>
      <Resources>
            <AlertResult>
                  <RuleId>1298766****</RuleId>
                  <Success>true</Success>
                  <RuleName>My rule 1</RuleName>
                  <Code>200</Code>
            </AlertResult>
            <AlertResult>
                  <Message>Metric not found. </Message>
                  <RuleId>hyu91929****</RuleId>
                  <Success>false</Success>
                  <RuleName>RuleId 2</RuleName>
                  <Code>404</Code>
            </AlertResult>
      </Resources>
</CreateGroupMetricRulesResponse>

JSON format

{
	"RequestId":"65D50468-ECEF-48F1-A6E1-D952E89D9436",
	"Success":"true",
	"Code":"200",
	"Resources":{
		"AlertResult":[
			{
				"RuleId":"1298766****",
				"RuleName":"My rule 1",
				"Success":"true",
				"Code":"200"
			},
			{
				"Message":"Metric not found.",
				"RuleId":"hyu91929****",
				"RuleName":"RuleId 2",
				"Success":"false",
				"Code":"404"
			}
		]
	}
}

Error codes

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