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
Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
On the Alert Rules page, click Create Alert Rule.
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:
Click Add Rule and select an appropriate metric type from the drop-down list. In this example, select Simple Metric.
In the Configure Rule Description panel, set Alert Rule and the rule condition.
Metric: Select a metric. For information about the NLB metrics, see NLB monitoring metrics.
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
For guidance on how to configure expressions for multi-metric alert rules, see Alert rule expressions.
Click Confirm.
Other operations
On the Alert Rules page, you can also perform the following operations:
Modify alert rules
On the Alert Rules page, find the alert rule that you want to modify and click Modify in the Actions column.
In the Create Alert Rule panel, set the parameters.
Disable alert rules
Disable a single alert rule
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. In the Disable Alert Rule message, click OK.
Disable multiple alert rules at a time
Select the alert rules that you want to disable and click Disable in the lower-left corner of the page.
In the Disable Alert Rule message, click OK.
Enable alert rules
Enable a single alert rule
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. In the Enable Alert Rule message, click OK.
Enable multiple alert rules at a time
Select the alert rules that you want to enable and click Enable in the lower-left corner of the page.
In the Enable Alert Rule message, click OK.
Delete alert rules
Delete a single alert rule
Find the alert rule that you want to delete, click the
icon in the Actions column, and then click Delete. In the Delete Alert message, click OK.
Delete multiple alert rules at a time
Select the alert rules that you want to delete and click Delete in the lower-left corner of the page.
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.
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.
Call PutContact to create or modify an alert contact.
Call PutContactGroup to create or modify an alert contact group.
Call the PutResourceMetricRule operation to configure a threshold-based alert rule for a performance metric of a resource.
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.
Set the value of the Namespace parameter in the request to acs_nlb and keep the default values for other parameters.
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.
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.
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.
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.
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.
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****"}].
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.
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.
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.
Optional: Call DescribeMetricMetaList to query the descriptions of NLB time series metrics supported by CloudMonitor, or view the metric descriptions in NLB monitoring metrics.
Call PutContact to create or modify an alert contact.
Call PutContactGroup to create or modify an alert contact group.
Call PutResourceMetricRule to configure a threshold-based alert rule for a performance metric of a resource.
Call the DescribeMetricRuleList operation to query existing alert rules.
For more information about the SDK, visit OpenAPI Explorer.