🚀 ClickHouse Setup with Prometheus and Grafana Monitoring

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?
| Component | Port | Purpose |
| ClickHouse | 8123 | Database HTTP access |
| Prometheus | 9090 | Scrapes & stores metrics |
| Grafana | 3000 | Dashboards & alerts |
| CH Exporter | 9363 | Exposes ClickHouse metrics |
This script installs everything automatically — no manual configs required.
⚡ Installation Guide (Hands-On)
Clone the repo
git clone https://github.com/Ajinkgupta/clickhouse-monitoring-stack.git cd clickhouse-monitoring-stackMake the script executable
chmod +x setup.shRun the installer
sudo ./setup.shEnter your ClickHouse credentials when prompted.
That’s it. The script handles installation, Prometheus config, and Grafana setup automatically.
📊 Access Your Monitoring Tools
Grafana →
http://<server_ip>:3000(login:admin / admin)Prometheus →
http://<server_ip>:9090ClickHouse HTTP →
http://<server_ip>:8123Metrics Exporter →
http://<server_ip>:9363/metrics
🎨 Grafana Dashboards for Developers
Login to Grafana
Go to Dashboards → Import
Enter ID: 14192 (popular ClickHouse dashboard)
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
Author: Ajink Gupta
Contact: ajink@duck.com
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



