创建或修改Webhook告警联系人。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| WebhookId |
integer |
否 |
Webhook 告警联系人 ID。
|
123 |
| WebhookName |
string |
是 |
Webhook 告警联系人名称。 |
Webhook告警 |
| Method |
string |
是 |
HTTP 请求方法。
|
Post |
| Url |
string |
是 |
Method 的请求方法 URL。 |
https://oapi.dingtalk.com/robot/send?access_token=e1a049121****** |
| BizHeaders |
string |
否 |
HTTP 请求头。 |
[{"Content-Type":"application/json;charset=utf-8"}] |
| BizParams |
string |
否 |
HTTP 请求参数。 |
[{"content":"mike"}] |
| Body |
string |
否 |
告警触发时发送的通知模板,当 Method 设置为 Post 时必填,可使用 |
{ "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "告警时间":"{{ .startTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" } |
| RecoverBody |
string |
否 |
告警恢复时发送的通知模板,当 Method 设置为 Post 时必填,可使用 |
{ "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "恢复时间":"{{ .endTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" } |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| RequestId |
string |
请求 ID。 |
16AF921B-8187-489F-9913-43C808B4**** |
| WebhookContact |
object |
返回的 WebhookContact 对象。 |
|
| WebhookId |
number |
Webhook 告警联系人 ID。 |
123 |
| WebhookName |
string |
Webhook 告警联系人名称。 |
Webhook告警 |
| Webhook |
object |
返回的 Webhook 对象。 |
|
| Method |
string |
HTTP 请求方法。
|
Post |
| Url |
string |
请求方法 URL。 |
https://oapi.dingtalk.com/robot/send?access_token=e1a049121****** |
| BizHeaders |
string |
HTTP 请求头。 |
[{"Content-Type":"application/json;charset=utf-8"}] |
| BizParams |
string |
HTTP 请求参数。 |
[{"content":"mike"}] |
| Body |
string |
告警通知模板。 |
{ "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "告警时间":"{{ .startTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" } |
| RecoverBody |
string |
告警恢复模板。 |
{ "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "恢复时间":"{{ .endTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" } |
示例
正常返回示例
JSON格式
{
"RequestId": "16AF921B-8187-489F-9913-43C808B4****",
"WebhookContact": {
"WebhookId": 123,
"WebhookName": "Webhook告警",
"Webhook": {
"Method": "Post",
"Url": "https://oapi.dingtalk.com/robot/send?access_token=e1a049121******",
"BizHeaders": "[{\"Content-Type\":\"application/json;charset=utf-8\"}]",
"BizParams": "[{\"content\":\"mike\"}]",
"Body": "{ \"告警名称\":\"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}\", \"集群名称\":\"{{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\", \"应用名称\":\"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\", \"通知策略\":\"{{ .dispatchRuleName }}\", \"告警时间\":\"{{ .startTime }}\", \"告警内容\":\"{{ for .alerts }} {{ .annotations.message }} {{ end }}\" }",
"RecoverBody": "{ \"告警名称\":\"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}\", \"集群名称\":\"{{ .commonLabels.clustername }} {{ end }}{{if eq \"app\" .commonLabels._aliyun_arms_involvedObject_kind }}\", \"应用名称\":\"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}\", \"通知策略\":\"{{ .dispatchRuleName }}\", \"恢复时间\":\"{{ .endTime }}\", \"告警内容\":\"{{ for .alerts }} {{ .annotations.message }} {{ end }}\" }"
}
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。