Updated on 2026-02-24 GMT+08:00

Generating Alarms by Tag

Through Prometheus monitoring and alarm management, alarms can be generated for resources by tag. This section describes how to generate alarms for the CPU usage of a Distributed Cache Service (DCS) instance by tag.

Scenario

O&M personnel of an e-commerce platform need to manage cloud resources and generate alarms by tag.

Solution

Create Prometheus instances for cloud services and connect cloud services and tags. Then check the connected cloud service metrics and tags on the Metric Browsing page and set alarm rules for these metrics. If a metric is abnormal, an alarm will be triggered immediately and a notification will be sent.

Step 1: Add a Tag to a Cloud Service

Log in to the Tag Management Service (TMS) console and add a tag to DCS. For details, see Adding Tags to Cloud Resources.

For example, set the tag key to Ihn and the tag value to OPEN.

Step 2: Connect the Cloud Service to a Prometheus Instance

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane on the left, choose Prometheus Monitoring > Instances.
  3. Click Add Prometheus Instance to add a common instance named prometheus_cloudservice.
  4. After the configuration, click OK. You can view the new common instance in the instance list.
  5. In the navigation pane on the left, choose Access Center > Access Center to go to the new access center.
  6. Select Cloud services under Types to filter the DCS card.
  7. Click Ingest Metric (AOM) on the DCS card. The Ingest Cloud Service Metric page is displayed.

    • Instance Type: The default value is Common Prometheus instance and cannot be changed.
    • Instance Name: Select prometheus_cloudservice from the instance drop-down list.

  8. Click Next to go to the ingestion rule configuration page.

    Table 1 Parameter description

    Parameter

    Description

    Example

    Ingestion Rule Name

    Enter up to 50 characters starting with a letter. Use only letters, digits, underscores (_), and hyphens (-).

    dcs_rule

    Set Cloud Service Metric

    Ingest Metric: Select the cloud service metrics to ingest.

    • Configure metric ingestion for a cloud service:

      In the cloud service list, toggle the switch in the Ingest Metric column. In this way, you can ingest the metrics of a cloud service into AOM or remove them from AOM.

    • Configure metric ingestion for cloud services in batches:

      In the cloud service list, select target cloud services or all cloud services, click Ingest Metric above the list, and then choose Enable or Disable. In this way, you can ingest cloud service metrics into AOM or remove metrics from AOM in batches.

    Cloud Service: DCS

    Ingest Metric:

    Add Tag to Dimension: Indicates whether to add tags of cloud service resources to metric dimensions. Tag changes will be synchronized every hour. Each tag name must start with a letter or underscore (_). Only letters, digits, and underscores are allowed.
    • Configure the function of adding the tags of one cloud service to metric dimensions:

      In the cloud service list, toggle the switch in the Add Tag to Dimension column. In this way, you can add the tags of a cloud service to metric dimensions or remove them.

    • Configure the function of adding the tags of multiple cloud services to metric dimensions:

      In the cloud service list, select target cloud services or all cloud services, click Add Tag to Dimension above the list, and then choose Enable or Disable. In this way, you can add the tags of multiple cloud services to metric dimensions or remove them.

  9. Click Confirm. Wait for 2 to 3 minutes and view the ingested metric data on the Metric Browsing page. You can view the metric ingestion rule on the Access Center > Access Management page or view metrics on the Metric Browsing page.

Step 3: Set the Tag to Be an Alarm Condition

  1. Check whether the cloud service metric and tag have been connected.

    1. In the navigation pane, choose Metric Browsing.
    2. On the Metric Sources tab page, select the Prometheus instance created in 3.
    3. Select the metric to be monitored from the Metric drop-down list and select the tag added in step 1 from the Conditions drop-down list to check whether the cloud service metric and tag have been connected. As shown in Figure 1, the CPU Usage metric and Ihn tag of the DCS service have been connected.
      Figure 1 Checking the metric

  2. Click Add Alarm Rule in the upper right corner of the metric list to add an alarm rule for the selected metric.
  3. Set the basic information about the alarm rule, such as the rule name.

    Table 2 Basic information

    Parameter

    Description

    Example Value

    Original Rule Name

    Original name of the alarm rule. Enter a maximum of 256 characters and do not start or end with any special character. Only letters, digits, underscores (_), and hyphens (-) are allowed.

    Ihn

    Rule Name

    Name of a rule. Max.: 256 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. Do not start or end with a hyphen or underscore. In this example, leave this parameter blank.

    -

    Enterprise Project

    Select the required enterprise project. The default value is default.

    default

    Description

    Description of the rule. Enter up to 1,024 characters. In this example, leave this parameter blank.

    -

  4. Set the detailed information about the alarm rule.

    1. By default, the rule type, configuration mode, and Prometheus instance in the alarm rule settings are the same as those on the Metric Browsing page.
    2. Set alarm rule details. The metric and its conditions are consistent with those configured on the Metric Browsing page. Set parameters such as the statistical period and detection rule as required.
      As shown in Figure 2, in a 1-minute statistical period, if the average value of the monitored object is greater than 0.5 for three consecutive periods, a critical alarm () will be generated.
      Figure 2 Setting alarm rule details
    3. Under Advanced Settings, set information such as Check Interval and Alarm Clearance. In this example, retain the default settings.
    4. Set an alarm notification policy. There are two alarm notification modes. As shown in Figure 3, the direct alarm reporting mode is selected.
      Direct alarm reporting: An alarm is directly sent when the alarm condition is met. If you select this mode, set an interval for notification and specify whether to enable a notification rule.
      1. Set the frequency for sending alarm notifications.
      2. Determine whether to enable the notification rule. After the rule is enabled, the system sends notifications based on the associated SMN topic and message template.
      Figure 3 Alarm notification

  5. Click Confirm. Then click View Rule to view the created rule.

    As shown in Figure 4, click a rule name to view the rule details.

    In the expanded list, if a monitored object meets the configured alarm condition, a metric alarm is generated on the alarm list page. To view the alarm, choose Alarm Center > Alarm List in the navigation pane. In this example, if the CPU usage of the DCS instance meets the preset notification policy, the system will send an alarm notification to the specified personnel by email, SMS, or WeCom.

    Figure 4 Checking the alarm rule