Add the webhook URL of a DingTalk chatbot to an alert contact to receive alert notifications in a DingTalk group when a resource metric triggers an alert.
Prerequisites
Ensure you have an alert contact. For more information, see Create an alert contact or an alert contact group.
This tutorial supports one-click deployment. You can run the sample code in Terraform Explorer to complete the deployment.Run with one click
Step 1: Create a DingTalk chatbot
To create a DingTalk chatbot, see Steps 1, 3, 4, 5, and 6 in Create a DingTalk chatbot.
NoteAs of September 1, 2023, you can no longer create custom chatbots in non-enterprise DingTalk groups. This change does not affect existing custom chatbots.
When you create the chatbot, add the following keywords one by one: Monitor, ECS, and Alert.
The DingTalk chatbot webhook was gradually commercialized starting January 1, 2024, and became a fully paid feature on February 1. The service includes a free monthly quota of 5,000 calls. For more information, see Announcement of commercialization of Webhook and Stream.
Activate the Alibaba Cloud Mini Program in the DingTalk app marketplace to receive free alert notifications in DingTalk. Click Activate Now.
Step 2: Add webhook to alert contact
Add the webhook URL of the DingTalk chatbot to an alert contact.
-
Log on to the Cloud Monitor console.
In the left-side navigation pane, choose .
On the Alert Contacts tab, find the alert contact to edit and click Edit in the Actions column.
In the Set Alert Contact panel, enter the webhook URL of the DingTalk chatbot.
To test connectivity to your alert callback URL, do the following.
Click Test, located directly to the right of the callback URL.
In the WebHook Test panel, use the HTTP status code and test result details to verify and troubleshoot connectivity to your alert callback URL.
NoteYou can also set the Test Template Type: and Language:. Then click Test again to view updated test results.
Click Close.
After you verify the information, click Confirm.
Step 3: Create an alert contact group
Add the target alert contact to an alert contact group.
-
Log on to the Cloud Monitor console.
In the left-side navigation pane, choose .
Click the Alert Contact Group tab.
On the Alert Contact Group tab, click Create Alert Contact Group.
In the Create Alert Contact Group panel, enter a name for the alert contact group and select the target alert contact.
Click Confirm.
Step 4: Create an alert rule
Set an alert condition for the metrics of a resource and select the alert contact group.
See Create an alert rule for more information.
Step 5: View alert notifications
When a metric triggers an alert rule, the DingTalk group receives an alert notification.