Simple Log Service provides built-in alert rule templates for PolarDB. If you want to monitor a PolarDB cluster in real time, you need to only create an alert rule from a template. Then, you can receive alert notifications such as DingTalk messages. This topic describes how to create an alert rule and the operations that you can perform after you create the rule.
Prerequisites
The data collection feature is enabled for PolarDB for MySQL audit logs. For more information, see Enable data collection.
Step 1: Configure an action policy
Log on to the Simple Log Service console.
In the Log Application section, click the Cloud Service Lens tab. Then, click CloudLens for PolarDB.
In the left-side navigation pane, click Anomaly Detection.
On the Alert Center page, choose .
In the list of action policies, find the action policy whose ID is sls.app.polardb.builtin and click Edit in the Actions column.
You can also create an action policy to send alert notifications. For more information, see Create an action policy.
In the Edit Action Policy dialog box, change the value of the Request URL parameter to the webhook URL of your DingTalk chatbot. For other parameters, retain the default settings. Then, click Confirm.
For more information about how to obtain the webhook URL of a DingTalk chatbot, see DingTalk-Custom. You can configure other notification methods based on your business requirements. For more information, see Notification methods.
Step 2: Create an alert rule
Simple Log Service provides multiple built-in alert rule templates. You need to only select a template based on your business requirements and create an alert rule from the template. In this example, an alert rule is created from the PolarDB Frequent Visit IP Detection template.
On the Alert Rules tab, click the
icon to the right of Create Alert.
Click Create from Template.
In the Create from Template panel, choose
.Create an alert rule. For more information about how to reconfigure the parameters, see Create an alert rule.
After the alert rule is created, click PolarDB Frequent Visit IP Detection in the list of alert rules to view details of the rule. The rule is automatically enabled.
What to do next
After you create an alert rule, you can perform the following operations on the Alert Rules tab.
Operation | Description |
Operation | Description |
Disable an alert rule | If you disable an alert rule, the value in the Status column of the alert rule changes to Disabled, and alerts are no longer triggered based on the alert rule. The configurations of the alert rule are not deleted. If you want to enable the alert rule again, you do not need to reconfigure the parameters of the alert rule. |
Pause an alert rule | If you pause an alert rule, alerts are not triggered based on the alert rule within a specified period of time. |
Resume an alert rule | You can resume a paused alert rule based on your business requirements. |
Delete an alert rule | The configurations of the alert rule are deleted, such as the IDs of PolarDB clusters and threshold values. If you want to enable the alert rule again, you must reconfigure the parameters of the alert rule. |
Follow an alert rule | You can add an alert rule to the list that you follow. |
View alert details | You can view alert details on the Alert Overview page, including the general information of an alert rule and the historical alerts that are triggered based on the alert rule. |