Interconnecting TSDBs: Prometheus and TDengine

Jim Fan

July 2, 2025 /

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:

  1. remote_write / remote_read from Prometheus → TDengine
  2. 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

  1. Create the prometheus_data database in TDengine:

    CREATE DATABASE prometheus_data;
  2. 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.

  3. Restart Prometheus:

    sudo systemctl restart prometheus
  4. 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.

  1. Ensure taosKeeper is running:

    sudo systemctl status taoskeeper
  2. 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
  3. In prometheus.yml, add a scrape config for taosKeeper:

    scrape_configs:
      - job_name: "tdengine"
        static_configs:
          - targets: ["<taoskeeper_host>:6041"]
    
  4. Restart Prometheus:

    sudo systemctl restart prometheus

You can now see TDengine metrics in Prometheus.

  • Jim Fan
    Jim Fan

    Jim Fan is the VP of Product at TDengine. With a Master's Degree in Engineering from the University of Michigan and over 15 years of experience in manufacturing and Industrial IoT spaces, he brings expertise in digital transformation, smart manufacturing, autonomous driving, and renewable energy to drive TDengine's solution strategy. Prior to joining TDengine, he worked as the Director of Product Marketing for PTC's IoT Division and Hexagon's Smart Manufacturing Division. He is currently based in California, USA.