All Products
Search
Document Center

ApsaraDB for ClickHouse:Configure an alert rule

Last Updated:Jan 23, 2025

ApsaraDB for ClickHouse allows you to configure alert rules for the key metrics of ApsaraDB for ClickHouse clusters. If the value of a metric is not within the range that you specify in the alert rule for the metric, the system sends an alert notification to the contacts in the alert contact group. This way, you can handle the issue at the earliest opportunity. This topic describes how to configure an alert rule for an ApsaraDB for ClickHouse cluster.

Prerequisites

  • An ApsaraDB for ClickHouse Community-compatible Edition or Enterprise Edition cluster is created.

  • Your RAM user must be granted the AliyunARMSFullAccess permission of Application Real-time Monitoring Service (ARMS). The alerting feature of ApsaraDB for ClickHouse depends on the alerting service provided by ARMS. For more information about how to grant the permission to a RAM user, see Grant permissions to a RAM user.

Usage notes

You cannot view the monitoring information about Enterprise Edition clusters in the CloudMonitor console.

Procedure

ApsaraDB for ClickHouse console

Note

If your ApsaraDB for ClickHouse cluster meets the following conditions, configure an alert rule for the cluster based on the instructions in the Procedure in the old console section of this topic:

  • Your cluster was created before December 1, 2021.

  • Your cluster is deployed in the China (Qingdao) or China (Hohhot) region.

  1. Log on to the ApsaraDB for ClickHouse console.

  2. In the top navigation bar, select the region where the cluster is deployed.

  3. On the Clusters page, click the Clusters of Community-compatible Edition tab or the Enterprise Edition Clusters tab and click the ID of the cluster that you want to manage.

  4. In the left-side navigation pane, click Monitoring and Alerting.

  5. On the page that appears, click Cluster Alerting.

  6. Click Create ClickHouseAlert Rule or Create Enterprise EditionClickHouseAlert Rule.

    Note

    Create ClickHouseAlert Rule is displayed if you create an alert rule for a Community-compatible Edition cluster.

    Create Enterprise EditionClickHouseAlert Rule is displayed if you create an alert rule for an Enterprise Edition cluster.

  7. On the Create ClickHouseAlert Rule or Create Enterprise EditionClickHouseAlert Rule page, configure the following parameters.

    Note

    When you configure an alert rule for an ApsaraDB for ClickHouse cluster, you can set the Check Type parameter to Static Threshold or Custom PromQL. The parameter settings vary with the values of the Check Type parameter.

    • If you set the Check Type parameter to Static Threshold, you can select a preset alert metric and create an alert rule for the metric.

    • If you set the Check Type parameter to Custom PromQL, you can create an alert rule for a custom metric.

    Static Threshold

    Parameter

    Description

    Example

    Alert Rule Name

    Enter a name for the alert rule.

    CPU utilization alert

    Check Type

    The check type of the alert rule. Set this parameter to Static Threshold.

    Static Threshold

    Cluster

    Select the cluster for which you want to create an alert rule.

    cc-bp1lxbo89u95****

    Alert Contact Group

    Select an alert contact group.

    The alert contact groups that are supported by a Prometheus instance vary based on the type of the Prometheus instance. The options in the drop-down list vary based on the type of the Prometheus instance that you specify.

    ClickHouse

    Alert Metric

    Select the metric that you want to monitor by using the alert rule. Different alert contact groups provide different metrics.

    cpu_usage

    Alert Condition

    Specify the condition based on which alert events are generated.

    when cpu usage > 80%, trigger alert

    Filter Conditions

    Specify the application scope of the alert rule.

    No Filter

    Data Preview

    The Data Preview section displays the PromQL statement that corresponds to the alert condition. This section also displays the values of the specified metric in a time series graph.

    • By default, only the real-time values of one resource are displayed.

    • You can specify filter conditions to view the metric values of different resources in different time ranges.

    Note
    • The threshold in the time series graph is represented by a red line. The part of the curve that meets the alert condition is displayed in dark red, and the part of the curve that does not meet the alert condition is displayed in blue.

    • You can move the pointer over the curve to view resource details at a specific point in time.

    • You can also select a time period on the time series curve to view the time series curve of the selected time period.

    None

    Duration

    • If the alert condition is met, an alert event is generated: If the metric value at a point in time reaches the threshold, an alert event is generated.

    • If the alert condition is met continuously for N Minutes an alert event is generated: An alert event is generated only if the alert threshold is met for at least N minutes.

    1

    Alert Level

    Specify the alert level. Valid values: Default, P4, P3, P2, and P1. Default value: Default. The preceding values are listed in ascending order of severity.

    P2

    Alert Message

    Specify the alert message that you want to send to the specified contacts. You can specify custom variables in the alert message based on the Go template syntax.

    node: {{$labels.pod_name}} CPU usage {{$labels.metrics_params_opt_label_value}} {{$labels.metrics_params_value}}%, current value {{ printf "%.2f" $value }}%

    Alert Notification

    Simple Mode

    Notification Objects: the recipient who receives alert notifications.

    Notification Period: Only alerts generated within the specified time period are sent. Alerts generated at other times are ignored.

    Whether to Resend Notifications: specifies whether to resend alert notifications.

    image

    Standard Mode

    Configure the Specify Notification Policy parameter.

    Important

    After you select a notification policy, the alert events that are generated based on the alert rule can be matched by the notification policy and alerts can be generated. The alert events may also be matched by other notification policies that use fuzzy match, and alerts may be generated. One or more alert events can be matched by one or more notification policies.

    • Select Do Not Specify Notification Policy from the Specify Notification Policy drop-down list.

    • Select a notification policy that you create.

      Note

      You can click Create Notification Policy to create a notification policy. For more information, see Create and manage a notification policy.

    Do Not Specify Notification Policy

    Advanced Settings

    Alert Check Cycle

    Specify the interval at which the alert rule is triggered to check whether the data meets the alert condition. Default value: 1. Minimum value: 1. Unit: minutes.

    1 Minutes

    Check after the data is complete

    Specify whether to perform an alert check after data is collected, transmitted, and written to the storage. By default, Yes is selected. In most cases, you do not need to modify this parameter.

    Yes

    Tags

    Specify tags for the alert rule. The specified tags can be used to match notification policies.

    None

    Annotations

    Specify annotations for the alert rule.

    None

    Custom PromQL

    Parameter

    Description

    Example

    Alert Rule Name

    Enter a name for the alert rule.

    Pod CPU utilization exceeds 8%

    Check Type

    The check type of the alert rule. Set this parameter to Custom PromQL.

    Custom PromQL

    Cluster

    Select the cluster for which you want to create an alert rule.

    cc-bp1lxbo89u95****

    Reference Alert Contact Group

    Select an alert contact group.

    The alert contact groups that are supported by a Prometheus instance vary based on the type of the Prometheus instance. The options in the drop-down list vary based on the type of the Prometheus instance that you specify.

    ClickHouse

    Reference Metrics

    Optional. The Reference Metrics drop-down list displays common metrics. After you select a metric, the PromQL statement of the metric is displayed in the Custom PromQL Statements field. You can modify the statement based on your business requirements.

    The values in the Reference Metrics drop-down list vary based on the type of the Prometheus instance.

    http_conn_usage_count

    Custom PromQL Statements

    Specify the PromQL statement based on which alert events are generated.

    clickhouse_http_conn_usage_count{} > 1000

    Data Preview

    Duration

    • If the alert condition is met, an alert event is generated: If the metric value at a point in time reaches the threshold, an alert event is generated.

    • If the alert condition is met continuously for N Minutes an alert event is generated: An alert event is generated only if the alert threshold is met for at least N minutes.

    1

    Alert Level

    Specify the alert level. Valid values: Default, P4, P3, P2, and P1. Default value: Default. The preceding values are listed in ascending order of severity.

    Default

    Alert Message

    Specify the alert message that you want to send to the specified contacts. You can specify custom variables in the alert message based on the Go template syntax.

    Namespace: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / The utilization of the {{$labels.device}} disk exceeds 90%. Current value: {{ printf "%.2f" $value }}%

    Alert Notification

    Simple Mode

    Notification Objects: the recipient who receives alert notifications.

    Notification Period: Only alerts generated within the specified time period are sent. Alerts generated at other times are ignored.

    Whether to Resend Notifications: specifies whether to resend alert notifications.

    image

    Standard Mode

    Configure the Specify Notification Policy parameter.

    Important

    After you select a notification policy, the alert events that are generated based on the alert rule can be matched by the notification policy and alerts can be generated. The alert events may also be matched by other notification policies that use fuzzy match, and alerts may be generated. One or more alert events can be matched by one or more notification policies.

    • Select Do Not Specify Notification Policy from the Specify Notification Policy drop-down list.

    • Select a notification policy that you create.

      Note

      You can click Create Notification Policy to create a notification policy. For more information, see Create and manage a notification policy.

    Do Not Specify Notification Policy

    Advanced Settings

    Alert Check Cycle

    Specify the interval at which the alert rule is triggered to check whether the data meets the alert condition. Default value: 1. Minimum value: 1. Unit: minutes.

    1 Minutes

    Check after the data is complete

    Specify whether to perform an alert check after data is collected, transmitted, and written to the storage. By default, Yes is selected. In most cases, you do not need to modify this parameter.

    Yes

    Tags

    Specify tags for the alert rule. The specified tags can be used to match notification policies.

    None

    Annotations

    Specify annotations for the alert rule.

    None

  8. Then, click Completed.

CloudMonitor console

  1. Log on to the CloudMonitor console.

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

  3. On the Alert Rules page, click Create Alert Rule.

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

    Parameter

    Description

    Product

    Select a value based on your ApsaraDB for ClickHouse cluster. Valid values:

    • ClickHouse: This value is selected if your ApsaraDB for ClickHouse Community-compatible Edition cluster was purchased before December 1, 2021.

    • ClickHouse Community-compatible Edition: This value is selected if your ApsaraDB for ClickHouse Community-compatible Edition cluster was purchased after December 1, 2021.

    Resource Range

    The range of resources to which you want to apply the alert rule. Valid values:

    • All Resources: The alert rule applies to all resources of the specified cloud service.

    • Application Groups: The alert rule applies to all resources in the specified application group of the specified cloud service.

    • Instances: The alert rule applies to the specified resources of the specified cloud service.

    Rule Description

    The content of the alert rule. If a metric meets the specified condition, an alert is triggered. To specify a condition, perform the following steps:

    1. Click Add Rule.

    2. In the Configure Rule Description panel, enter a rule name in Alert Rule and then configure the Metric Type parameter. Valid values of the Metric Type parameter:

      • Single Metric: Select a metric and set the threshold and alert level for the metric.

      • Multiple Metrics: Select an alert level and specify alert conditions for two or more metrics.

      • Dynamic Threshold: For more information about dynamic thresholds, see Overview and Create dynamic threshold-triggered alert rules.

        Note

        The dynamic threshold feature is in invitational preview. To use the feature, submit a ticket.

    3. Click OK.

    Note

    For more information about how to specify complex alert conditions, see Alert rule expressions.

    Mute For

    The interval at which CloudMonitor resends alert notifications if the alert is not 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 sends alert notifications based on the alert rule only within the effective period.

    Note

    If an alert rule is not effective, no alert notification is sent. However, the alert record is still displayed on the Alert History tab.

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

    Tag

    Specify tags for the alert rule. A tag consists of a tag key and a tag value.

    Note

    You can set a maximum of six tags.

    Advanced Settings

    Alert Callback

    Specify the callback URL that can be accessed over the Internet. CloudMonitor sends POST requests to push alert notifications to the specified callback URL. Only the HTTP protocol is supported. For information about how to configure an alert callback, see Use the alert callback feature to send notifications about threshold-triggered alerts.

    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 based on the alert rule. In this case, you must configure the Region, ESS Group, and ESS Rule parameters.

    Simple Log Service

    If you turn on Simple Log Service, the alert information is sent to the specified Logstore when an alert is triggered based on the alert rule. 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.

    Simple Message Queue(formerly MNS) - topic

    If you turn on Simple Message Queue(formerly MNS) - topic, the alert information is sent to the specified topic in Simple Message Queue (formerly MNS) when an alert is triggered based on the alert rule. In this case, you must configure the Region and topicName parameters.

    For more 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 based on the alert rule. In this case, you must configure the Region, Service, and Function parameters.

    For more 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

    Specify how to handle alerts when no monitoring data is found. Valid values:

    • Do not do anything (default)

    • Send alert notifications

    • Treated as normal

(Optional) Procedure in the old console

  1. Log on to the ApsaraDB for ClickHouse console.

  2. In the top navigation bar, select the region where the cluster is deployed.

  3. On the Clusters page, click the Default Instances tab, find the cluster that you want to manage, and then click the ID of the cluster.

  4. In the left-side navigation pane, click Monitoring Details.

  5. In the upper-right corner, click Alert Monitoring.

  6. In the left-side navigation pane of the CloudMonitor console, choose Alerts > Alert Rules.

  7. On the Threshold Value Alert tab, click Create Alert Rule.

  8. On the Create Alert Rule page, configure the following parameters.

    1. In the Relate Resource section, configure the following parameters.

      Parameter

      Description

      Product

      Select Clickhouse from the drop-down list.

      Resource Range

      • All Resources: If you set this parameter to All Resources and a cluster in ApsaraDB for ClickHouse meets the conditions specified in Rule Description, the system sends alert notifications.

      • Cluster: If you set this parameter to Cluster and the selected clusters meet the conditions specified in Rule Description, the system sends alert notifications.

      Region

      This parameter is required if you set the Resource Range parameter to Cluster.

      Select the region where the cluster for which you want to set the alert rule is deployed.

      Cluster

      This parameter is required if you set the Resource Range parameter to Cluster.

      Select the ID of the cluster. You can select multiple cluster IDs.

    2. Configure the alert rule. For more information about how to configure an alert rule, see Create an alert rule.

    3. Configure a notification method for the alert rule.

      Note

      You must create a contact group before you configure an alert rule. For more information about how to create a contact group, see Create an alert contact or alert contact group.

  9. After the preceding parameters are configured, click Confirm. The alert rule automatically takes effect.

What to do next

For more information about how to manage alert rules that are configured by using the ApsaraDB for ClickHouse console, see Manage alert rules.

References

For more information about CloudMonitor, see What is CloudMonitor?