Setting Up ClickHouse Monitoring with clickhouse-exporter, Prometheus, and Grafana
This guide walks through deploying clickhouse-exporter, configuring Prometheus to scrape its metrics, and importing a Grafana dashboard to monitor ClickHouse single‑node or cluster performance, providing a practical monitoring solution for the database.
This article explains how to set up a monitoring system for a ClickHouse single node or cluster using clickhouse-exporter, Prometheus, and Grafana.
Deploy exporter
First, obtain the source code and compile it on a macOS machine (or any environment with internet access) because the production Linux host cannot access external networks.
mkdir -p $GO_PATH/src/github.com/Percona-Lab cd $GO_PATH/src/github.com/Percona-Lab git clone https://github.com/Percona-Lab/clickhouse_exporter cd $GO_PATH/src/github.com/Percona-Lab GO111MODULE=off CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build clickhouse_exporter.go ./clickhouse_exporter -h(shows usage)
Run the exporter with the ClickHouse HTTP endpoint:
./clickhouse_exporter -scrape_uri=http://clickhouse_server_ip:8123/ -log.level=infoConfigure Prometheus by adding a job to prometheus.yml :
- job_name: 'clickhouse_exporter'
scrape_interval: 10s
static_configs:
- targets:
- "clickhouse_exporter_ip:9116"Reload Prometheus configuration:
curl 'http://localhost:9090/-/reload' -X POSTImport the ClickHouse dashboard (ID 882) into Grafana, select the Prometheus data source, and visualize the metrics.
The article concludes that this setup provides a basic monitoring solution for ClickHouse, and suggests extending it for multi‑node clusters or finer‑grained metrics.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.