DAS provides the slow SQL query alerting feature. When the number of slow SQL queries exceeds the threshold, alert messages are sent to you by SMS, email, or DingTalk.
- The slow SQL query alerting feature is available only for MySQL and MongoDB databases.
- DAS is connected to the database instance. For more information, see Access other self-managed database instances.
- The slow query log analysis feature is enabled for the database instance. For more information, see Analyze slow query logs.
- Log on to the DAS console.
- In the left-side navigation pane, choose Alert Service > Alert Rules.
- On the Alert Rules page, click Add Rule in the upper-right corner.
- In the Alert Rule dialog box, configure the parameters and click OK.
Parameter Description Rule Name The name of the alert rule. Set the rule name to Alert rule for slow SQL queries. Type The type of the alert. In this example, set Type to Threshold Alert. Description The description of the alert rule. In this example, select Slow SQL Count per Hour(MySQL) or Slow Request Counts per Hour(MongoDB) and set the threshold. Alert Interval The interval at which alerts are sent when the alert rule is triggered. Effective Time The time when the alert rule takes effect. Notification Method The method to send alerts, which can be SMS, DingTalk chatbot, or email.
- After you create the alert rule, choose Alert Service > Alert Templates in the left-side navigation pane.
- On the Alert Templates page, click Create Template in the upper-right corner.
- In the Create Template dialog box, configure the following parameters and click OK.
Parameter Description Template Name The name of the alert template. Template Type The type of the alert template. Set the template type to Database Resource Template. Select Rule The alert rule. Select the created alert rule from the left section and click the right arrow to add it to the right section. In this example, select Alert rule for slow SQL queries. Alert Contact The contact to which the alert notifications are sent. Select an alert contact from the Existing Contact Group list or create a contact group as an alert contact. For more information, see Manage alert contacts.