Browse Source

[Bug] [Website-9764]add http alert doc and change body param to unnecessary (#9792)

* add http alert doc and change body param to unnecessary

* submit http en doc and fix doc

* fix http doc
3.0.0/version-upgrade
Tq 3 years ago committed by GitHub
parent
commit
7b0b4c126e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      docs/configs/docsdev.js
  2. 34
      docs/docs/en/guide/alert/http.md
  3. 34
      docs/docs/zh/guide/alert/http.md
  4. BIN
      docs/img/alert/http-get-example.png
  5. BIN
      docs/img/alert/http-post-example.png
  6. 2
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java

9
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',
},
],
},
{

34
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)

34
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)

BIN
docs/img/alert/http-get-example.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
docs/img/alert/http-post-example.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

2
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();

Loading…
Cancel
Save