Todos os produtos
Search
Central de documentação

Cloud Monitor:DescribeMetricRuleList

Última atualização: Jun 28, 2026

Consulta todas as regras na lista de regras de alerta.

Descrição da operação

Este tópico fornece um exemplo de como consultar todas as regras de alerta na lista de regras de alerta sob a conta Alibaba Cloud atual. A resposta mostra que a lista de regras de alerta contém apenas uma regra de alerta. O nome da regra de alerta é Rule_01 e o ID é applyTemplate344cfd42-0f32-4fd6-805a-88d7908a****.

Experimente agora

Experimente esta API no OpenAPI Explorer, sem necessidade de assinatura manual. Chamadas bem-sucedidas geram automaticamente código SDK correspondente aos seus parâmetros. Faça o download com segurança de credenciais integrada para uso local.

Testar

Autorização RAM

A tabela abaixo descreve a autorização necessária para chamar esta API. Você pode defini-la em uma política do Resource Access Management (RAM). As colunas da tabela estão detalhadas abaixo:

  • Ação: As ações que podem ser usadas no elemento Action das instruções de política de permissão do RAM para conceder permissões para executar a operação.

  • API: A API que você pode chamar para executar a ação.

  • Nível de acesso: O nível de acesso predefinido concedido para cada API. Valores válidos: create, list, get, update e delete.

  • Tipo de recurso: O tipo de recurso que suporta autorização para executar a ação. Indica se a ação suporta permissão em nível de recurso. O recurso especificado deve ser compatível com a ação. Caso contrário, a política será ineficaz.

    • Para APIs com permissões em nível de recurso, os tipos de recursos obrigatórios são marcados com um asterisco (*). Especifique o Nome de Recurso Alibaba Cloud (ARN) correspondente no elemento Resource da política.

    • Para APIs sem permissões em nível de recurso, é exibido como Todos os Recursos. Use um asterisco (*) no elemento Resource da política.

  • Chave de condição: As chaves de condição definidas pelo serviço. A chave permite controle granular, aplicando-se somente a ações ou a ações associadas a recursos específicos. Além das chaves de condição específicas do serviço, o Alibaba Cloud fornece um conjunto de chaves de condição comuns aplicáveis a todos os serviços compatíveis com RAM.

  • Ação dependente: As ações dependentes necessárias para executar a ação. Para concluir a ação, o usuário RAM ou a função RAM deve ter permissões para executar todas as ações dependentes.

Ação

Nível de acesso

Tipo de recurso

Chave de condição

Ação dependente

cms:DescribeMetricRuleList

get

*All Resource

*

Nenhuma Nenhuma

Parâmetros da solicitação

Parâmetro

Tipo

Obrigatório

Descrição

Exemplo

MetricName

string

Não

O nome da métrica.

Para informações sobre como obter nomes de métricas, consulte DescribeMetricMetaList ou Métricas de serviços em nuvem.

Observação: Para métricas compostas, você só pode pesquisar pela primeira métrica.

cpu_total

EnableState

boolean

Não

O estado de habilitação da regra de alerta. Valores válidos:

  • true: Habilitada.

  • false: Desabilitada.

true

Namespace

string

Não

O namespace do serviço em nuvem.

Para informações sobre como obter o namespace de um serviço em nuvem, consulte DescribeMetricMetaList ou Métricas de serviços em nuvem.

acs_ecs_dashboard

Page

integer

Não

O número da página.

Valor mínimo: 1. Valor padrão: 1.

1

PageSize

integer

Não

O número de entradas por página.

Valor mínimo: 1. Valor padrão: 10.

10

AlertState

string

Não

O status da regra de alerta. Valores válidos:

  • OK: Normal.

  • ALARM: Alerta.

  • INSUFFICIENT_DATA: Sem dados.

OK

Dimensions

string

Não

As dimensões de monitoramento do recurso especificado.

Formato: Uma coleção de pares key:value, por exemplo, {"userId":"120886317861****"} e {"instanceId":"i-2ze2d6j5uhg20x47****"}.

{"instanceId":"i-2ze2d6j5uhg20x47****"}

RuleName

string

Não

O nome da regra de alerta.

Este parâmetro suporta pesquisa difusa.

Rule_01

GroupId

string

Não

O ID do grupo de aplicações.

Para informações sobre como obter o ID do grupo de aplicações, consulte DescribeMonitorGroups.

7301****

RuleIds

string

Não

Os IDs das regras de alerta. Separe múltiplos IDs com vírgulas (,). Você pode consultar até 20 regras de alerta por vez.

applyTemplate344cfd42-0f32-4fd6-805a-88d7908a****

Para mais informações sobre parâmetros de solicitação comuns, consulte Parâmetros comuns.

Elementos de resposta

Elemento

Tipo

Descrição

Exemplo

object

Nenhum.

Code

integer

O código de status HTTP.

Nota

200 indica sucesso.

200

Message

string

A mensagem de erro.

The specified resource is not found.

RequestId

string

O ID da solicitação.

386C6712-335F-5054-930A-CC92B851ECBA

Total

string

O número total de registros.

1

Success

boolean

Indica se a operação foi bem-sucedida. Valores válidos:

  • true: Bem-sucedida.

  • false: Falhou.

true

Alarms

object

Alarm

array<object>

A lista de regras de alerta.

array<object>

Nenhum.

SilenceTime

integer

The mute period. Unit: seconds. Default value: 86400. Minimum value: 3600.

If the monitoring data continuously exceeds the alert rule threshold, only one alert notification is sent within each mute period.

86400

MetricName

string

The metric name.

cpu_total

Webhook

string

The callback URL when an alert is triggered. CloudMonitor pushes alert information to this URL through a POST request. Currently, only the HTTP protocol is supported.

https://www.aliyun.com

ContactGroups

string

The alert contact group.

ECS_Alarm

SourceType

string

The type of the alert rule. Valid value: METRIC, indicating a time series metric alert rule.

METRIC

Namespace

string

The namespace of the cloud service.

acs_ecs_dashboard

MailSubject

string

The subject of the alert email.

"${serviceType}-${metricName}-${levelDescription} notification(${dimensions})"

NoEffectiveInterval

string

The time range during which the alert rule is ineffective.

00:00-05:30

EffectiveInterval

string

The time range during which the alert rule is effective.

05:31-23:59

RuleName

string

The name of the alert rule.

Rule_01

AlertState

string

The status of the alert rule. Valid values:

  • OK: Normal.

  • ALARM: Alert.

  • INSUFFICIENT_DATA: No data.

OK

Period

string

The aggregation period.

60

RuleId

string

The ID of the alert rule.

applyTemplate344cfd42-0f32-4fd6-805a-88d7908a****

GroupName

string

The name of the application group.

Nota

This parameter is displayed if the alert rule is associated with an application group.

ECS_Group

GroupId

string

The ID of the application group.

7301****

Dimensions

string

The dimensions of the alert rule.

[{"instanceId":"i-2ze2d6j5uhg20x47****"}]

EnableState

boolean

The enabled state. Valid values:

  • true: Enabled.

  • false: Disabled.

true

Resources

string

The resources associated with the alert rule.

[{\"instanceId\":\"i-2ze2d6j5uhg20x47****\"}]

Escalations

object

The trigger conditions for alerts by severity level.

Info

object

The trigger conditions of Info-level alerts.

ComparisonOperator

string

The comparison operator for Info-level thresholds. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equal to.

  • GreaterThanThreshold: greater than.

  • LessThanOrEqualToThreshold: less than or equal to.

  • LessThanThreshold: less than.

  • NotEqualToThreshold: not equal to.

  • GreaterThanYesterday: year-over-year increase compared to the same time yesterday.

  • LessThanYesterday: year-over-year decrease compared to the same time yesterday.

  • GreaterThanLastWeek: year-over-year increase compared to the same time last week.

  • LessThanLastWeek: year-over-year decrease compared to the same time last week.

  • GreaterThanLastPeriod: period-over-period increase compared to the previous period.

  • LessThanLastPeriod: period-over-period decrease compared to the previous period.

GreaterThanOrEqualToThreshold

PreCondition

string

The precondition for Info-level alerts. When the ComparisonOperator parameter is set to year-over-year or period-over-period comparison, this parameter works together with it.

For example, if this parameter is set to $Average>80, ComparisonOperator is set to GreaterThanYesterday, and Threshold is set to 10, an alert is triggered when the average value is greater than 80 and the value has increased by 10% compared to yesterday.

Nota

$Average in $Average>0 is a placeholder in the format of $monitoring_result_field_value. CloudMonitor replaces it with the corresponding statistical value or original monitoring value.

$Average>80

Times

integer

The consecutive number of times for which the Info-level alert condition is met. An alert is triggered only when the condition is met for the specified consecutive times and the threshold is exceeded.

3

Threshold

string

The threshold for Info-level alerts.

90

Statistics

string

The statistical method for Info-level alerts.

Average

Warn

object

The trigger conditions of Warn-level alerts.

ComparisonOperator

string

The comparison operator for Warn-level thresholds. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equal to.

  • GreaterThanThreshold: greater than.

  • LessThanOrEqualToThreshold: less than or equal to.

  • LessThanThreshold: less than.

  • NotEqualToThreshold: not equal to.

  • GreaterThanYesterday: year-over-year increase compared to the same time yesterday.

  • LessThanYesterday: year-over-year decrease compared to the same time yesterday.

  • GreaterThanLastWeek: year-over-year increase compared to the same time last week.

  • LessThanLastWeek: year-over-year decrease compared to the same time last week.

  • GreaterThanLastPeriod: period-over-period increase compared to the previous period.

  • LessThanLastPeriod: period-over-period decrease compared to the previous period.

GreaterThanOrEqualToThreshold

PreCondition

string

The precondition for Warn-level alerts. When the ComparisonOperator parameter is set to year-over-year or period-over-period comparison, this parameter works together with it.

For example, if this parameter is set to $Average>80, ComparisonOperator is set to GreaterThanYesterday, and Threshold is set to 10, an alert is triggered when the average value is greater than 80 and the value has increased by 10% compared to yesterday.

Nota

$Average in $Average>0 is a placeholder in the format of $monitoring_result_field_value. CloudMonitor replaces it with the corresponding statistical value or original monitoring value.

$Average>80

Times

integer

The consecutive number of times for which the Warn-level alert condition is met. An alert is triggered only when the condition is met for the specified consecutive times and the threshold is exceeded.

3

Threshold

string

The threshold for Warn-level alerts.

90

Statistics

string

The statistical method for Warn-level alerts.

Average

Critical

object

The trigger conditions of Critical-level alerts.

ComparisonOperator

string

The comparison operator for Critical-level thresholds. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equal to.

  • GreaterThanThreshold: greater than.

  • LessThanOrEqualToThreshold: less than or equal to.

  • LessThanThreshold: less than.

  • NotEqualToThreshold: not equal to.

  • GreaterThanYesterday: year-over-year increase compared to the same time yesterday.

  • LessThanYesterday: year-over-year decrease compared to the same time yesterday.

  • GreaterThanLastWeek: year-over-year increase compared to the same time last week.

  • LessThanLastWeek: year-over-year decrease compared to the same time last week.

  • GreaterThanLastPeriod: period-over-period increase compared to the previous period.

  • LessThanLastPeriod: period-over-period decrease compared to the previous period.

GreaterThanOrEqualToThreshold

PreCondition

string

The precondition for Critical-level alerts. When the ComparisonOperator parameter is set to year-over-year or period-over-period comparison, this parameter works together with it.

For example, if this parameter is set to $Average>80, ComparisonOperator is set to GreaterThanYesterday, and Threshold is set to 10, an alert is triggered when the average value is greater than 80 and the value has increased by 10% compared to yesterday.

Nota

$Average in $Average>0 is a placeholder in the format of $monitoring_result_field_value. CloudMonitor replaces it with the corresponding statistical value or original monitoring value.

$Average>80

Times

integer

The consecutive number of times for which the Critical-level alert condition is met. An alert is triggered only when the condition is met for the specified consecutive times and the threshold is exceeded.

3

Threshold

string

The threshold for Critical-level alerts.

90

Statistics

string

The statistical method for Critical-level alerts.

Average

NoDataPolicy

string

The method to handle alerts when no monitoring data is found. Valid values:

  • KEEP_LAST_STATE (default): No action is taken.

  • INSUFFICIENT_DATA: The alert content indicates no data.

  • OK: Normal.

KEEP_LAST_STATE

CompositeExpression

object

The alert conditions for multiple metrics.

Nota

Single-metric and multi-metric conditions are mutually exclusive and cannot be set at the same time.

Level

string

The alert level. Valid values:

  • CRITICAL: Critical.

  • WARN: Warning.

  • INFO: Information.

CRITICAL

ExpressionList

object

ExpressionList

array<object>

The list of alert conditions created in standard mode.

object

None.

MetricName

string

The metric name of the cloud service.

cpu_total

Period

integer

The aggregation period of the metric.

Unit: seconds.

60

Statistics

string

The statistical method of the metric. Valid values:

  • $Maximum: Maximum value.

  • $Minimum: Minimum value.

  • $Average: Average value.

  • $Availability: Availability (typically used for site monitoring).

Nota

$ is the unified prefix for metrics. For supported cloud services, see Cloud service metrics.

$Maximum

ComparisonOperator

string

The comparison operator for the threshold. Valid values:

  • GreaterThanOrEqualToThreshold: greater than or equal to.

  • GreaterThanThreshold: greater than.

  • LessThanOrEqualToThreshold: less than or equal to.

  • LessThanThreshold: less than.

  • NotEqualToThreshold: not equal to.

  • GreaterThanYesterday: year-over-year increase compared to the same time yesterday.

  • LessThanYesterday: year-over-year decrease compared to the same time yesterday.

  • GreaterThanLastWeek: year-over-year increase compared to the same time last week.

  • LessThanLastWeek: year-over-year decrease compared to the same time last week.

  • GreaterThanLastPeriod: period-over-period increase compared to the previous period.

  • LessThanLastPeriod: period-over-period decrease compared to the previous period.

GreaterThanOrEqualToThreshold

Threshold

string

The alert threshold.

90

ExpressionListJoin

string

The relationship between multi-metric alert conditions. Valid values:

  • &&: An alert is triggered only when all metrics meet the alert conditions. An alert is triggered only when all expressions in ExpressionList are true.

  • ||: An alert is triggered when any one of the metrics meets the alert condition.

||

ExpressionRaw

string

The alert conditions created by using expressions. The following scenarios are included but not limited to:

  • Set an alert blocklist for some resources. For example, $instanceId != 'i-io8kfvcpp7x5****' && $Average > 50 indicates that no alert is triggered even if the Average value of the instance i-io8kfvcpp7x5**** in the alert rule exceeds 50.

  • Set a special alert threshold for a specified instance in the rule. For example, $Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50) indicates that an alert is triggered only when the Average value of the instance i-io8kfvcpp7x5**** exceeds 80, and an alert is triggered when the Average value of other instances exceeds 50.

  • Limit the number of instances that exceed the threshold in the rule. For example, count($Average > 20) > 3 indicates that an alert is triggered only when the number of instances whose Average value exceeds 20 is greater than 3.

$Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50)

Times

integer

The number of times that the alert condition must be met before an alert notification is sent.

3

Labels

object

Labels

array<object>

The tags of the alert rule.

object

None.

Key

string

The tag key of the alert rule.

cmsRuleKey

Value

string

The tag value of the alert rule.

cmsRuleValue

Prometheus

object

Prometheus alerts.

Nota

This parameter is required only when you create Prometheus alert rules for Enterprise Cloud Monitor.

PromQL

string

The PromQL query statement.

Nota

The data obtained by the PromQL query statement is the alert data. Include the alert threshold in the statement.

CpuUsage{instanceId="xxxx"}[1m]>90

Level

string

The alert level. Valid values:

  • CRITICAL: Critical.

  • WARN: Warning.

  • INFO: Information.

CRITICAL

Times

integer

The number of times that the alert condition must be met before an alert notification is sent.

3

Annotations

object

Annotations

array<object>

When Prometheus alerts are triggered, the annotation keys and values are rendered to make it easier for you to understand the metrics or alert rules.

Nota

This feature is equivalent to Prometheus Annotations.

object

None.

Key

string

The annotation key.

summary

Value

string

The annotation value.

{{ $labels.instance }} CPU usage above 10% {current value: {{ humanizePercentage $value }} }

SendOK

boolean

Specifies whether to disable recovery alerts. Valid values: true (yes) and false (no).

true

ProductCategory

string

The type of the cloud service.

slb

GmtCreate

integer

The time when the rule was created. The value is a Unix timestamp.

1760432061000

GmtUpdate

string

The time when the rule was last updated. The value is a Unix timestamp.

1760432061000

Exemplos

Resposta de sucesso

JSON formato

{
  "Code": 200,
  "Message": "The specified resource is not found.",
  "RequestId": "386C6712-335F-5054-930A-CC92B851ECBA",
  "Total": "1",
  "Success": true,
  "Alarms": {
    "Alarm": [
      {
        "SilenceTime": 86400,
        "MetricName": "cpu_total",
        "Webhook": "https://www.aliyun.com",
        "ContactGroups": "ECS_Alarm",
        "SourceType": "METRIC",
        "Namespace": "acs_ecs_dashboard",
        "MailSubject": "\"${serviceType}-${metricName}-${levelDescription} notification(${dimensions})\"",
        "NoEffectiveInterval": "00:00-05:30",
        "EffectiveInterval": "05:31-23:59",
        "RuleName": "Rule_01",
        "AlertState": "OK",
        "Period": "60",
        "RuleId": "applyTemplate344cfd42-0f32-4fd6-805a-88d7908a****",
        "GroupName": "ECS_Group",
        "GroupId": "7301****",
        "Dimensions": "[{\"instanceId\":\"i-2ze2d6j5uhg20x47****\"}]",
        "EnableState": true,
        "Resources": "[{\\\"instanceId\\\":\\\"i-2ze2d6j5uhg20x47****\\\"}]",
        "Escalations": {
          "Info": {
            "ComparisonOperator": "GreaterThanOrEqualToThreshold",
            "PreCondition": "$Average>80",
            "Times": 3,
            "Threshold": "90",
            "Statistics": "Average"
          },
          "Warn": {
            "ComparisonOperator": "GreaterThanOrEqualToThreshold",
            "PreCondition": "$Average>80",
            "Times": 3,
            "Threshold": "90",
            "Statistics": "Average"
          },
          "Critical": {
            "ComparisonOperator": "GreaterThanOrEqualToThreshold",
            "PreCondition": "$Average>80",
            "Times": 3,
            "Threshold": "90",
            "Statistics": "Average"
          }
        },
        "NoDataPolicy": "KEEP_LAST_STATE",
        "CompositeExpression": {
          "Level": "CRITICAL",
          "ExpressionList": {
            "ExpressionList": [
              {
                "MetricName": "cpu_total",
                "Period": 60,
                "Statistics": "$Maximum",
                "ComparisonOperator": "GreaterThanOrEqualToThreshold",
                "Threshold": "90"
              }
            ]
          },
          "ExpressionListJoin": "||",
          "ExpressionRaw": "$Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50)",
          "Times": 3
        },
        "Labels": {
          "Labels": [
            {
              "Key": "cmsRuleKey",
              "Value": "cmsRuleValue"
            }
          ]
        },
        "Prometheus": {
          "PromQL": "CpuUsage{instanceId=\"xxxx\"}[1m]>90",
          "Level": "CRITICAL",
          "Times": 3,
          "Annotations": {
            "Annotations": [
              {
                "Key": "summary",
                "Value": "{{ $labels.instance }} CPU usage above 10% {current value: {{ humanizePercentage $value }} }"
              }
            ]
          }
        },
        "SendOK": true,
        "ProductCategory": "slb",
        "GmtCreate": 1760432061000,
        "GmtUpdate": "1760432061000"
      }
    ]
  }
}

Códigos de erro

Código de status HTTP

Código de erro

Mensagem de erro

Descrição

400 InvalidParameter Invalid parameter. Parameter error
500 InternalError The request processing has failed due to some unknown error.
403 InvalidAuthorization The Request is not authorization.
404 ResourceNotFound The specified resource is not found. The specified resource is not found.

Consulte Códigos de Erro para uma lista completa.

Notas de versão

Consulte Notas de Versão para uma lista completa.