Skip to main content

Command Palette

Search for a command to run...

🚀 ClickHouse Setup with Prometheus and Grafana Monitoring

Updated
3 min read
🚀 ClickHouse Setup with Prometheus and Grafana Monitoring
A

I am an engineering student pursuing a degree in Artificial Intelligence and Data Science at Datta Meghe College of Engineering. I have strong technical skills in Full Stack Web Development, as well as programming in Python and Java. I currently manage Doubtly's blog and am exploring job opportunities as an SDE. I am passionate about learning new technologies and contributing to the tech community.

Monitoring isn’t optional when you’re running ClickHouse in production.

As developers, we’ve all been there:

  • Queries suddenly slow down

  • Disk fills up overnight

  • Background merges eat up CPU

  • And worst of all — you only find out after users complain

That’s exactly why I built the ClickHouse Monitoring Stack — a single script that gets you ClickHouse + Prometheus + Grafana up and running in minutes.

In this blog, we’ll walk through why monitoring matters, what the stack includes, and how you can get it running on your own server.


🔑 Why Should Developers Care About Monitoring ClickHouse?

ClickHouse is insanely fast, but without visibility, you’re just guessing when things break. Here’s what proper monitoring gives you:

  • Query Insights → Track slow queries & optimize them before users notice.

  • Resource Metrics → Watch CPU, memory, and disk I/O usage.

  • Cluster Health → Replication lag, node availability, and shard balance.

  • Alerts → Know when something’s wrong before production explodes.

In short: Monitoring turns chaos into control.


🛠️ What’s Inside the Stack?

ComponentPortPurpose
ClickHouse8123Database HTTP access
Prometheus9090Scrapes & stores metrics
Grafana3000Dashboards & alerts
CH Exporter9363Exposes ClickHouse metrics

This script installs everything automatically — no manual configs required.


⚡ Installation Guide (Hands-On)

  1. Clone the repo

     git clone https://github.com/Ajinkgupta/clickhouse-monitoring-stack.git
     cd clickhouse-monitoring-stack
    
  2. Make the script executable

     chmod +x setup.sh
    
  3. Run the installer

     sudo ./setup.sh
    
  4. Enter your ClickHouse credentials when prompted.

That’s it. The script handles installation, Prometheus config, and Grafana setup automatically.


📊 Access Your Monitoring Tools

  • Grafanahttp://<server_ip>:3000 (login: admin / admin)

  • Prometheushttp://<server_ip>:9090

  • ClickHouse HTTPhttp://<server_ip>:8123

  • Metrics Exporterhttp://<server_ip>:9363/metrics


🎨 Grafana Dashboards for Developers

  1. Login to Grafana

  2. Go to Dashboards → Import

  3. Enter ID: 14192 (popular ClickHouse dashboard)

  4. Select Prometheus as datasource → Done ✅

Now you’ll see:

  • Query latencies

  • Insert/Select counts

  • Disk usage growth

  • Background merges & mutations

  • Cluster replication lag

Perfect for devs debugging performance or scaling issues.


💡 Developer Best Practices

  • Set alerts in Grafana → “Disk > 80%” or “Query latency > 2s”

  • Watch storage growth → plan capacity before it’s too late

  • Monitor query mix → SELECT vs INSERT balance matters

  • Integrate alerts → Send them to Slack or PagerDuty


👨‍💻 About the Project

This project is 100% open source. Fork it, improve it, and share feedback.


🎯 Final Thoughts

As developers, we spend too much time firefighting issues that proper monitoring could have prevented.

With this stack, you don’t have to waste hours setting up Prometheus and Grafana — just run one script and you’re done.

👉 Give it a try: ClickHouse Monitoring Stack on GitHub

More from this blog

U

UniGeek

29 posts

Unigeek empowers developers and tech enthusiasts at every level. From placement prep and daily coding challenges to advanced upskilling, Unigeek helps you grow in the ever-evolving tech world.