[home,collector]文档新增常见问题,采集器http参数优化校验

This commit is contained in:
tomsun28
2022-03-02 10:16:29 +08:00
parent 17ef5e7dee
commit 935378f90b
8 changed files with 67 additions and 9 deletions

View File

@@ -55,7 +55,7 @@
### 🐵 依赖服务部署 ### 🐵 依赖服务部署
> HertzBeat最少依赖于 关系型数据库[MYSQL8+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started) > HertzBeat最少依赖于 关系型数据库[MYSQL5+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started)
##### 安装MYSQL ##### 安装MYSQL
1. docker安装MYSQl 1. docker安装MYSQl

View File

@@ -350,15 +350,16 @@ public class HttpCollectImpl extends AbstractCollect {
HttpProtocol.Authorization auth = httpProtocol.getAuthorization(); HttpProtocol.Authorization auth = httpProtocol.getAuthorization();
if (auth != null && !DispatchConstants.BEARER_TOKEN.equals(auth.getType())) { if (auth != null && !DispatchConstants.BEARER_TOKEN.equals(auth.getType())) {
HttpClientContext clientContext = new HttpClientContext(); HttpClientContext clientContext = new HttpClientContext();
if (DispatchConstants.BASIC_AUTH.equals(auth.getType()) && auth.getBasicAuthUsername() != null if (DispatchConstants.BASIC_AUTH.equals(auth.getType())
&& auth.getBasicAuthPassword() != null) { && StringUtils.hasText(auth.getBasicAuthUsername())
&& StringUtils.hasText(auth.getBasicAuthPassword())) {
CredentialsProvider provider = new BasicCredentialsProvider(); CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials UsernamePasswordCredentials credentials
= new UsernamePasswordCredentials(auth.getBasicAuthUsername(), auth.getBasicAuthPassword()); = new UsernamePasswordCredentials(auth.getBasicAuthUsername(), auth.getBasicAuthPassword());
provider.setCredentials(AuthScope.ANY, credentials); provider.setCredentials(AuthScope.ANY, credentials);
clientContext.setCredentialsProvider(provider); clientContext.setCredentialsProvider(provider);
} else if (DispatchConstants.DIGEST_AUTH.equals(auth.getType()) && auth.getDigestAuthUsername() != null } else if (DispatchConstants.DIGEST_AUTH.equals(auth.getType()) && StringUtils.hasText(auth.getDigestAuthUsername())
&& auth.getDigestAuthPassword() != null) { && StringUtils.hasText(auth.getDigestAuthPassword())) {
CredentialsProvider provider = new BasicCredentialsProvider(); CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials UsernamePasswordCredentials credentials
= new UsernamePasswordCredentials(auth.getBasicAuthUsername(), auth.getBasicAuthPassword()); = new UsernamePasswordCredentials(auth.getBasicAuthUsername(), auth.getBasicAuthPassword());
@@ -400,16 +401,20 @@ public class HttpCollectImpl extends AbstractCollect {
Map<String, String> params = httpProtocol.getParams(); Map<String, String> params = httpProtocol.getParams();
if (params != null && !params.isEmpty()) { if (params != null && !params.isEmpty()) {
for (Map.Entry<String, String> param : params.entrySet()) { for (Map.Entry<String, String> param : params.entrySet()) {
if (StringUtils.hasText(param.getValue())) {
requestBuilder.addParameter(param.getKey(), param.getValue()); requestBuilder.addParameter(param.getKey(), param.getValue());
} }
} }
}
// headers // headers
Map<String, String> headers = httpProtocol.getHeaders(); Map<String, String> headers = httpProtocol.getHeaders();
if (headers != null && !headers.isEmpty()) { if (headers != null && !headers.isEmpty()) {
for (Map.Entry<String, String> header : headers.entrySet()) { for (Map.Entry<String, String> header : headers.entrySet()) {
if (StringUtils.hasText(header.getValue())) {
requestBuilder.addHeader(header.getKey(), header.getValue()); requestBuilder.addHeader(header.getKey(), header.getValue());
} }
} }
}
// keep-alive // keep-alive
requestBuilder.addHeader(HttpHeaders.CONNECTION, "keep-alive"); requestBuilder.addHeader(HttpHeaders.CONNECTION, "keep-alive");
// add accept // add accept

42
home/docs/help/issue.md Normal file
View File

@@ -0,0 +1,42 @@
---
id: issue
title: 常见问题
sidebar_label: 常见问题
---
### 监控常见问题
1. ** 页面反馈monitor.host:监控Host必须是ipv4,ipv6或域名 **
> 如信息所示输入的监控Host须是ipv4,ipv6或域名不能携带协议头例如协议头http
2. ** 网站API等监控反馈statusCode:403或401但对端服务本身无需认证浏览器直接访问是OK **
> 请排查是否是被防火墙拦截如宝塔等默认设置了对请求header中`User-Agent=Apache-HttpClient`的拦截,若被拦截请删除此拦截规则。
### Docker部署常见问题
1. **MYSQL,TDENGINE和HertzBeat都Docker部署在同一主机上HertzBeat使用localhost或127.0.0.1连接数据库失败**
此问题本质为Docker容器访问宿主机端口连接失败由于docker默认网络模式为Bridge模式其通过localhost访问不到宿主机。
> 解决办法一配置application.yml将数据库的连接地址由localhost修改为宿主机的对外IP
> 解决办法二使用Host网络模式启动Docker即使Docker容器和宿主机共享网络 `docker run -d --network host .....`
2. **按照流程部署,访问 http://ip:1157/console 无界面**
请参考下面几点排查问题:
> 依赖服务MYSQL数据库TDENGINE数据库是否已按照启动成功对应hertzbeat数据库是否已创建SQL脚本是否执行
> HertzBeat的配置文件 `application.yml` 里面的依赖服务IP账户密码等配置是否正确
> 三:若都无问题可以 `docker logs hertzbeat` 查看容器日志是否有明显错误提issue或交流群或社区反馈
3. **日志报错TDengine连接或插入SQL失败**
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
> 若是安装包安装的TDengine2.3+除了启动server外还需执行 `systemctl start taosadapter` 启动 adapter
### 安装包部署常见问题
1. **按照流程部署,访问 http://ip:1157/console 无界面**
请参考下面几点排查问题:
> 依赖服务MYSQL数据库TDENGINE数据库是否已按照启动成功对应hertzbeat数据库是否已创建SQL脚本是否执行
> HertzBeat的配置文件 `hertzbeat/config/application.yml` 里面的依赖服务IP账户密码等配置是否正确
> 三:若都无问题可以查看 `hertzbeat/logs/` 目录下面的运行日志是否有明显错误提issue或交流群或社区反馈
2. **日志报错TDengine连接或插入SQL失败**
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
> 若是安装包安装的TDengine2.3+除了启动server外还需执行 `systemctl start taosadapter` 启动 adapter

View File

@@ -99,3 +99,6 @@ sidebar_label: Docker方式部署
> 二HertzBeat的配置文件 `application.yml` 里面的依赖服务IP账户密码等配置是否正确 > 二HertzBeat的配置文件 `application.yml` 里面的依赖服务IP账户密码等配置是否正确
> 三:若都无问题可以 `docker logs hertzbeat` 查看容器日志是否有明显错误提issue或交流群或社区反馈 > 三:若都无问题可以 `docker logs hertzbeat` 查看容器日志是否有明显错误提issue或交流群或社区反馈
3. **日志报错TDengine连接或插入SQL失败**
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
> 二若是安装包安装的TDengine2.3+除了启动server外还需执行 `systemctl start taosadapter` 启动 adapter

View File

@@ -87,3 +87,7 @@ sidebar_label: 安装包方式部署
> 一依赖服务MYSQL数据库TDENGINE数据库是否已按照启动成功对应hertzbeat数据库是否已创建SQL脚本是否执行 > 一依赖服务MYSQL数据库TDENGINE数据库是否已按照启动成功对应hertzbeat数据库是否已创建SQL脚本是否执行
> 二HertzBeat的配置文件 `hertzbeat/config/application.yml` 里面的依赖服务IP账户密码等配置是否正确 > 二HertzBeat的配置文件 `hertzbeat/config/application.yml` 里面的依赖服务IP账户密码等配置是否正确
> 三:若都无问题可以查看 `hertzbeat/logs/` 目录下面的运行日志是否有明显错误提issue或交流群或社区反馈 > 三:若都无问题可以查看 `hertzbeat/logs/` 目录下面的运行日志是否有明显错误提issue或交流群或社区反馈
2. **日志报错TDengine连接或插入SQL失败**
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
> 二若是安装包安装的TDengine2.3+除了启动server外还需执行 `systemctl start taosadapter` 启动 adapter

View File

@@ -11,7 +11,7 @@ sidebar_label: 快速开始
### 🐵 依赖服务部署 ### 🐵 依赖服务部署
> HertzBeat最少依赖于 关系型数据库[MYSQL8+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started) > HertzBeat最少依赖于 关系型数据库[MYSQL5+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started)
##### 安装MYSQL ##### 安装MYSQL
1. docker安装MYSQl 1. docker安装MYSQl

View File

@@ -48,3 +48,6 @@ TDengine是一款国产的开源物联网时序型数据库我们使用其替
taos> show databases; taos> show databases;
taos> use hertzbeat; taos> use hertzbeat;
``` ```
**注意⚠若是安装包安装的TDengine2.3+版本**
> 除了启动server外还需执行 `systemctl start taosadapter` 启动 adapter

View File

@@ -52,7 +52,8 @@
"help/alert_dingtalk", "help/alert_dingtalk",
"help/alert_feishu" "help/alert_feishu"
] ]
} },
"help/issue"
] ]
}, },
{ {