Help Center/ Application Operations Management/ Getting Started/ Using Prometheus to Monitor ECS Metrics
Updated on 2025-08-13 GMT+08:00

Using Prometheus to Monitor ECS Metrics

An Elastic Cloud Server (ECS) is a computing server consisting of the CPU, memory, OS, and Elastic Volume Service (EVS) disk. It supports on-demand allocation and auto scaling. ECSs integrate Virtual Private Cloud (VPC), security group, and Cloud Firewall (CFW) capabilities to create an efficient, reliable, and secure computing environment. This ensures stable and uninterrupted running of services. AOM is a one-stop, multi-dimensional O&M platform for cloud applications. It enables you to monitor real-time running of applications, resources, and services and detect faults in a timely manner, improving O&M automation capability and efficiency. After an ECS is connected to AOM, AOM can monitor the ECS in real time and send alarm notifications.

This section uses the node_network_up metric of an ECS as an example to describe how to use AOM.

Procedure

  1. Manually Installing UniAgent on the ECS: Manually install UniAgent on the ECS to centrally manage metric collection plug-ins.
  2. Connecting an ECS to AOM: Use the Node Exporter plug-in to report ECS metrics to AOM and store the metrics in a Prometheus instance for ECS.
  3. Setting a Metric Alarm Rule: Create an alarm rule for the ECS metric. If the metric data meets the alarm condition, an alarm will be generated.

Prerequisites

Manually Installing UniAgent on the ECS

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane, choose Settings > Global Settings.
  3. On the Global Settings page, choose Collection Settings > UniAgents. On the VM Access page that is displayed, check the UniAgent status of the ECS. To switch from the UniAgents page to the VM Access page, click Back to Old Version in the upper right corner of the page.

    • If the UniAgent status is Running, UniAgent has been installed. In this case, go to Connecting an ECS to AOM.
    • If the UniAgent status is Offline, UniAgent is abnormal.
    • If the UniAgent status is Installing, UniAgent is being installed. Wait for UniAgent installation.
    • If the UniAgent status is Installation failed or Not installed, UniAgent fails to be installed or is not installed on the host. In this case, install it.

  4. Select the host where UniAgent is to be installed, click Install UniAgent in the upper right corner, and then select Manual.

    (When you install UniAgent for the first time, the Manual page is displayed by default.)

  5. On the Install UniAgent page, set parameters.

    Figure 1 Manually installing UniAgent
    Table 1 Parameters for manual installation

    Parameter

    Description

    Example

    UniAgent Version

    (Mandatory) UniAgent version.

    1.1.6

    Access Mode

    Mode for connecting to UniAgent. Select Direct access.

    Direct access: intended for Huawei Cloud hosts.

    Direct access

    Installation Command

    Command for installing UniAgent. In this example, copy the Linux installation command.

    Click to copy the installation command.

    Copy the Linux installation command.

  6. Log in to the ECS and run the Linux installation command copied in 5 as the root user.
  7. Check the UniAgent status in the UniAgent list. If the UniAgent status is Running, the installation is successful.

Connecting an ECS to AOM

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane on the left, choose Access Center > Access Center to go to the old access center.

    To switch from the new access center to the old one, click Back to Old Version in the upper right corner.

  3. On the Prometheus Running Environments panel, click the Elastic Cloud Server (ECS) card.
  4. On the Procedure tab page of the ECS dialog box, perform operations as prompted.

    1. Create a Prometheus instance for ECS: Click Create Instance. In the displayed dialog box, set related parameters.
      Table 2 Parameters for creating a Prometheus instance for ECS

      Parameter

      Description

      Example

      Instance Name

      Prometheus instance name.

      Enter a maximum of 100 characters and do not start or end with an underscore (_) or hyphen (-). Only letters, digits, underscores, and hyphens are allowed.

      mon_ECS

      Enterprise Project

      Select the required enterprise project. The default value is default.
      • If you have selected All for Enterprise Project on the global settings page, select one from the drop-down list here.
      • If you have already selected an enterprise project on the global settings page, this option will be grayed and cannot be changed.

      default

      Instance Type

      Type of a Prometheus instance.

      Prometheus for ECS

    2. Select the Prometheus instance for ECS created in 4.a from the drop-down list.
    3. Install Node Exporter. Select the target host from the host list and click Install Exporter.
    4. After the installation is complete, Node Exporter can collect metrics. Click the Collection Tasks tab in the ECS dialog box to check the collection task.
      Figure 2 Checking the collection task

Setting a Metric Alarm Rule

Metric alarm rules can be created in the following modes: Select from all metrics and PromQL.

The following describes how to create an alarm rule when Configuration Mode is set to Select from all metrics.

  1. In the navigation pane, choose Alarm Center > Alarm Rules. Then, click Create Alarm Rule.
  2. Set basic information about the alarm rule by referring to Table 3.

    Table 3 Basic information

    Parameter

    Description

    Example

    Original Rule Name

    Name of a rule. Enter a maximum of 256 characters and do not start or end with underscores (_) or hyphens (-). Only letters, digits, underscores, and hyphens are allowed.

    monitor_ecs

    Rule Name

    Name of a rule. Enter a maximum of 256 characters and do not start or end with underscores (_) or hyphens (-). Only letters, digits, underscores, and hyphens are allowed.

    -

    Enterprise Project

    Select the required enterprise project. The default value is default.
    • If you have selected All for Enterprise Project on the global settings page, select one from the drop-down list here.
    • If you have already selected an enterprise project on the global settings page, this option will be grayed and cannot be changed.

    default

    Description

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

    -

  3. Set the detailed information about the alarm rule.

    1. Rule Type: Metric alarm rule.
    2. Configuration Mode: Select from all metrics. Then you can set alarm conditions for different types of resources.
    3. Select the target Prometheus instance from the drop-down list. In this example, select the instance created in 4.a.
    4. Set alarm rule details. Table 4 describes the parameters.

      After the setting is complete, the monitored metric data is displayed in a line graph above the alarm conditions. You can click Add Metric to add more metrics and set the statistical period and detection rules for them.

      Figure 3 Setting alarm rule details
      Table 4 Alarm rule details

      Parameter

      Description

      Example

      Multiple Metrics

      Calculation is performed based on the preset alarm conditions one by one. An alarm is triggered when one of the conditions is met.

      Multiple Metrics

      Metric

      Metric to be monitored. Click the Metric text box. In the resource tree on the right, select a target metric by resource type.

      node_network_up

      Statistical Period

      Interval at which metric data is collected.

      1 minute

      Conditions

      Metric monitoring scope. If this parameter is left blank, all resources are covered. In this example, leave this parameter blank.

      -

      Grouping Condition

      Aggregate metric data by the specified field and calculate the aggregation result.

      Not grouped

      Rule

      Detection rule of a metric alarm, which consists of the statistical mode (Avg, Min, Max, Sum, and Samples), determination criterion (, , >, and <), and threshold value.

      Avg > 1

      Trigger Condition

      When the metric value meets the alarm condition for a specified number of consecutive periods, a metric alarm will be generated.

      3

      Alarm Severity

      Severity of a metric alarm.

      • : a critical alarm.
      • : a major alarm.
      • : a minor alarm.
      • : a warning.

  4. Click Advanced Settings and set information such as Check Interval and Alarm Clearance. For details about the parameters, see Table 5.

    Table 5 Advanced settings

    Parameter

    Description

    Example

    Check Interval

    Interval at which metric query and analysis results are checked.

    Custom interval: 1 minute

    Alarm Clearance

    The alarm will be cleared when the alarm condition is not met for a specified number of consecutive periods.

    1

    Action Taken for Insufficient Data

    Action to be taken if there is no or insufficient metric data within the monitoring period. Enable this option if needed.

    Enabled: If the data is insufficient for 1 period, the status will change to Insufficient data and an alarm will be sent.

    Tags

    Click to add an alarm rule tag. It is an alarm identification attribute in the format of "key:value". It is used in alarm noise reduction scenarios. In this example, leave this parameter blank.

    For details, see Alarm Tags and Annotations.

    -

    Annotations

    Click to add an alarm rule annotation. It is an alarm non-identification attribute in the format of "key:value". It is used in alarm notification and message template scenarios. In this example, leave this parameter blank.

    For details, see Alarm Tags and Annotations.

    -

  5. Set an alarm notification policy. For details, see Table 6.

    Figure 4 Setting an alarm notification policy
    Table 6 Alarm notification policy parameters

    Parameter

    Description

    Example

    Notify When

    Set the scenario for sending alarm notifications. By default, Alarm triggered and Alarm cleared are selected.

    • Alarm triggered: If the alarm trigger condition is met, the system sends an alarm notification to the specified personnel by email or SMS.
    • Alarm cleared: If the alarm clearance condition is met, the system sends an alarm notification to the specified personnel by email or SMS.

    Retain the default value.

    Alarm Mode

    • 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.
    • Frequency: frequency for sending alarm notifications. Select a desire value from the drop-down list.
    • Notification Rule: After the rule is enabled, the system sends notifications based on the associated SMN topic and message template. If there is no alarm notification rule you want to select, click Add Rule in the drop-down list to create one. For details about how to set alarm notification rules, see Setting an Alarm Notification Rule.
    • Alarm Mode: Select Direct alarm reporting.
    • Frequency: Select Once.
    • Notification Rule: Mon_aom

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

    In the expanded list, if a metric value meets the configured alarm condition, a metric alarm is generated on the alarm page. To view the alarm, choose Alarm Center > Alarm List in the navigation pane. If a metric value meets the preset notification policy, the system sends an alarm notification to the specified personnel by email or SMS.

    Figure 5 Creating a metric alarm rule

Related Information

After an alarm rule is configured, you can perform the following operations if needed: