docs: update taosAdapter doc

This commit is contained in:
t_max 2025-01-21 13:31:33 +08:00
parent e80a16e5d6
commit 910a6fff29
10 changed files with 60 additions and 51 deletions

View File

@ -4,7 +4,7 @@ Method to configure taosAdapter to receive collectd data:
- Enable the configuration item in the taosAdapter configuration file (default location is /etc/taos/taosadapter.toml)
```
```toml
...
[opentsdb_telnet]
enable = true
@ -29,7 +29,7 @@ collectd uses a plugin mechanism that can write the collected monitoring data to
Modify the related configuration items in the collectd configuration file (default location /etc/collectd/collectd.conf).
```text
```xml
LoadPlugin network
<Plugin network>
Server "<taosAdapter's host>" "<port for collectd direct>"
@ -40,7 +40,7 @@ Where \<taosAdapter's host> should be filled with the domain name or IP address
Example as follows:
```text
```xml
LoadPlugin network
<Plugin network>
Server "127.0.0.1" "6045"
@ -51,7 +51,7 @@ LoadPlugin network
Modify the related configuration items in the collectd configuration file (default location /etc/collectd/collectd.conf).
```text
```xml
LoadPlugin write_tsdb
<Plugin write_tsdb>
<Node>
@ -64,7 +64,7 @@ LoadPlugin write_tsdb
Where \<taosAdapter's host> should be filled with the domain name or IP address of the server running taosAdapter. \<port for collectd write_tsdb plugin> should be filled with the port used by taosAdapter to receive collectd write_tsdb plugin data (default is 6047).
```text
```xml
LoadPlugin write_tsdb
<Plugin write_tsdb>
<Node>
@ -79,6 +79,6 @@ LoadPlugin write_tsdb
Then restart collectd:
```
```shell
systemctl restart collectd
```

View File

@ -4,7 +4,7 @@ Method to configure taosAdapter to receive icinga2 data:
- Enable the configuration item in the taosAdapter configuration file (default location /etc/taos/taosadapter.toml)
```
```toml
...
[opentsdb_telnet]
enable = true
@ -26,7 +26,7 @@ The default database name written by taosAdapter is `icinga2`, but you can also
- Enable icinga2's opentsdb-writer (reference link https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer)
- Modify the configuration file `/etc/icinga2/features-enabled/opentsdb.conf` filling in \<taosAdapter's host> with the domain name or IP address of the server running taosAdapter, \<port for icinga2> with the corresponding port supported by taosAdapter for receiving icinga2 data (default is 6048)
```
```c
object OpenTsdbWriter "opentsdb" {
host = "<taosAdapter's host>"
port = <port for icinga2>
@ -35,7 +35,7 @@ object OpenTsdbWriter "opentsdb" {
Example file:
```
```c
object OpenTsdbWriter "opentsdb" {
host = "127.0.0.1"
port = 6048

View File

@ -4,7 +4,7 @@ Method to configure taosAdapter to receive StatsD data:
- Enable the configuration item in the taosAdapter configuration file (default location /etc/taos/taosadapter.toml)
```
```toml
...
[statsd]
enable = true
@ -33,14 +33,14 @@ The default database name written by taosAdapter is `statsd`, but you can also m
To use StatsD, download its [source code](https://github.com/statsd/statsd). Modify its configuration file according to the example file `exampleConfig.js` found in the root directory of the local source code download. Replace \<taosAdapter's host> with the domain name or IP address of the server running taosAdapter, and \<port for StatsD> with the port that taosAdapter uses to receive StatsD data (default is 6044).
```
```text
Add to the backends section "./backends/repeater"
Add to the repeater section { host:'<taosAdapter's host>', port: <port for StatsD>}
```
Example configuration file:
```
```js
{
port: 8125
, backends: ["./backends/repeater"]
@ -50,7 +50,7 @@ port: 8125
After adding the following content, start StatsD (assuming the configuration file is modified to config.js).
```
```shell
npm install
node stats.js config.js &
```

View File

@ -4,7 +4,7 @@ To configure taosAdapter to receive data from TCollector:
- Enable the configuration in the taosAdapter configuration file (default location /etc/taos/taosadapter.toml)
```
```toml
...
[opentsdb_telnet]
enable = true
@ -29,7 +29,7 @@ Modify the contents of `collectors/etc/config.py` and `tcollector.py`. Change th
Example of git diff output for source code modifications:
```
```diff
index e7e7a1c..ec3e23c 100644
--- a/collectors/etc/config.py
+++ b/collectors/etc/config.py

View File

@ -24,19 +24,17 @@ taosAdapter 提供以下功能:
- 支持采集 node_exporter 数据写入
- 支持 Prometheus remote_read 和 remote_write
架构图如下:
![TDengine Database taosAdapter Architecture](taosAdapter-architecture.webp)
## 安装
taosAdapter 是 TDengine 服务端软件 的一部分,如果您使用 TDengine server 您不需要任何额外的步骤来安装 taosAdapter。您可以从[涛思数据官方网站](https://docs.taosdata.com/releases/tdengine/)下载 TDengine server 安装包。如果需要将 taosAdapter 分离部署在 TDengine server 之外的服务器上,则应该在该服务器上安装完整的 TDengine 来安装 taosAdapter。如果您需要使用源代码编译生成 taosAdapter您可以参考[构建 taosAdapter](https://github.com/taosdata/taosadapter/blob/3.0/BUILD-CN.md)文档。
安装完成后使用命令 `systemctl start taosadapter` 可以启动 taosAdapter 服务。
## 架构图
![TDengine Database taosAdapter Architecture](taosAdapter-architecture.webp)
taosAdapter 作为外部客户端与 TDengine 集群之间的桥梁,支持多种数据采集工具和协议。外部客户端通过 RESTful 接口、InfluxDB 兼容客户端、OpenTSDB 兼容客户端、Telegraf、collectd 和 StatsD 等方式将数据发送到 taosAdapter。taosAdapter 接收这些数据并写入到 TDengine 集群。
## 配置说明
## 配置
taosAdapter 支持通过命令行参数、环境变量和配置文件来进行配置。默认配置文件是 /etc/taos/taosadapter.toml。
@ -301,6 +299,8 @@ taosAdapter 提供了以下功能:
- RESTful 接口:
[RESTful API](../../connector/rest-api)
- WebSocket 接口:
支持通过 WebSocket 协议执行 SQL、无模式数据写入、参数绑定和数据订阅功能。
- 兼容 InfluxDB v1 写接口:
[https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/](https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/)
- 兼容 OpenTSDB JSON 和 telnet 格式写入:
@ -323,6 +323,10 @@ taosAdapter 提供了以下功能:
您可以使用任何支持 http 协议的客户端通过访问 RESTful 接口地址 `http://<fqdn>:6041/rest/sql` 来写入数据到 TDengine 或从 TDengine 中查询数据。细节请参考[REST API 文档](../../connector/rest-api/)。
### WebSocket 接口
各语言连接器通过 taosAdapter 的 WebSocket 接口,能够实现 SQL 执行、无模式写入、参数绑定和数据订阅功能。参考[开发指南](../../../develop/connect/#websocket-连接)。
### 兼容 InfluxDB v1 写接口
您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://<fqdn>:6041/influxdb/v1/write` 来写入 InfluxDB 兼容格式的数据到 TDengine。
@ -336,7 +340,12 @@ taosAdapter 提供了以下功能:
- `ttl` 自动创建的子表生命周期,以子表的第一条数据的 TTL 参数为准,不可更新。更多信息请参考[创建表文档](../../taos-sql/table/#创建表)的 TTL 参数。
注意: 目前不支持 InfluxDB 的 token 验证方式,仅支持 Basic 验证和查询参数验证。
示例: curl --request POST http://127.0.0.1:6041/influxdb/v1/write?db=test --user "root:taosdata" --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000"
示例:
```shell
curl --request POST http://127.0.0.1:6041/influxdb/v1/write?db=test --user "root:taosdata" --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000"
```
### 兼容 OpenTSDB JSON 和 telnet 格式写入
您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://<fqdn>:6041/<APIEndPoint>` 来写入 OpenTSDB 兼容格式的数据到 TDengine。EndPoint 如下:

View File

@ -1,10 +1,10 @@
### 配置 taosAdapter
#### 配置 taosAdapter
配置 taosAdapter 接收 collectd 数据的方法:
- 在 taosAdapter 配置文件(默认位置为 /etc/taos/taosadapter.toml中使能配置项
```
```toml
...
[opentsdb_telnet]
enable = true
@ -21,15 +21,15 @@ password = "taosdata"
- 也可以使用 taosAdapter 命令行参数或设置环境变量启动的方式,使能 taosAdapter 接收 collectd 数据功能,具体细节请参考 taosAdapter 的参考手册
### 配置 collectd
#
#### 配置 collectd
collectd 使用插件机制可以以多种形式将采集到的监控数据写入到不同的数据存储软件。TDengine 支持直接采集插件和 write_tsdb 插件。
#### 配置接收直接采集插件数据
1. **配置直接采集插件**
修改 collectd 配置文件(默认位置 /etc/collectd/collectd.conf相关配置项。
```text
```xml
LoadPlugin network
<Plugin network>
Server "<taosAdapter's host>" "<port for collectd direct>"
@ -40,18 +40,18 @@ LoadPlugin network
示例如下:
```text
```xml
LoadPlugin network
<Plugin network>
Server "127.0.0.1" "6045"
</Plugin>
```
#### 配置 write_tsdb 插件数据
2. **配置 write_tsdb 插件**
修改 collectd 配置文件(默认位置 /etc/collectd/collectd.conf相关配置项。
```text
```xml
LoadPlugin write_tsdb
<Plugin write_tsdb>
<Node>
@ -64,7 +64,7 @@ LoadPlugin write_tsdb
其中 \<taosAdapter's host> 填写运行 taosAdapter 的服务器域名或 IP 地址。\<port for collectd write_tsdb plugin> 填写 taosAdapter 用于接收 collectd write_tsdb 插件的数据(默认为 6047
```text
```xml
LoadPlugin write_tsdb
<Plugin write_tsdb>
<Node>
@ -79,7 +79,7 @@ LoadPlugin write_tsdb
然后重启 collectd
```
```shell
systemctl restart collectd
```

View File

@ -1,10 +1,10 @@
### 配置 taosAdapter
#### 配置 taosAdapter
配置 taosAdapter 接收 icinga2 数据的方法:
- 在 taosAdapter 配置文件(默认位置 /etc/taos/taosadapter.toml中使能配置项
```
```toml
...
[opentsdb_telnet]
enable = true
@ -21,12 +21,12 @@ password = "taosdata"
- 也可以使用 taosAdapter 命令行参数或设置环境变量启动的方式,使能 taosAdapter 接收 icinga2 数据功能,具体细节请参考 taosAdapter 的参考手册
### 配置 icinga2
#### 配置 icinga2
- 使能 icinga2 的 opentsdb-writer参考链接 https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer
- 修改配置文件 `/etc/icinga2/features-enabled/opentsdb.conf` 填写 \<taosAdapter's host> 为运行 taosAdapter 的服务器的域名或 IP 地址,\<port for icinga2> 填写 taosAdapter 支持接收 icinga2 数据的相应端口(默认为 6048
```
```c
object OpenTsdbWriter "opentsdb" {
host = "<taosAdapter's host>"
port = <port for icinga2>
@ -35,7 +35,7 @@ object OpenTsdbWriter "opentsdb" {
示例文件:
```
```c
object OpenTsdbWriter "opentsdb" {
host = "127.0.0.1"
port = 6048

View File

@ -1,18 +1,18 @@
配置 Prometheus 是通过编辑 Prometheus 配置文件 prometheus.yml (默认位置 /etc/prometheus/prometheus.yml完成的。
### 配置第三方数据库地址
#### 配置第三方数据库地址
将其中的 remote_read url 和 remote_write url 指向运行 taosAdapter 服务的服务器域名或 IP 地址REST 服务端口taosAdapter 默认使用 6041以及希望写入 TDengine 的数据库名称,并确保相应的 URL 形式如下:
- remote_read url : `http://<taosAdapter's host>:<REST service port>/prometheus/v1/remote_read/<database name>`
- remote_write url : `http://<taosAdapter's host>:<REST service port>/prometheus/v1/remote_write/<database name>`
### 配置 Basic 验证
#### 配置 Basic 验证
- username \<TDengine's username>
- password \<TDengine's password>
### prometheus.yml 文件中 remote_write 和 remote_read 相关部分配置示例
#### prometheus.yml 文件中 remote_write 和 remote_read 相关部分配置示例
```yaml
remote_write:

View File

@ -1,10 +1,10 @@
### 配置 taosAdapter
#### 配置 taosAdapter
配置 taosAdapter 接收 StatsD 数据的方法:
- 在 taosAdapter 配置文件(默认位置 /etc/taos/taosadapter.toml中使能配置项
```
```toml
...
[statsd]
enable = true
@ -29,7 +29,7 @@ deleteTimings = true
- 也可以使用 taosAdapter 命令行参数或设置环境变量启动的方式,使能 taosAdapter 接收 StatsD 数据功能,具体细节请参考 taosAdapter 的参考手册
### 配置 StatsD
#### 配置 StatsD
使用 StatsD 需要下载其[源代码](https://github.com/statsd/statsd)。其配置文件请参考其源代码下载到本地的根目录下的示例文件 `exampleConfig.js` 进行修改。其中 \<taosAdapter's host> 填写运行 taosAdapter 的服务器域名或 IP 地址,\<port for StatsD> 请填写 taosAdapter 接收 StatsD 数据的端口(默认为 6044
@ -40,7 +40,7 @@ repeater 部分添加 { host:'<taosAdapter's host>', port: <port for StatsD>}
示例配置文件:
```
```js
{
port: 8125
, backends: ["./backends/repeater"]
@ -50,7 +50,7 @@ port: 8125
增加如下内容后启动 StatsD假设配置文件修改为 config.js
```
```shell
npm install
node stats.js config.js &
```

View File

@ -1,11 +1,11 @@
### 配置 taosAdapter
#### 配置 taosAdapter
配置 taosAdapter 接收 TCollector 数据的方法:
- 在 taosAdapter 配置文件(默认位置 /etc/taos/taosadapter.toml中使能配置项
```
```toml
...
[opentsdb_telnet]
enable = true
@ -22,7 +22,7 @@ password = "taosdata"
- 也可以使用 taosAdapter 命令行参数或设置环境变量启动的方式,使能 taosAdapter 接收 tcollector 数据功能,具体细节请参考 taosAdapter 的参考手册
### 配置 TCollector
#### 配置 TCollector
使用 TCollector 需下载其[源代码](https://github.com/OpenTSDB/tcollector)。其配置项在其源代码中。注意TCollector 各个版本区别较大,这里仅以当前 master 分支最新代码 (git commit: 37ae920) 为例。
@ -30,7 +30,7 @@ password = "taosdata"
示例为源代码修改内容的 git diff 输出:
```
```diff
index e7e7a1c..ec3e23c 100644
--- a/collectors/etc/config.py
+++ b/collectors/etc/config.py