Manage contacts

Updated at:

When a matching rule in a notification policy is triggered, SAE sends notifications to the contacts that you specify. This topic describes how to configure contacts, contact groups, and DingTalk chatbots, and how to get a DingTalk chatbot webhook URL to create webhook alerts.

Contacts

Create a contact

  1. In the SAE application list, select the target region and namespace at the top of the page, and then click the target Application ID to go to the application details page.

  2. In the left-side navigation pane, choose .

  3. On the Notification Object page, click the Contacts tab, and then click Create Contact.

  4. In the Create Contact dialog box, configure the parameters and click OK.

    Parameter

    Description

    Name

    Specify a name for the contact.

    Phone number

    Enter a phone number for the contact to receive alert notifications by phone call and text message.

    Note

    You can use only verified phone numbers for phone call notifications in a notification policy. For more information about how to verify a phone number, see Verify a phone number.

    Email

    Enter an email address for the contact to receive alert notifications by email.

    Contact group

    Select the contact group to which you want to add the contact. For information about how to create a contact group, see Contact groups.

    Resend type for failed phone notifications

    Select a method to resend notifications if a phone call fails. You can set a global default on the Contacts tab. For more information, see Configure default settings for contacts.

    User ID

    The user ID helps the system distinguish between different users and facilitates data processing, information queries, or other operations.

    Note
    • You must provide either a phone number or an email address. You can use each phone number or email address for only one contact.

    • To create a DingTalk chatbot, go to the DingTalk/Lark/WeCom tab. For more information, see DingTalk chatbot.

    After you create a contact, you can search for, edit, or delete the contact on the Contacts tab.

Verify a phone number

You can use only verified phone numbers for phone call notifications in a notification policy.

  1. In the SAE application list, select the target region and namespace at the top of the page, and then click the target Application ID to go to the application details page.

  2. In the left-side navigation pane, choose .

  3. On the Notification Object page, click the Contacts tab to verify the phone numbers of one or more contacts.

    • To verify the phone number of a single contact, click Not Verified to the right of the unverified phone number.

    • To verify the phone numbers of multiple contacts, select the contacts and click Batch Verify.

    The system sends a verification text message to each selected contact.

  4. Open the link from the text message in a browser.

    验证手机号短信

  5. On the verification page, confirm the phone number and click Verify.

Configure default settings

If a phone call notification fails, you can configure how to resend it.

  1. In the SAE application list, select the target region and namespace at the top of the page, and then click the target Application ID to go to the application details page.

  2. In the left-side navigation pane, choose .

  3. On the Notification Object page, click the Contacts tab and choose .

  4. In the dialog box that appears, select a resend type and click OK.

Contact groups

When you create a notification policy, you can specify a contact group as the notification object. When a matching rule in the policy is triggered, SAE alert management sends alert notifications to the contacts in the group by phone, text message, email, or DingTalk.

Prerequisites

A contact is created. For more information, see Create a contact.

Create a contact group

  1. In the SAE application list, select the target region and namespace at the top of the page, and then click the target Application ID to go to the application details page.

  2. In the left-side navigation pane, choose .

  3. On the Notification Object page, click the Contacts tab, and then click Create Contact Group.

  4. In the Create Contact Group dialog box, enter a Group Name, select Alert Contacts, and then click OK.

    After the contact group is created, it appears in the list on the left side of the Contacts tab.

Manage contact groups

After you create a contact group, you can search for, edit, or delete the contact group on the Contacts tab.

  • To edit a contact group, find the group and choose 更多图标 . In the dialog box that appears, modify the group name or the contacts in the group, and then click OK.

  • To view the details of a contact group, click the Down arrow icon to the left of the group to expand it.

  • To delete a contact group, find the group and choose 更多图标 . In the confirmation message that appears, click OK.

    Important
    • Before you delete a contact group, make sure it is not added to any notification policy. Otherwise, alert notifications may fail.

    • You can delete only the contact groups that you created.

DingTalk chatbot

After you create a DingTalk chatbot for alert notifications in SAE, you can specify the corresponding DingTalk group in a notification policy to receive alerts. When the policy's rules are triggered, the system automatically sends an alert notification to the specified DingTalk group. You can then manage the alerts directly within the DingTalk group.

Create a DingTalk group in the console

  1. Create a custom chatbot in a DingTalk group and get its webhook URL. For more information, see Get the webhook URL of a DingTalk chatbot.

  2. In the SAE application list, select the target region and namespace at the top of the page, and then click the target Application ID to go to the application details page.

  3. In the left-side navigation pane, choose . On the Notification Object page, click the DingTalk/Lark/WeCom tab, and then click the DingTalk card.

  4. In the Create DingTalk Chatbot panel, configure the settings and click OK.

    Note

    To receive alert notifications in a DingTalk group, set Notification Method to DingTalk in your notification policy. For more information, see Notification policies.

    Parameter

    Description

    Name

    Specify a name for the DingTalk chatbot.

    Signature key

    Optional. If you configure a signature key, DingTalk authenticates requests by using a signature. If you do not, the system uses a keyword whitelist for authentication by default. The whitelist keyword is alert. For more information, see the official DingTalk documentation.

    Chatbot webhook URL

    Enter the chatbot webhook URL.

    Send daily statistics

    If you select this option, you must specify the times of day to send the statistics report. Use commas (,) to separate multiple times. Specify each time in the HH:MM format. At the specified times, alert management sends a summary of the total number of alerts generated, resolved, and pending for the day.

    Card content configuration

    Customize the style and content of the alert notification card.

Manage alerts in a DingTalk group

After you receive an alert notification in a DingTalk group, you can view and manage the alert directly within the group. For more information, see Process alerts in an alert notification group.

Get a DingTalk chatbot webhook URL

Before you can configure a DingTalk group or a contact to receive notifications, you must first create a custom chatbot within DingTalk and get its webhook URL.

  1. On your PC, open the DingTalk group where you want to add the alert chatbot, and click the group settings icon in the upper-right corner.

  2. In the Group Settings panel, click Robot, and then click Add Robot.

  3. In the Intelligent Group Assistant panel, click Add Robot, click Add Robot again, and then select Custom.

  4. In the BOTs dialog box, click the settings icon in the Add Robot area, and then select Custom.

  5. In the Robot Details dialog box, click Add.

  6. In the Add Robot dialog box, perform the following steps.

    1. Set a profile picture and a name for the chatbot.

    2. For Security Settings, select Custom Keywords and set the keyword to SAE.

    3. Select the I have read and accepted <<DingTalk Custom Robot Service Terms of Service>> checkbox.

    4. Click Finish.

    Note

    For more information about DingTalk chatbots, see Custom robot access.

  7. In the Add Robot dialog box, copy the generated webhook URL, and then click Finish.

    You can use the generated webhook URL as a contact's notification method and for subscription rules in the event center. For more information, see Manage contacts and Event center.

Customize alert contacts with a webhook

You can send webhook alerts to groups in services like Lark, WeCom, and DingTalk. This topic uses Lark as an example to show how to create a webhook alert.

Step 1: Get a webhook URL

  1. Open and log in to Lark.

  2. Click the + icon, and then click Create Group to create a new group for sending alerts.

  3. Click the group settings icon, click the BOTs tab, and then on the BOTs tab, click Add Bot.

  4. In the Add Bot panel, select Custom Bot. On the configuration page, enter a Bot name and Description, and then click Add.

  5. Copy the webhook URL. Then, select Custom Keywords, enter alert as the keyword, and click Finish.

Step 2: Create a webhook contact

  1. In the SAE application list, select the target region and namespace at the top of the page, and then click the target Application ID to go to the application details page.

  2. In the left-side navigation pane, choose .

  3. On the Notification Object page, click the Webhook Integration tab, and then click Create Webhook.

  4. In the Create Webhook dialog box, configure the following parameters and click OK.

    After you configure the settings, you can click Send Test to verify the configuration before you click OK.

    Parameter

    Description

    Webhook name

    Specify a name for the webhook.

    Post/Get

    Select the request method. In the text box, enter the webhook URL, which cannot exceed 100 characters.

    In this example, select Post and paste the webhook URL that you copied in Step 1: Get a webhook URL into the text box.

    Header/Param

    Set the request header. The value cannot exceed 200 characters in length. Click Add to include other header or parameter information. The default request header is Content-Type: text/plain; charset=UTF-8. The total number of headers and parameters cannot exceed six.

    In this example, set the following two Header fields:

    • Arms-Content-Type : json

    • Content-Type : application/json

    Notification template

    The template for alert notifications. This parameter is available only if you set the request method to Post. You can use the $content placeholder to output the notification content. The template cannot exceed 500 characters in length. For more information, see Configure notification templates and webhook templates.

    The following code provides a notification template:

    {
    "Alert Name":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}",
    "Cluster Name":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}",
    "Application Name":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}",
    "Notification Policy":"{{ .dispatchRuleName }}",
    "Alert Time":"{{ .startTime }}",
    "Alert Content":"{{ for .alerts }} {{ .annotations.message }} {{ end }}"
    }

    This example uses Lark. You can use the following text format:

    {
      "msg_type": "text",
      "content": {
        "text": "Alert Name: {{ .commonLabels.alertname }}\n{{if .commonLabels.clustername }}Cluster Name: {{ .commonLabels.clustername }}\n{{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}Application Name: {{ .commonLabels._aliyun_arms_involvedObject_name }}\n{{ end }}Notification Policy: {{ .dispatchRuleName }} \nAlert Time: {{ .startTime }} \nAlert Content: {{ for .alerts }} {{ .annotations.message }}\n {{ end }}"
      }
    }

    Recovery template

    The template for recovery notifications. This parameter is available only if you set the request method to Post. You can use the $content placeholder to output the notification content. The template cannot exceed 500 characters in length. For more information, see Configure notification templates and webhook templates.

    The following code provides a recovery template:

    {
    "Alert Name":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}",
    "Cluster Name":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}",
    "Application Name":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}",
    "Notification Policy":"{{ .dispatchRuleName }}",
    "Recovery Time":"{{ .endTime }}",
    "Alert Content":"{{ for .alerts }} {{ .annotations.message }} {{ end }}"
    }

    This example uses Lark. You can use the following text format:

    {
      "msg_type": "text",
      "content": {
        "text": "Alert Name: {{ .commonLabels.alertname }}\n{{if .commonLabels.clustername }}Cluster Name: {{ .commonLabels.clustername }}\n{{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}Application Name: {{ .commonLabels._aliyun_arms_involvedObject_name }}\n{{ end }}Recovery Time: {{ .startTime }} \nNotification Policy: {{ .dispatchRuleName }} \nRecovered Alert Content: {{ for .alerts }} {{ .annotations.message }}\n {{ end }}"
      }
    }

Step 3: Configure a notification policy

Create or edit a notification policy, set Notification Object to Universal Webhook, and then select the corresponding webhook integration. For more information, see Notification policies.

Note

If the webhook does not respond within 5 seconds, the notification fails.