文档

CreateOrUpdateWebhookContact - 创建或修改Webhook告警联系人

更新时间:

创建或修改Webhook告警联系人。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
arms:CreateContactWrite
  • 全部资源
    *

请求参数

名称类型必填描述示例值
WebhookIdlong

Webhook 告警联系人 ID。

  • 不填代表创建新的 Webhook 告警联系人。
  • 填写代表修改指定 Webhook 告警联系人信息。
123
WebhookNamestring

Webhook 告警联系人名称。

Webhook告警
Methodstring

HTTP 请求方法。

  • Post

  • Get

Post
Urlstring

Method 的请求方法 URL。

https://oapi.dingtalk.com/robot/send?access_token=e1a049121******
BizHeadersstring

HTTP 请求头。

[{"Content-Type":"application/json;charset=utf-8"}]
BizParamsstring

HTTP 请求参数。

[{"content":"mike"}]
Bodystring

告警触发时发送的通知模板,当 Method 设置为 Post 时必填,可使用$content占位符输出通知内容,不可超过 500 个字符。更多信息,请参见通知模板的变量说明

{ "告警名称":"{{ .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 }}" }
RecoverBodystring

告警恢复时发送的通知模板,当 Method 设置为 Post 时必填,可使用$content占位符输出通知内容,不可超过 500 个字符。更多信息,请参见通知模板的变量说明

{ "告警名称":"{{ .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

RequestIdstring

请求 ID。

16AF921B-8187-489F-9913-43C808B4****
WebhookContactobject

返回的 WebhookContact 对象。

WebhookIdfloat

Webhook 告警联系人 ID。

123
WebhookNamestring

Webhook 告警联系人名称。

Webhook告警
Webhookobject

返回的 Webhook 对象。

Methodstring

HTTP 请求方法。

  • Post

  • Get

Post
Urlstring

请求方法 URL。

https://oapi.dingtalk.com/robot/send?access_token=e1a049121******
BizHeadersstring

HTTP 请求头。

[{"Content-Type":"application/json;charset=utf-8"}]
BizParamsstring

HTTP 请求参数。

[{"content":"mike"}]
Bodystring

告警通知模板。

{ "告警名称":"{{ .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 }}" }
RecoverBodystring

告警恢复模板。

{ "告警名称":"{{ .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 }}\" }"
    }
  }
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史
  • 本页导读 (1)
文档反馈