[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
This commit is contained in:
Tq 2022-04-27 17:26:58 +08:00 committed by GitHub
parent d2fe85d7da
commit 7b0b4c126e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 1 deletions

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

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