Back to Tdengine

Telegraf

docs/en/10-third-party/01-collection/03-telegraf.md

latest4.3 KB
Original Source

import Telegraf from "../../assets/resources/_telegraf.mdx"

Telegraf is a very popular open-source metric collection software. In data collection and platform monitoring systems, Telegraf can collect operational information from various components without the need to manually write scripts for periodic collection, reducing the difficulty of data acquisition.

Simply add the output configuration of Telegraf to point to the corresponding URL of taosAdapter and modify several configuration items to write Telegraf's data into TDengine. Storing Telegraf's data in TDengine can fully utilize TDengine's efficient storage and query performance and cluster processing capabilities for time-series data.

Prerequisites

The following preparations are needed to write Telegraf data into TDengine:

  • TDengine cluster has been deployed and is running normally
  • taosAdapter has been installed and is running normally. For specific details, please refer to taosAdapter User Manual
  • Telegraf has been installed. To install Telegraf, please refer to the official documentation
  • Telegraf by default collects system operational status data. By enabling input plugins, data in other formats can be output to Telegraf and then written into TDengine.

Configuration Steps

<Telegraf />

Verification Method

Restart the Telegraf service:

shell
sudo systemctl restart telegraf

Use TDengine CLI to verify that data is being written from Telegraf to TDengine and can be correctly read:

text
taos> show databases;
              name              |
=================================
 information_schema             |
 performance_schema             |
 telegraf                       |
Query OK, 3 rows in database (0.010568s)

taos> use telegraf;
Database changed.

taos> show stables;
              name              |
=================================
 swap                           |
 cpu                            |
 system                         |
 diskio                         |
 kernel                         |
 mem                            |
 processes                      |
 disk                           |
Query OK, 8 row(s) in set (0.000521s)

taos> select * from telegraf.system limit 10;
              ts               |           load1           |           load5           |          load15           |        n_cpus         |        n_users        |        uptime         | uptime_format |              host
|
=============================================================================================================================================================================================================================================
 2022-04-20 08:47:50.000000000 |               0.000000000 |               0.050000000 |               0.070000000 |                     4 |                     1 |                  5533 |  1:32         | shuduo-1804
|
 2022-04-20 08:48:00.000000000 |               0.000000000 |               0.050000000 |               0.070000000 |                     4 |                     1 |                  5543 |  1:32         | shuduo-1804
|
 2022-04-20 08:48:10.000000000 |               0.000000000 |               0.040000000 |               0.070000000 |                     4 |                     1 |                  5553 |  1:32         | shuduo-1804
|
Query OK, 3 row(s) in set (0.013269s)

:::note

  • The default subtable name generated by TDengine when receiving influxdb format data is a unique ID value generated according to rules. If users need to specify the generated table name, they can specify it by configuring the smlChildTableName parameter in taos.cfg. By controlling the input data format, you can use this feature of TDengine to specify the generated table name. For example: Configure smlChildTableName=tname and insert data as st,tname=cpu1,t1=4 c1=3 1626006833639000000, then the created table name is cpu1. If multiple rows of data have the same tname, but the tag_set behind them is different, the tag_set specified during the automatic table creation of the first row is used, and the other rows will be ignored. TDengine Schemaless Writing Reference Guide

:::