Prometheus is an open-source monitoring and alerting toolkit widely adopted for its powerful time-series data model, flexible query language (PromQL), and efficient pull-based architecture. Prometheus excels at collecting metrics from a wide range of systems and applications, making it a go-to solution for IT infrastructure and application monitoring.
TDengine is a high-performance time-series database purpose-built for industrial and real-time analytics scenarios. It features a compact storage engine, native stream processing, and SQL compatibility. With built-in connectors and low resource consumption, TDengine provides a lightweight yet powerful backend for managing massive volumes of time-stamped data efficiently.
This article demonstrates how to interconnect these systems in two ways:
- remote_write / remote_read from Prometheus → TDengine
- TDengine’s
/metrics
endpoint scraped by Prometheus
Prerequisites
Make sure the following are in place:
- A running TDengine cluster
- taosAdapter installed and running
- Prometheus installed and running
Remote Read and Write Between Prometheus and TDengine
-
Create the
prometheus_data
database in TDengine:CREATE DATABASE prometheus_data;
-
Add the following configuration items to
prometheus.yml
:remote_write: - url: "http://<taosadapter-url>:6041/prometheus/v1/remote_write/prometheus_data" basic_auth: username: <tdengine-user> password: <tdengine-password> remote_read: - url: "http://<taosadapter-url>:6041/prometheus/v1/remote_read/prometheus_data" basic_auth: username: <tdengine-user> password: <tdengine-password> remote_timeout: 10s read_recent: true
Modify the URL, username, and password to match your TDengine deployment.
-
Restart Prometheus:
sudo systemctl restart prometheus
-
In TDengine, view the metrics in the
prometheus_data
database:USE prometheus_data; SHOW STABLES; SELECT * FROM metrics LIMIT 10;
You should see frequent samples like go_gc_duration_seconds
confirming that remote_write
is working.
Monitoring TDengine with Prometheus
taosKeeper exports TDengine metrics in Prometheus format at the /metrics
endpoint so that you can monitor your TDengine cluster in Prometheus.
-
Ensure taosKeeper is running:
sudo systemctl status taoskeeper
-
Test the metrics endpoint:
curl http://<taoskeeper_host>:6041/metrics
You’ll see Prometheus‐style output, for example:
taos_connections 5 taos_query_latency_seconds{quantile="0.5"} 0.002
-
In
prometheus.yml
, add a scrape config for taosKeeper:scrape_configs: - job_name: "tdengine" static_configs: - targets: ["<taoskeeper_host>:6041"]
-
Restart Prometheus:
sudo systemctl restart prometheus
You can now see TDengine metrics in Prometheus.
