Store Prometheus long-term metrics into CrateDB

This usage guide shows how to use Docker Compose to run the services CrateDB, Prometheus, and the CrateDB Prometheus Adapter.

Prerequisites

Use Docker or Podman to run all components. This approach works consistently across Linux, macOS, and Windows.

Files

First, download and save all required files to your machine.

Services

Start services using Docker Compose or Podman Compose. If you use Podman, replace docker with podman (or enable the podman‑docker compatibility shim) and run podman compose up.

docker compose up

Explore data

CrateDB stores the metrics in the designated table, ready for inspection and analysis. By default, the included ddl.sql creates the table testdrive.metrics.

docker compose exec cratedb crash -c "SELECT * FROM testdrive.metrics ORDER BY timestamp LIMIT 5;"

Screenshots

Navigate to http://localhost:9090 to open the Prometheus UI. Go to StatusTargets.

Prometheus Targets page showing the self-scrape target as UP

Confirm that Prometheus monitors itself.

Prometheus target details for the self-scrape job

Return to the CrateDB Admin UI at http://localhost:4200 and select the testdrive.metrics table.

After a few minutes, Prometheus will have gathered a few thousand data points.

CrateDB Admin UI showing the populated metrics table

Use CrateDB’s query engine to analyze and visualize this data with tools like Grafana. See also Monitoring a self-managed CrateDB cluster with Prometheus and Grafana.