Create a webhook alert
Send alert notifications to a custom webhook address. Prometheus supports webhook alerts to groups in applications such as Lark, WeChat, and DingTalk. This topic uses Lark as an example.
Step 1: Generate a webhook link
-
Open and log on to Lark.
-
Click the + icon, and then click Create Group to create a new group for sending alerts.
-
Click the group settings icon, and then click the Group Bot tab.
-
On the Group Bot tab, click Add Bot.

-
In the Add Bot panel, select Custom Bot.

-
On the configuration page, set the display name and description, and then click Add.

-
Click Copy to save the webhook address from the Addition Status area, and then click Done.

Step 2: Create a webhook alert
Log on to the Managed Service for Prometheus console.
-
In the navigation pane on the left, choose .
-
On the Contacts tab, click Create Webhook in the upper-right corner.
-
In the Create Webhook dialog box, enter the configuration information.
The following table describes the basic parameters.
Parameter
Description
Webhook Name
Required. The custom name of the webhook.
Post and Get
Required. The request method. The URL cannot exceed 100 characters.
In this example, select Post, and paste the webhook address that you saved in Step 1: Generate a webhook link into the text box on the right.
Header and Param
Optional. The request header, which cannot exceed 200 characters. Click Add to add more headers or parameters. The default request header is Content-Type: text/plain; charset=UTF-8. You can specify up to six headers and parameters in total.
In this example, set the following two Headers:
-
Arms-Content-Type : json
-
Content-Type : application/json
Body
Optional. Available only when the request method is Post. Use the $content placeholder in the Body string to include the alert content. The string cannot exceed 500 characters.
In this example, set the alert text format as follows:
{"msg_type": "text","content": {"text": "$content"}} -
-
Optional: Click Test to verify that the configuration is successful.
-
Click Create.
Step 3: Set a notification recipient
Create or edit a dispatch rule. Set Recipient to the webhook contact that you added. In the Notification Method area, select WebHook. For more information, see Notification policies.
The webhook alert has a timeout period of 5 seconds. If no response is received within 5 seconds after the request is sent, the alert fails to be delivered.