All Products
Search
Document Center

CloudMonitor:Create an alert rule

Last Updated:Feb 27, 2024

After you connect Alibaba Cloud services, data centers, third-party cloud services, Prometheus, on-premises logs, Simple Log Service logs, and custom monitoring data to CloudMonitor, you can create alert rules to monitor the usage of various resources. If the metric value of a resource meets the alert conditions, CloudMonitor automatically sends alert notifications to you.

Prerequisites

A namespace is created. For more information, see Create a namespace.

Limits

You can use an Alibaba Cloud account to create up to 20 alert rules.

Procedure

  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, choose Hybrid Cloud Monitoring > Namespace.

  3. On the Namespace page, click Create Alert Rule in the upper-left corner.

  4. In the Create Alert Rule panel, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Alert Rule

    The name of the alert rule.

    Namespace

    The namespace of metrics. The alert rule takes effect only on the metrics that belong to the specified namespace.

    Alert Expression (PromQL)

    The condition that triggers alerts. If a metric meets the specified condition, an alert is triggered.

    Tag

    The tags of the alert rule. You can set the key and value of each tag.

    Annotations

    The annotations of the alert rule. You can set the key and value of each annotation.

    Mute For

    The interval at which CloudMonitor resends alert notifications before an alert is cleared. Valid values: 5 Minutes, 15 Minutes, 30 Minutes, 60 Minutes, 3 Hours, 6 Hours, 12 Hours, and 24 Hours.

    If a metric value reaches the threshold, CloudMonitor sends an alert notification. If the metric value reaches the threshold again within the mute period, CloudMonitor does not resend an alert notification. If the alert is not cleared after the mute period ends, CloudMonitor resends an alert notification.

    For example, if the Mute For parameter is set to 12 Hours and the alert is not cleared, CloudMonitor resends an alert notification after 12 hours.

    Effective Period

    The period during which the alert rule is effective. CloudMonitor monitors the specified resources based on the alert rule only within the specified period.

    Alert Contact Group

    The alert contact groups to which alert notifications are sent.

    The alert notifications of the application group are sent to the alert contacts that belong to the selected alert contact groups. An alert contact group can contain one or more alert contacts.

    For more information about how to create an alert contact and an alert contact group, see Create an alert contact or alert contact group.

    Notification Methods

    The alert level and the methods that are used to send alert notifications. Valid values:

    Info (Email + Webhook)

    You can specify the consecutive periods of time during which the metric value exceeds the threshold before an alert is triggered. Valid values of the consecutive cycles: 1, 3, 5, 10, 15, 30, 60, 70, 90, 120, and 180. One consecutive cycle is equal to 1 minute.

    Alert Callback

    The callback URL that can be accessed over the Internet. CloudMonitor sends HTTP POST requests to push alert notifications to the specified URL. You can enter only an HTTP URL.

    To test the connectivity of an alert callback URL, perform the following steps:

    1. Click Test next to the callback URL.

      In the Webhook Test panel, you can check and troubleshoot the connectivity of the alert callback URL based on the returned status code and test result details.

      Note

      To obtain the details of the test result, configure the Test Template Type and Language parameters and click Test.

    2. Click Close.

    Auto Scaling

    If you turn on Auto Scaling, the specified scaling rule is enabled when an alert is triggered. In this case, you must configure the Region, ESS Group, and ESS Rule parameters.

    Log Service

    If you turn on Log Service, the alert information is written to the specified Logstore in Simple Log Service when an alert is triggered. In this case, you must configure the Region, ProjectName, and Logstore parameters.

    For more information about how to create a project and a Logstore, see Getting Started.

    Message Service - topic

    If you turn on Message Service - topic, the alert information is written to the specified topic in Message Service (MNS) when an alert is triggered. In this case, you must configure the Region and topicName parameters.

    For information about how to create a topic, see Create a topic.

    Function Compute

    If you turn on Function Compute, an alert notification is sent to Function Compute for format processing when an alert is triggered. In this case, you must configure the Region, Service, and Function parameters.

    For information about how to create a service and a function, see Quickly create a function.

    Method to handle alerts when no monitoring data is found

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

    • Do not do anything

    • Send alert notifications

    • Treated as normal (default)

  5. Click OK.

  6. View the created alert rule.

    In the left-side navigation pane, choose Alerts > Alert Rules.

    On the Alert Rules page, the alert rule whose Product Name is Prometheus is the one that you created.