Collectd
Collectd
1. Introduction
Collectd periodically collects system and application performance metrics and provides various mechanisms for storing the metric values. It collects metrics from multiple data sources, such as operating systems, applications, log files, and external devices, and stores the information locally or transmits it to other systems over the network. With the collected statistics, users can monitor systems, identify performance bottlenecks, and predict future system loads.
IoTDB supports integration with Collectd. Simply point the Collectd configuration to the domain name (or IP address) and port of the server running IoTDB_Adapter to write the collected data into IoTDB, taking full advantage of IoTDB's efficient time-series data storage, query performance, and cluster processing capabilities.
2. Prerequisites
To store data collected by Collectd in IoTDB, make the following preparations:
IoTDB >=V2.0.5.1 has been deployed and is running properly
IoTDB_Adapter has been installed and is running properly
Collectd has been installed
3. Configuration Steps
3.1 IoTDB_Adapter Configuration
Contact Timecho staff to obtain the
IoTDB_Adapterinstallation packageExtract the package
# Version 1.0 is used as an example unzip IoTDB_Adapter-1.0.zipModify the conf/application.properties configuration file to set the listening port, IoTDB node address, username, password, and path prefix.
# Port on which the Adapter listens
port=4242
# IoTDB instance address; separate multiple nodeUrls with ;
iotdb.nodeUrls=127.0.0.1:6667
# Path prefix for data written to IoTDB, such as root.testdb (effective when sqlDialect is not table)
iotdb.prefix=root.collectd
# IoTDB username
iotdb.user=root
# IoTDB password
iotdb.password=root
# IoTDB SqlDialect (tree/table; tree by default)
iotdb.sqlDialect=table
# IoTDB DataBase (effective when sqlDialect is table)
iotdb.database=collectd
# IoTDB Table (effective when sqlDialect is table)
iotdb.table=test
# payload_formatter: supports statsd and opentsdb (default)
payload.formatter=opentsdb
# Source data precision (seconds s by default | milliseconds ms | microseconds us | nanoseconds ns)
time.precision.source=s
# Target IoTDB data precision (seconds by default)
time.precision.iotdb=msNote: In the table model, the database specified by the iotdb.database parameter must be created in advance
- Restart the
IoTDB_Adapterservice.
/sbin/start.sh3.2 Collectd Configuration
Download and install Collectd. For details, see the official website
Modify the relevant settings in the Collectd configuration file (the default path is
/etc/collectd.conf)
LoadPlugin cpu
LoadPlugin memory
LoadPlugin network
<Plugin network>
Server "[127.0.0.1](http://127.0.0.1)" "8080"
</Plugin>
LoadPlugin write_tsdb
<Plugin write_tsdb>
<Node>
Host "[127.0.0.1](http://127.0.0.1)"
Port "4242"
HostTags "status=production"
StoreRates false
AlwaysAppendDS false
</Node>
</Plugin>- Start Collectd
systemctl start collectd3.3 Verification
Query the data through IoTDB CLI to verify that it has been written successfully.
IoTDB:collectd> select * from test limit 10
+-----------------------------+-----------------------------------------------------+---------------------------+----------+---------------+
| time| metric| fqdn| status| value|
+-----------------------------+-----------------------------------------------------+---------------------------+----------+---------------+
|2025-07-23T10:21:31.008+08:00| cpu.0.cpu.steal|iot-VMware-Virtual-Platform|production| 0.0|
|2025-07-23T10:21:31.008+08:00| irq.48.irq|iot-VMware-Virtual-Platform|production| 0.0|
|2025-07-23T10:21:31.008+08:00|df.snap-snapd-desktop-integration-253.df_complex.free|iot-VMware-Virtual-Platform|production| 0.0|
|2025-07-23T10:21:31.008+08:00| disk.loop14.disk_ops.read|iot-VMware-Virtual-Platform|production| 10.0|
|2025-07-23T10:21:31.008+08:00| df.root.df_complex.used|iot-VMware-Virtual-Platform|production|2.2677823488E10|
|2025-07-23T10:23:42.080+08:00| df.root.df_complex.used|iot-VMware-Virtual-Platform|production|2.2679293952E10|
|2025-07-23T10:21:31.008+08:00| irq.IWI.irq|iot-VMware-Virtual-Platform|production| 48.0|
|2025-07-23T10:21:31.008+08:00| cpu.3.cpu.user|iot-VMware-Virtual-Platform|production| 2516.0|
|2025-07-23T10:21:31.008+08:00| df.snap-firmware-updater-167.df_complex.free|iot-VMware-Virtual-Platform|production| 0.0|
|2025-07-23T10:21:31.008+08:00| cpu.3.cpu.nice|iot-VMware-Virtual-Platform|production| 3819.0|
+-----------------------------+-----------------------------------------------------+---------------------------+----------+---------------+