_statsd.mdx 1.8 KB
Newer Older
1
### Configuring taosAdapter
D
dingbo 已提交
2

3
To configure taosAdapter to receive StatsD data.
D
dingbo 已提交
4

5
- Enable the configuration item in the taosAdapter configuration file (default location /etc/taos/taosadapter.toml)
D
dingbo 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

```
...
[statsd]
enable = true
port = 6044
db = "statsd"
user = "root"
password = "taosdata"
worker = 10
gatherInterval = "5s"
protocol = "udp"
maxTCPConnections = 250
tcpKeepAlive = false
allowPendingMessages = 50000
deleteCounters = true
deleteGauges = true
deleteSets = true
deleteTimings = true
...
```

28
The default database name written by taosAdapter is `statsd`. To specify a different name, you can also modify the taosAdapter configuration file db entry. user and password fill in the actual TDengine configuration values. After changing the configuration file, you need to restart the taosAdapter.
D
dingbo 已提交
29

30
- You can also enable taosAdapter to receive StatsD data by using the taosAdapter command line parameters or setting environment variables.
D
dingbo 已提交
31

32
### Configuring StatsD
D
dingbo 已提交
33

34
To use StatsD, you need to download its [source code](https://github.com/statsd/statsd). Please refer to the example file `exampleConfig.js` in the root directory of the source download to modify the configuration file. In <taosAdpater's host\>, please fill in the domain name or IP address of the server running taosAdapter, and <port for StatsD\>, please fill in the port where taosAdapter receives StatsD data (default is 6044).
D
dingbo 已提交
35

36
```
37 38
backends section add ". /backends/repeater"
Add { host:'<taosAdapter's host>', port: <port for StatsD>} to repeater section
D
dingbo 已提交
39 40
```

41
Example configuration file.
D
dingbo 已提交
42 43 44 45

```
{
port: 8125
46
, backends: [". /backends/repeater"]
D
dingbo 已提交
47 48 49 50
, repeater: [{ host: '127.0.0.1', port: 6044}]
}
```

51
Start StatsD after adding the following (assuming the config file is modified to config.js)
D
dingbo 已提交
52 53 54 55

```
node stats.js config.js &
```