[home,collector]文档新增常见问题,采集器http参数优化校验
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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,14 +401,18 @@ 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()) {
|
||||||
requestBuilder.addParameter(param.getKey(), param.getValue());
|
if (StringUtils.hasText(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()) {
|
||||||
requestBuilder.addHeader(header.getKey(), header.getValue());
|
if (StringUtils.hasText(header.getValue())) {
|
||||||
|
requestBuilder.addHeader(header.getKey(), header.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// keep-alive
|
// keep-alive
|
||||||
|
|||||||
42
home/docs/help/issue.md
Normal file
42
home/docs/help/issue.md
Normal 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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -48,3 +48,6 @@ TDengine是一款国产的开源物联网时序型数据库,我们使用其替
|
|||||||
taos> show databases;
|
taos> show databases;
|
||||||
taos> use hertzbeat;
|
taos> use hertzbeat;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**注意⚠️若是安装包安装的TDengine2.3+版本**
|
||||||
|
> 除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||||
@@ -52,7 +52,8 @@
|
|||||||
"help/alert_dingtalk",
|
"help/alert_dingtalk",
|
||||||
"help/alert_feishu"
|
"help/alert_feishu"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"help/issue"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user