Enable Bundled Prometheus Exporter for ClickHouse DB

Enable Bundled Prometheus Exporter for ClickHouse DB

Overview

      ClickHouse provides a built-in Prometheus exporter that allows monitoring tools like Prometheus to scrape internal metrics directly from the database. This eliminates the need for any external exporter in modern setups. In the default ClickHouse configuration, the Prometheus exporter settings are already available but kept commented out. Enabling the exporter requires uncommenting and activating this configuration.

Supported Versions

      The bundled Prometheus exporter is available starting from ClickHouse 19.x and above. For older versions, an external exporter such as clickhouse_exporter must be used.

Step 1: Open ClickHouse Configuration

Go to the main config file:

Quotesudo nano /etc/clickhouse-server/config.xml

Step 2: Locate Commented Prometheus Section

Search for prometheus inside the file. You will typically find a commented block like this:

Quote<!--
<prometheus>
<endpoint>/metrics</endpoint>
<port>9363</port>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
</prometheus>
-->

Step 3: Uncomment the Prometheus Block

Remove the comment tags <!-- --> so it becomes:

Quote<prometheus>
<endpoint>/metrics</endpoint>
<port>9363</port>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
</prometheus>

Notes
Note: f the port number or endpoint needs to be modified, update the configuration as required. The default values are suitable for most setups.

Step 4: Restart ClickHouse Service

Quotesudo systemctl restart clickhouse-server

Step 5: Verify Prometheus Endpoint

Quotecurl http://<clickhouse-host>:9363/metrics


Info
You should see metrics output in Prometheus format.

Step 6: Configure Prometheus Scrape Job

Update prometheus.yml:

Quote
scrape_configs:
- job_name: 'clickhouse'
static_configs:
- targets: ['<clickhouse-host>:9363']

Step 7: Reload Prometheus

Quotesudo systemctl reload prometheus

Step 8: Validate in Prometheus UI

  • Open: http://<prometheus-host>:9090
  • Check Targets
  • Ensure status is UP

                    New to ADSelfService Plus?

                      • Related Articles

                      • APM Insight Python Agent & Data Exporter Onboarding Docker Guide (Same Container)

                        Overview This guide explains how to enable APM Insight monitoring for your Python application running in Docker, using the APM Insight Python agent and Data Exporter (In Same Container). 1. Download the Required Components APM Insight Python Agent: ...
                      • How to enable the prometheus in Podman

                        How to enable prometheus in Podman (Podman-exporter, Node-Exporter) Note: Linux Machine (Ubuntu/RHEL-based) and Podman is already installed. 1. Overview of Monitoring Components Prometheus: Collects and stores metrics from configured targets Podman ...
                      • How to enable the prometheus in kafka

                        How to Configure Kafka Monitoring Using Prometheus Mode Note: This document explains how to configure Apache Kafka monitoring through Prometheus integration in Applications Manager. 1. Overview of Monitoring Components Kafka Broker: Generates JMX ...
                      • How to enable the Prometheus in Cassandra

                        How to Enable Prometheus Mode in Apache Cassandra This article explains how to configure Apache Cassandra to expose metrics in Prometheus format using JMX Exporter. Once configured, Applications Manager can collect Cassandra metrics using Prometheus ...
                      • How to enable the prometheus mode in Couchbase 7.6 Monitor

                        Couchbase 7.6 - Prometheus Monitoring Setup This guide explains how to enable and configure Prometheus monitoring for Couchbase Server 7.6. Note: From Couchbase 7.0 has built-in Prometheus support. No external exporter is required. STEP 1 – Verify ...