All Products
Search
Document Center

Server Load Balancer:Configure alert rules for NLB metrics

Last Updated:Feb 10, 2025

After activating the CloudMonitor service, you can configure alert rules for monitoring metrics of Network Load Balancer (NLB) instances via the CloudMonitor console, or through the CloudMonitor API or SDK.

Prerequisites

An NLB instance is created, and listeners and health checks are configured and enabled for it. For detailed instructions, see the following topics:

Configure alert rules through the CloudMonitor console

Create an alert rule

  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, set the parameters.

    The following table describes the key parameters. For other parameters, see Create an alert rule.

    Parameter

    Description

    Product

    Select the Alibaba Cloud service that you want to monitor. In this example, select Network Load Balancer (NLB).

    Resource Range

    Select the range of resources to which the alert rule applies. Valid values:

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

    • Application Groups: The alert rule applies to all resources within the specified application group of the specified Alibaba Cloud service.

    • Instances: The alert rule applies to the specified resource of the specified Alibaba Cloud service.

    Rule Description

    Specify the condition of the alert rule. An alert is triggered when the condition of the alert rule is met. Perform the following steps to configure the condition:

    1. Click Add Rule and select an appropriate metric type from the drop-down list. In this example, select Simple Metric.

    2. In the Configure Rule Description panel, set Alert Rule and the rule condition.

      1. Metric: Select a metric. For information about the NLB metrics, see NLB monitoring metrics.

      2. Threshold and Alert Level: Set the alert threshold for at least one of the three alert levels.

        The methods for sending notifications supported by the alert levels vary.

        • Critical: phone calls, SMS messages, emails, and webhooks

        • Warn: SMS messages, emails, and webhooks

        • Info: emails and webhooks

      3. For guidance on how to configure expressions for multi-metric alert rules, see Alert rule expressions.

  1. Click Confirm.

Other operations

On the Alert Rules page, you can also perform the following operations:

  • Modify alert rules

    1. On the Alert Rules page, find the alert rule that you want to modify and click Modify in the Actions column.

    2. In the Create Alert Rule panel, set the parameters.

  • Disable alert rules

    • Disable a single alert rule

      1. On the Alert Rules page, find the alert rule that you want to disable, click the 更多 icon in the Actions column, and then click Disable.

      2. In the Disable Alert Rule message, click OK.

    • Disable multiple alert rules at a time

      1. Select the alert rules that you want to disable and click Disable in the lower-left corner of the page.

      2. In the Disable Alert Rule message, click OK.

  • Enable alert rules

    • Enable a single alert rule

      1. On the Alert Rules page, find the alert rule that you want to enable, click the 更多 icon in the Actions column, and then click Enable.

      2. In the Enable Alert Rule message, click OK.

    • Enable multiple alert rules at a time

      1. Select the alert rules that you want to enable and click Enable in the lower-left corner of the page.

      2. In the Enable Alert Rule message, click OK.

  • Delete alert rules

    • Delete a single alert rule

      1. Find the alert rule that you want to delete, click the 更多 icon in the Actions column, and then click Delete.

      2. In the Delete Alert message, click OK.

    • Delete multiple alert rules at a time

      1. Select the alert rules that you want to delete and click Delete in the lower-left corner of the page.

      2. In the Delete Alert message, click OK.

  • View alert history

    On the Alert Rules page, find the alert rule whose historical alerts you want to view, and click Alert History in the Actions column.

    You can view the details, alert contact group, historical alerts, and resources of the alert rule.

Configure alert rules by the API

The following figure shows the procedure to configure alert rules by calling CloudMonitor API operations.

image
  1. Optional: Call the DescribeMetricMetaList operation to retrieve the descriptions of NLB time series metrics supported by CloudMonitor, or view the metric descriptions in NLB monitoring metrics.

  2. Call PutContact to create or modify an alert contact.

  3. Call PutContactGroup to create or modify an alert contact group.

  4. Call the PutResourceMetricRule operation to configure a threshold-based alert rule for a performance metric of a resource.

  5. Call the DescribeMetricRuleList operation to query existing alert rules.

DescribeMetricMetaList

Call the DescribeMetricMetaList operation to query the descriptions of NLB time series metrics available in CloudMonitor.

  1. Set the value of the Namespace parameter in the request to acs_nlb and keep the default values for other parameters.

  2. View the NLB time series metrics in the response. For more information about the response, visit OpenAPI Explorer.

PutContact

Call the PutContact operation to create or modify an alert contact.

  1. In the request parameters, set the name, description, and contact information of the alert contact.

    In this example, set the following parameters and use the default values for other parameters:

    • ContactName: custom name of the alert contact.

    • Describe: description of the alert contact.

    • Channels.Mail: email address of the alert contact. When you add or modify an email address, the recipient receives an email that contains an activation link. The system adds the recipient to the list of alert contacts only after the recipient clicks the link to activate the email address.

  2. Check whether the alert contact is created based on the value of the Success parameter in the response.

PutContactGroup

Call the PutContactGroup operation to create or modify an alert contact group.

  1. In the request parameters, set the name, description, and contact information of the alert contact group.

    In this example, configure the following parameters and use the default values for other parameters:

    • ContactGroupName: custom name of the alert contact group

    • Describe: description of the alert contact group

    • ContactNames: names of alert contacts in the group.

  2. Check whether the alert contact group is created based on the value of Success in the response.

PutResourceMetricRule

Call the PutResourceMetricRule operation to configure a threshold-based alert rule for a performance metric of a resource.

  1. In the request parameters, configure the threshold-based alert rule. Set key parameters as follows and set the other parameters based on your business requirements:

    • Namespace: Set the value to acs_nlb.

    • Resources: the resource to which the alert rule applies. Specify an NLB instance in the same format as [{"instanceId":"nlb-defs3vztfty3nm****"}].

  2. Check whether the alert rule is created based on the value of Success in the response.

DescribeMetricRuleList

Call the DescribeMetricRuleList operation to query existing alert rules.

  1. In the request parameters, set the namespace and metrics to view detailed information about alert rules for the metrics.

    In this example, set key parameters as follows and keep the default values for other parameters:

    • Namespace: Set the value to acs_nlb.

    • MetricName: Specify the NLB metrics to be queried.

  2. In the response, view the details of the metric alert rules configured in this example.

Configure alert rules through the CloudMonitor SDK

The following figure shows the procedure to configure alert rules by using the SDK.

image
  1. Optional: Call DescribeMetricMetaList to query the descriptions of NLB time series metrics supported by CloudMonitor, or view the metric descriptions in NLB monitoring metrics.

  2. Call PutContact to create or modify an alert contact.

  3. Call PutContactGroup to create or modify an alert contact group.

  4. Call PutResourceMetricRule to configure a threshold-based alert rule for a performance metric of a resource.

  5. Call the DescribeMetricRuleList operation to query existing alert rules.

For more information about the SDK, visit OpenAPI Explorer.

References