Queries the details of an alert template.

This topic provides an example to show how to query the details of an alert template whose ID is 70****.

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 DescribeMetricRuleTemplateAttribute

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

Name String No ECS_Template1

The name of the alert template. You must specify at least one of the Name and TemplateId parameters.

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

TemplateId String No 70****

The ID of the alert template. You must specify at least one of the Name and TemplateId parameters.

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

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

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code.

Note The status code 200 indicates that the call is successful.
RequestId String 8F3A82AD-DA92-52B0-8EC6-C059D1C3839F

The ID of the request.

Message String The specified resource is not found.

The error message.

Resource Struct

The details of the alert template.

AlertTemplates Array of AlertTemplate

The list of alert templates.

AlertTemplate
Category String ecs

The abbreviation of the cloud service name.

Escalations Struct

The threshold and the alert level.

Critical Struct

The conditions for triggering Critical-level alerts.

ComparisonOperator String GreaterThanOrEqualToThreshold

The comparison operator that is used to compare the metric value with the 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 last monitoring cycle
  • LessThanLastPeriod: less than the metric value in the last monitoring cycle
Statistics String Average

The statistical method for Critical-level alerts.

The value of the Statistics parameter varies with the cloud service. For more information, see Appendix 1: Metrics.

Threshold String 90

The threshold for Critical-level alerts.

Times Integer 5

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

Info Struct

The conditions for triggering Info-level alerts.

ComparisonOperator String GreaterThanOrEqualToThreshold

The comparison operator that is used to compare the metric value with the 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 last monitoring cycle
  • LessThanLastPeriod: less than the metric value in the last monitoring cycle
Statistics String Average

The statistical method for Info-level alerts.

The value of the Statistics parameter varies with the cloud service. For more information, see Appendix 1: Metrics.

Threshold String 90

The threshold for Info-level alerts.

Times Integer 3

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

Warn Struct

The conditions for triggering Warn-level alerts.

ComparisonOperator String GreaterThanOrEqualToThreshold

The comparison operator that is used to compare the metric value with the 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 last monitoring cycle
  • LessThanLastPeriod: less than the metric value in the last monitoring cycle
Statistics String Average

The statistical method for Warn-level alerts.

The value of the Statistics parameter varies with the cloud service. For more information, see Appendix 1: Metrics.

Threshold String 90

The threshold for Warn-level alerts.

Times Integer 3

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

MetricName String cpu_total

The name of the metric.

Namespace String acs_ecs_dashboard

The namespace of the cloud service.

NoDataPolicy String KEEP_LAST_STATE

The processing method of alerts when no monitoring data is found. Valid values:

  • KEEP_LAST_STATE (default value): No operation is performed.
  • INSUFFICIENT_DATA: An alert whose content is "Insufficient data" is triggered.
  • OK: The alert rule has no active alerts.
RuleName String ECS_Rule

The name of the alert rule.

Selector String {"disk":"/"}

The dimension of the alert. It is an extended field.

Webhook String https://www.aliyun.com

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

Description String ECS alert template

The description of the alert template.

Name String ECS_Template1

The name of the alert template.

RestVersion String 1

The version of the alert template.

TemplateId String 70****

The ID of the alert template.

Success Boolean true

Indicates whether the call is successful. Valid values:

  • true: The call is successful.
  • false: The call fails.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeMetricRuleTemplateAttribute
&TemplateId=70****
&<Common request parameters>

Sample success responses

XML format

<DescribeMetricRuleTemplateAttributeResponse>
	  <RequestId>8F3A82AD-DA92-52B0-8EC6-C059D1C3839F</RequestId>
	  <Resource>
		    <AlertTemplates>
			      <AlertTemplate>
				        <MetricName>cpu_total</MetricName>
				        <Category>ecs</Category>
				        <Escalations>
					          <Critical>
						            <ComparisonOperator>GreaterThanOrEqualToThreshold</ComparisonOperator>
						            <Times>5</Times>
						            <Statistics>Average</Statistics>
						            <Threshold>90</Threshold>
					          </Critical>
					          <Info></Info>
					          <Warn></Warn>
				        </Escalations>
				        <CompositeExpression></CompositeExpression>
				        <Webhook></Webhook>
				        <Namespace>acs_ecs_dashboard</Namespace>
				        <RuleName>ECS_Rule</RuleName>
				        <Selector></Selector>
			      </AlertTemplate>
		    </AlertTemplates>
		    <Description></Description>
		    <RestVersion>1</RestVersion>
		    <TemplateId>70****</TemplateId>
		    <Name>ECS_Template1</Name>
	  </Resource>
	  <Code>200</Code>
	  <Success>true</Success>
</DescribeMetricRuleTemplateAttributeResponse>

JSON format

{
    "RequestId": "8F3A82AD-DA92-52B0-8EC6-C059D1C3839F",
    "Resource": {
        "HostAvailabilityTemplates": [],
        "AlertTemplates": {
            "AlertTemplate": [
                {
                    "MetricName": "cpu_total",
                    "Category": "ecs",
                    "Escalations": {
                        "Critical": {
                            "ComparisonOperator": "GreaterThanOrEqualToThreshold",
                            "Times": 5,
                            "Statistics": "Average",
                            "Threshold": "90"
                        },
                        "Info": {},
                        "Warn": {}
                    },
                    "CompositeExpression": {},
                    "Webhook": "",
                    "Namespace": "acs_ecs_dashboard",
                    "RuleName": "ECS_Rule",
                    "Selector": {}
                }
            ]
        },
        "Description": "",
        "SystemEventTemplates": [],
        "RestVersion": 1,
        "ProcessMonitorTemplates": [],
        "TemplateId": "70****",
        "Name": "ECS_Template1"
    },
    "Code": 200,
    "Success": true
}

Error codes

HttpCode Error code Error message Description
404 ResourceNotFound The specified resource is not found. The error message returned because the specified resource is not found.

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