Tous les produits
Search
Centre de documentation

:DescribeMetricRuleList

Dernière mise à jour :Aug 07, 2026

Consulte toutes les règles de la liste des règles d'alerte.

Description de l'opération

Cette rubrique fournit un exemple montrant comment consulter toutes les règles d'alerte de la liste des règles d'alerte associée au compte Alibaba Cloud actuel. La réponse indique que la liste des règles d'alerte ne contient qu'une seule règle d'alerte. Le nom de la règle d'alerte est Rule_01 et l'identifiant est applyTemplate344cfd42-0f32-4fd6-805a-88d7908a****.

Testez maintenant

Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale. Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale.

Test

Autorisation RAM

Le tableau ci-dessous décrit les autorisations nécessaires pour appeler cette API. Vous pouvez les définir dans une politique Resource Access Management (RAM). Les colonnes du tableau sont détaillées ci-dessous :

  • Action : les actions peuvent être utilisées dans l'élément Action des instructions de politique de permissions RAM pour accorder les autorisations nécessaires à l'exécution de l'opération.

  • API : l'API que vous pouvez appeler pour exécuter l'action.

  • Niveau d'accès : le niveau d'accès prédéfini accordé pour chaque API. Valeurs valides : create, list, get, update et delete.

  • Type de ressource : le type de ressource qui prend en charge l'autorisation pour exécuter l'action. Il indique si l'action prend en charge les permissions au niveau de la ressource. La ressource spécifiée doit être compatible avec l'action. Sinon, la politique sera inefficace.

    • Pour les API avec permissions au niveau de la ressource, les types de ressource requis sont marqués d'un astérisque (*). Spécifiez l'Alibaba Cloud Resource Name (ARN) correspondant dans l'élément Resource de la politique.

    • Pour les API sans permissions au niveau de la ressource, la valeur All Resources est affichée. Utilisez un astérisque (*) dans l'élément Resource de la politique.

  • Clé de condition : les clés de condition définies par le service. La clé permet un contrôle granulaire, applicable aux actions seules ou aux actions associées à des ressources spécifiques. En plus des clés de condition propres au service, Alibaba Cloud fournit un ensemble de clés de condition communes applicables à tous les services pris en charge par RAM.

  • Action dépendante : les actions dépendantes requises pour exécuter l'action. Pour mener à bien l'opération, l'utilisateur RAM ou le rôle RAM doit disposer des permissions pour toutes les actions dépendantes.

cms:DescribeMetricRuleList

get

*All Resource

*

Aucune Aucune

Paramètres de requête

Paramètre

Type

Requis

Description

Exemple

MetricName

string

Non

Le nom de la métrique.

Pour plus d'informations sur la manière d'obtenir les noms des métriques, consultez DescribeMetricMetaList ou Métriques des services cloud.

Remarque : pour les métriques composites, vous ne pouvez rechercher que par la première métrique.

cpu_total

EnableState

boolean

Non

L'état d'activation de la règle d'alerte. Valeurs valides :

  • true : Activé.

  • false : Désactivé.

true

Namespace

string

Non

L'espace de noms du service cloud.

Pour plus d'informations sur la manière d'obtenir l'espace de noms d'un service cloud, consultez DescribeMetricMetaList ou Métriques des services cloud.

acs_ecs_dashboard

Page

integer

Non

Le numéro de page.

1

PageSize

integer

Non

Le nombre d'entrées par page.

10

AlertState

string

Non

L'état de la règle d'alerte. Valeurs valides :\n- OK : Normal.\n- ALARM : Alerte.\n- INSUFFICIENT_DATA : Aucune donnée.

OK

Dimensions

string

Non

Les dimensions de surveillance de la ressource spécifiée.

Format : une collection de paires clé:valeur, par exemple, {"userId":"120886317861****"} et {"instanceId":"i-2ze2d6j5uhg20x47****"}.

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

RuleName

string

Non

Le nom de la règle d'alerte.

Rule_01

GroupId

string

Non

L'identifiant du groupe d'applications.

Pour plus d'informations sur la manière d'obtenir l'identifiant du groupe d'applications, consultez DescribeMonitorGroups.

7301****

RuleIds

string

Non

Les identifiants des règles d'alerte. Séparez les identifiants multiples par des virgules (,). Vous pouvez interroger jusqu'à 20 règles d'alerte à la fois.

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

Pour plus d'informations sur les paramètres de requête courants, consultez Paramètres courants.

Éléments de réponse

Élément

Type

Description

Exemple

object

Aucun.

Code

integer

Le code d'état HTTP.

200

Message

string

Le message d'erreur.

La ressource spécifiée est introuvable

RequestId

string

L'identifiant de la requête.

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

Total

string

Le nombre total d'enregistrements.

1

Success

boolean

Indique si l'opération a réussi. Valeurs valides :

  • true : Succès.

  • false : Échec.

true

Alarms

object

Alarm

array<object>

La liste des règles d'alerte.

array<object>

Aucun.

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.

Remarque

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.

Remarque

$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.

Remarque

$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.

Remarque

$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.

Remarque

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).

Remarque

$ 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.

Remarque

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

PromQL

string

The PromQL query statement.

Remarque

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.

Remarque

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

Exemples

JSON format

{
  "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"
      }
    ]
  }
}

Codes d'erreur

Code de statut HTTP

Code d'erreur

Message d'erreur

Description

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.

Consultez Codes d'erreur pour la liste complète.

Notes de version

Consultez Notes de version pour la liste complète.