homework-jianmu/docs/en/10-third-party/01-collection/05-collectd.md

4.3 KiB

title description slug
collectd Writing Data to TDengine Using collectd /third-party-tools/data-collection/collectd

import CollectD from "./_collectd.mdx"

Collectd is a daemon used to collect system performance metrics. It provides various storage mechanisms to store different values. It periodically aggregates relevant statistics of the system while it is running and storing information. Utilizing this information helps identify current system performance bottlenecks and predict future system loads.

By simply configuring collectd to point to the domain name (or IP address) of the server running taosAdapter and the corresponding port, the data collected by collectd can be written into TDengine, making full use of TDengine's efficient storage and query performance for time-series data and its cluster processing capabilities.

Prerequisites

To write collectd data into TDengine, several preparations are needed:

  • The TDengine cluster has been deployed and is running normally.
  • The taosAdapter has been installed and is running normally. For details, please refer to the taosAdapter User Manual.
  • Collectd has been installed. For installation instructions, please refer to the official documentation.

Configuration Steps

Verification Method

Restart collectd:

sudo systemctl restart collectd

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

taos> show databases;
              name              |
=================================
 information_schema             |
 performance_schema             |
 collectd                       |
Query OK, 3 rows in set (0.003266s)

taos> use collectd;
Database changed.

taos> show stables;
              name              |
=================================
 load_1                         |
 memory_value                   |
 df_value                       |
 load_2                         |
 load_0                         |
 interface_1                    |
 irq_value                      |
 interface_0                    |
 entropy_value                  |
 swap_value                     |
Query OK, 10 row(s) in set (0.002236s)

taos> select * from collectd.memory_value limit 10;
              ts               |           value           |              host              |         type_instance          |           type           |
=========================================================================================================================================================
 2022-04-20 09:27:45.459653462 |        54689792.000000000 | shuduo-1804                    | buffered                       | memory                   |
 2022-04-20 09:27:55.453168283 |        57212928.000000000 | shuduo-1804                    | buffered                       | memory                   |
 2022-04-20 09:28:05.453004291 |        57942016.000000000 | shuduo-1804                    | buffered                       | memory                   |
 2022-04-20 09:27:45.459653462 |      6381330432.000000000 | shuduo-1804                    | free                           | memory                   |
 2022-04-20 09:27:55.453168283 |      6357643264.000000000 | shuduo-1804                    | free                           | memory                   |
 2022-04-20 09:28:05.453004291 |      6349987840.000000000 | shuduo-1804                    | free                           | memory                   |
 2022-04-20 09:27:45.459653462 |       107040768.000000000 | shuduo-1804                    | slab_recl                      | memory                   |
 2022-04-20 09:27:55.453168283 |       107536384.000000000 | shuduo-1804                    | slab_recl                      | memory                   |
 2022-04-20 09:28:05.453004291 |       107634688.000000000 | shuduo-1804                    | slab_recl                      | memory                   |
 2022-04-20 09:27:45.459653462 |       309137408.000000000 | shuduo-1804                    | used                           | memory                   |
Query OK, 10 row(s) in set (0.010348s)

:::note

The subtable names generated by TDengine by default are unique ID values generated based on specific rules.

:::