您只需要在 Slack 中新增应用的 Webhook 地址,并在告警通知模板配置该地址,即可使用 Slack 群接收告警通知。
步骤1:添加应用获取 Webhook 地址
说明:
新用户或者账号第一次登录需要创建工作室和 create an app 。
1. 进入 Slack 应用管理页。
2. 单击右上角的 Create New App,并选择 From scratch 方式创建。
3. 在配置页面填写应用名称,并选择对应的 Slack Workspace 创建一个 Slack APP。
4. 在应用管理页面左侧菜单栏中,选择 Incoming Webhooks 并单击右上角的开启。
5. 滑动到子窗口底部,单击 Add New Webhook to Workspace。
![](https://qcloudimg.tencent-cloud.cn/image/document/fac1f27fc4753a7f3eeddebe77c0076f.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/fac1f27fc4753a7f3eeddebe77c0076f.png)
6. 在配置页面中选择对应的应用,并单击 allow。
7. 在跳转框中复制 Webhook 地址。
![](https://qcloudimg.tencent-cloud.cn/image/document/1c180702da0a9f5062862649e0b9436c.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/1c180702da0a9f5062862649e0b9436c.png)
步骤2:配置告警接口回调
1. 进入 腾讯云可观测平台 > 告警管理 > 基础配置 > 通知模板 页面。
2. 单击新建通知模板,进入新建通知模板。
3. 在新建通知模板页配置完基础信息后,在接口回调处填写复制好的 webhook 地址。
4. 若需要提醒群成员查看告警通知,可填写对应群成员 userid,多个 userid 可用逗号分隔。若不需要提醒群成员,则不需要填写该字段。群成员 userid 获取方式请参考 获取群成员 userid。
说明:
目前只有企业微信、钉钉、飞书、Slack 渠道支持提醒群成员查看功能,用户在填写完接口 URL 后,系统才会根据接口对应渠道展示提醒对象框。
![](https://qcloudimg.tencent-cloud.cn/image/document/83ccd9ded5246b5f3d3f3cf86b041711.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/83ccd9ded5246b5f3d3f3cf86b041711.png)
5. 进入 告警管理 > 策略管理,单击需要绑定告警回调的策略名称,进入策略管理页,并在告警策略页绑定通知模板。
![](https://qcloudimg.tencent-cloud.cn/image/document/32e7fd486eb52764a5a9fe8dab4b1560.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/32e7fd486eb52764a5a9fe8dab4b1560.png)
6. 配置成功后,当告警策略被触发或恢复时,您可以在 Slack 群接收到腾讯云可观测平台发送的告警通知,如下图所示:
![](https://qcloudimg.tencent-cloud.cn/image/document/dd29ad17af2b00878fa375ccf2c6122e.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/dd29ad17af2b00878fa375ccf2c6122e.png)
获取群成员 userid
![](https://qcloudimg.tencent-cloud.cn/image/document/986e2e5424815247d9be74038749e3a6.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/986e2e5424815247d9be74038749e3a6.png)
2、点击![](https://qcloudimg.tencent-cloud.cn/image/document/3bd8dc17baed8037f75ed8dd76a87a68.png)
,点击复制成员 ID后,用户 ID 将复制到粘贴板。
![](https://qcloudimg.tencent-cloud.cn/image/document/3bd8dc17baed8037f75ed8dd76a87a68.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/01c7922231abcdf57498ee7bcb20a958.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/01c7922231abcdf57498ee7bcb20a958.png)