When you create an alert monitoring rule, you can specify labels and annotations. You can use labels to denoise alerts, manage notification routes, and allocate notification channels. You can use annotations to configure alert templates and dispatch alerts.

Labels

Labels have the following characteristics:

  • Labels are the identifying attributes of alerts, and are formatted in key-value pairs. Labels are part of alert fingerprints and can be used to deduplicate alerts. For example, the label of the host1 is "labels": {"host": "host1"}. The alert management system can deduplicate alerts based on the label.
  • Labels can be referenced in alert templates by using ${labels}.
  • In alert policies, labels can be used in route consolidation policies to denoise alerts. For more information, see Merge conditions.
  • The alert management system and notification management system manage alerts and allocate notification channels based on the labels.
  • The fields that you specify when you set the Group Evaluation parameter are automatically used as labels.
  • Labels are static text. You can customize a label. The label is automatically added as the attribute of an alert.
For example, you can add the labels in the following figure when you create an alert monitoring rule. biaoqian

Annotations

Annotations have the following characteristics:

  • Annotations are the non-identifying attributes of alerts, and are formatted in key-value pairs. The value of an annotation can be a variable. For example, you can create the following annotation: "annotations": {"title": "CPU utilization of ${service} is too high","desc": "Current CPU utilization of ${service} is 90%"}.
  • When you specify the content of an annotation, you can reference the field variables that are specified for the Group Evaluation parameter. If an alert is triggered, the specified variables are replaced by actual values.
  • The alert management system and notification management system manage and send alerts and allocate notification channels based on annotations.
  • Each annotation consists of a title and a description (desc).
    • A title is a fixed and non-identifying attribute of an alert. You can reference titles in an alert template by using ${annotations.title}.
    • A description (desc) is a fixed and non-identifying attribute of an alert. You can reference descriptions in an alert template by using ${annotations.desc}.
For example, you can add the annotation in the following figure when you create an alert monitoring rule. biaozhu
The following table describes the built-in variables that you can use to specify the attribute values of an annotation.
Variable Description
__count__ The number of rows in each group after these rows are grouped. If you set the Group Evaluation parameter to No Grouping, all data is in one group.
__pass_count__ The number of rows that meet specified conditions in each group after these rows are grouped. If you set the Group Evaluation parameter to No Grouping, all data is in one group.
__0_count__ The number of rows that are returned for the first query.
__1_count__ The number of rows that are returned for the second query.
__2_count__ The number of rows that are returned for the third query.
aliuid The ID of an Alibaba Cloud account.
alert_instance_id The ID of an alert.
alert_id The ID of an alert monitoring rule.
alert_name The name of an alert monitoring rule.
project The project to which an alert monitoring rule belongs.

Auto-Add switch

When you create an alert monitoring rule, you can turn on the Auto-Add switch. If you turn on the Auto-Add switch, fields are automatically added to the annotation.
Note
  • If more than one value exists in a field, the first value is added to the annotation.
  • The __count__ built-in field indicates the number of rows in the result of a set operation.
  • Grouping

    When you create an alert monitoring rule, you can set Group Evaluation to Custom Tag or Auto Tag and turn on the Auto-Add switch. Then, the non-grouped fields and the __count__ built-in field in the result of the set operation are automatically added to the annotation.

    For example, the result of the set operation includes host and pv, and the result is grouped by the host field. If you turn on the Auto-Add switch, the pv field and the __count__ field are added to the annotation.

    Auto-Add switch
  • No grouping

    When you create an alert monitoring rule, you can set Group Evaluation to No Grouping and turn on the Auto-Add switch. Then, all fields and the __count__ built-in field in the result of the set operation are automatically added to the annotation.

    For example, the result of the set operation includes host and pv. If you turn on the Auto-Add switch, the host, pv, and __count__ fields are added to the annotation.

    No Grouping