Skip to content

Commit f6ccafc

Browse files
committed
doc: add doc for cnosdb_customize
1 parent e2bd753 commit f6ccafc

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

.github/README.md

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Cnos-Telegraf
2+
3+
CnosDB-Telegraf 基于 Telegraf 进行开发,增加了一些功能与插件。
4+
5+
## 原版 Telegraf 文档
6+
7+
[README.md](../README.md)
8+
9+
## Cnos-Telegraf 的改动说明
10+
11+
### Parser Plugin
12+
13+
增加 Parser 插件 opentsdb_json,用于采集 OpenTSDB 的 JSON 格式的写入请求。
14+
15+
#### OpenTSDB JSON
16+
17+
通过使用 Input 插件 http_listener_v2 并配置 `data_format``"opentsdb"`,将能够解析 OpenTSDB 格式的写入请求。
18+
19+
```toml
20+
[[inputs.http_listener_v2]]
21+
service_address = ":8080"
22+
paths = ["/api/put"]
23+
methods = ["POST", "PUT"]
24+
data_format = "opentsdb_json"
25+
```
26+
27+
### Input Plugin
28+
29+
#### CnosDB 订阅
30+
31+
增加 Input 插件 cnosdb_subscription,用于搜集 CnosDB 订阅功能推送的数据,搭配 Output 插件即可实现异构数据同步。
32+
33+
```toml
34+
[[inputs.cnosdb_subscription]]
35+
service_address = ":8803"
36+
```
37+
38+
- **配置介绍**
39+
40+
| 参数 | 说明 |
41+
|-----------------|------|
42+
| service_address | 监听端口 |
43+
44+
#### 通用参数
45+
46+
增加配置参数 high_priority_io,用于开启端到端模式。
47+
48+
当设置为 true 时,写入的数据将立即发送到 Output 插件,并根据 Output 插件的返回参数来决定返回值。
49+
50+
```toml
51+
[[inputs.http_listener_v2]]
52+
service_address = ":8080"
53+
paths = ["/api/put"]
54+
methods = ["POST", "PUT"]
55+
data_format = "opentsdb"
56+
high_priority_io = true
57+
```
58+
59+
## 构建
60+
61+
1. [安装 Go](https://golang.org/doc/install),版本要求 >=1.22
62+
2. 从 Github 克隆仓库:
63+
64+
```shell
65+
git clone https://github.com/cnosdb/cnos-telegraf.git
66+
```
67+
68+
3. 检出与 CnosDB 对应的版本,在仓库目录下执行 `make build`
69+
70+
```shell
71+
cd cnos-telegraf
72+
# 如果为了适配 cnosdb/2.4 版本
73+
git checkout cnosdb/2.4
74+
make build
75+
```
76+
77+
## 启动
78+
79+
执行以下指令,查看用例:
80+
81+
```shell
82+
telegraf --help
83+
```
84+
85+
### 生成一份标准的 telegraf 配置文件
86+
87+
```shell
88+
telegraf config > telegraf.conf
89+
```
90+
91+
### 生成一份 telegraf 配置文件,仅包含 cpu 指标采集 & influxdb 输出两个插件
92+
93+
```shell
94+
telegraf config --section-filter agent:inputs:outputs --input-filter cpu --output-filter influxdb
95+
```
96+
97+
### 运行 telegraf 但是将采集指标输出到标准输出
98+
99+
```shell
100+
telegraf --config telegraf.conf --test
101+
```
102+
103+
### 运行 telegraf 并通过配置文件来管理加载的插件
104+
105+
```shell
106+
telegraf --config telegraf.conf
107+
```
108+
109+
### 运行 telegraf,仅加载 cpu & memory 指标采集,和 influxdb 输出插件
110+
111+
```shell
112+
telegraf --config telegraf.conf --input-filter cpu:mem --output-filter influxdb
113+
```

0 commit comments

Comments
 (0)