DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Your ClickHouse Database with Vigilmon

ClickHouse is the high-performance columnar database powering analytics at companies like Cloudflare, Uber, and Bloomberg. Its speed is legendary—but downtime is catastrophic. Here's how to monitor ClickHouse availability with Vigilmon.

Why ClickHouse Monitoring Matters

ClickHouse is typically used for real-time analytics dashboards and event pipelines. When it goes down:

  • Dashboards go blank
  • Analytics queries fail
  • Data pipelines back up
  • Revenue metrics become unavailable

ClickHouse's Built-In Health Endpoint

ClickHouse exposes a built-in HTTP interface on port 8123 with a health endpoint:

# Check ClickHouse health
curl http://your-clickhouse-host:8123/ping
# Returns "Ok." when healthy
Enter fullscreen mode Exit fullscreen mode

This makes HTTP monitoring straightforward.

Setting Up Vigilmon for ClickHouse

Method 1: HTTP Health Monitor (Recommended)

  1. Log into Vigilmon
  2. Click Add MonitorHTTP(S)
  3. URL: http://your-clickhouse-host:8123/ping
  4. Expected response: Ok.
  5. Check interval: 60 seconds
  6. Enable multi-region probes

Method 2: TCP Port Monitor

Monitor the ClickHouse HTTP port (8123) or native TCP port (9000):

HTTP Interface: Port 8123 (preferred for health checks)
Native TCP:     Port 9000 (binary protocol)
HTTPS:          Port 8443 (if TLS enabled)
Enter fullscreen mode Exit fullscreen mode

Method 3: Custom Health Query Endpoint

For deeper checks, expose an endpoint that runs a test query:

@app.route('/health/clickhouse')
def ch_health():
    try:
        result = client.execute('SELECT 1')
        return jsonify({"status": "ok", "result": result[0][0]}), 200
    except Exception as e:
        return jsonify({"status": "error", "message": str(e)}), 503
Enter fullscreen mode Exit fullscreen mode

Monitoring ClickHouse Clusters

For distributed ClickHouse clusters, create separate monitors for:

  • Each shard's HTTP endpoint
  • The load balancer/proxy endpoint
  • The ZooKeeper ensemble (if using ReplicatedMergeTree)
# ZooKeeper health check
echo ruok | nc your-zookeeper-host 2181
# Returns "imok" when healthy
Enter fullscreen mode Exit fullscreen mode

ClickHouse-Specific Metrics to Track

While Vigilmon handles availability, also monitor these internally:

Metric Significance
clickhouse_queries Query rate (drop = potential issue)
clickhouse_merge_queue_size Background merge backlog
clickhouse_replication_delay Replica lag in seconds
clickhouse_memory_usage Memory pressure

Conclusion

ClickHouse's built-in /ping endpoint makes it one of the easiest databases to monitor with Vigilmon. Set up HTTP monitoring in 2 minutes and never be caught off-guard by a ClickHouse outage again.

Start monitoring ClickHouse for free at vigilmon.online

Top comments (0)