Interconnecting TSDBs: Prometheus and TDengine

Joel Brass

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.

  • Joel Brass
    Joel Brass

    Joel Brass is a Solutions Architect at TDengine, bringing extensive experience in real-time data processing, time-series analytics, and full-stack development. With a 20 year background in software engineering and a deep focus on scalable applications and solutions, Joel has worked on a range of projects spanning joke databases, IoT, self-driving vehicles, and work management platforms. Prior to joining TDengine, Joel worked in Advisory Services for Enterprise customers of Atlassian and the Systems Engineering team at Waymo. He is currently based in the San Francisco Bay Area.