diff --git a/docs/configs/docsdev.js b/docs/configs/docsdev.js index 1364b7dce7..879590ba2d 100644 --- a/docs/configs/docsdev.js +++ b/docs/configs/docsdev.js @@ -245,6 +245,11 @@ export default { title: 'Script', link: '/en-us/docs/dev/user_doc/guide/alert/script.html', }, + , + { + title: 'Http', + link: '/en-us/docs/dev/user_doc/guide/alert/http.html', + }, ], }, { @@ -567,6 +572,10 @@ export default { title: '脚本告警', link: '/zh-cn/docs/dev/user_doc/guide/alert/script.html', }, + { + title: 'Http告警', + link: '/zh-cn/docs/dev/user_doc/guide/alert/http.html', + }, ], }, { diff --git a/docs/docs/en/guide/alert/http.md b/docs/docs/en/guide/alert/http.md new file mode 100644 index 0000000000..9174fafbd8 --- /dev/null +++ b/docs/docs/en/guide/alert/http.md @@ -0,0 +1,34 @@ +# HTTP + +If you need to use `Http script` for alerting, create an alert instance in the alert instance management and select the `Http` plugin. + +## Parameter Configuration + +* URL + > The `Http` request URL needs to contain protocol, host, path and parameters if the method is `GET` +* Request Type + > Select the request type from `POST` or `GET` +* Headers + > The headers of the `Http` request in JSON format +* Body + > The request body of the `Http` request in JSON format, when using `POST` method to alert +* Content Field + > The field name to place the alert information + +## Send Type + +Using `POST` and `GET` method to send `Http` request in the `Request Type`. + +### GET Http + +Send alert information by `Http` GET method. +The following shows the `GET` configuration example: + +![enterprise-wechat-app-msg-config](/img/alert/http-get-example.png) + +### POST Http + +Send alert information inside `Http` body by `Http` POST method. +The following shows the `POST` configuration example: + +![enterprise-wechat-app-msg-config](/img/alert/http-post-example.png) \ No newline at end of file diff --git a/docs/docs/zh/guide/alert/http.md b/docs/docs/zh/guide/alert/http.md new file mode 100644 index 0000000000..dd124df95b --- /dev/null +++ b/docs/docs/zh/guide/alert/http.md @@ -0,0 +1,34 @@ +# HTTP告警 + +如果您需要使用到`Http`(GET或POST)进行告警,请在告警实例管理里创建告警实例,选择`Http`插件。 + +## 参数配置 + +* URL + > 访问的`Http`连接URL,需要包含协议、Host、路径,如果是GET方法可以添加参数 +* 请求方式 + > 选择该请求为POST或GET方法 +* 请求头 + > `Http`请求的完整请求头,以JSON为格式 +* 请求体 + > `Http`请求的完整请求体,以JSON为格式,GET方法不需要写该参数 +* 内容字段 + > 放置本次告警告警信息的字段名称 + +## 发送类型 + +其中`Request Type`分别对应使用`POST`方法和`GET`方法进行`Http`告警。 + +### GET Http告警 + +GET `Http`告警指将告警结果作为参数通过`Http` GET方法进行请求。 +下图是GET告警配置的示例: + +![enterprise-wechat-app-msg-config](/img/alert/http-get-example.png) + +### POST Http告警 + +POST `Http`告警指将告警结果作为`BODY`参数通过`Http`POST方法进行请求。 +下图是POST告警配置的示例: + +![enterprise-wechat-app-msg-config](/img/alert/http-post-example.png) diff --git a/docs/img/alert/http-get-example.png b/docs/img/alert/http-get-example.png new file mode 100644 index 0000000000..a6c29b48c9 Binary files /dev/null and b/docs/img/alert/http-get-example.png differ diff --git a/docs/img/alert/http-post-example.png b/docs/img/alert/http-post-example.png new file mode 100644 index 0000000000..5cf0d3e64d Binary files /dev/null and b/docs/img/alert/http-post-example.png differ diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java index 646c7b02ae..c18ebe4454 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java @@ -55,7 +55,7 @@ public final class HttpAlertChannelFactory implements AlertChannelFactory { InputParam bodyParams = InputParam.newBuilder(HttpAlertConstants.NAME_BODY_PARAMS, HttpAlertConstants.BODY_PARAMS) .setPlaceholder("input request body as JSON format ") .addValidate(Validate.newBuilder() - .setRequired(true) + .setRequired(false) .build()) .build();