Multiple Hosts
chmonitor can monitor multiple ClickHouse clusters from a single deployment. The host selector in the dashboard header lets you switch between them. The URL reflects the active host as ?host=N.
How it works
Section titled “How it works”Set CLICKHOUSE_HOST to a comma-separated list of host URLs. Position N across all four connection variables maps to host index N:
| Variable | Example |
|---|---|
CLICKHOUSE_HOST | http://ch-1:8123,http://ch-2:8123 |
CLICKHOUSE_USER | user1,user2 |
CLICKHOUSE_PASSWORD | pass1,pass2 |
CLICKHOUSE_NAME | Production,Staging |
CLICKHOUSE_HOST defines the host count. CLICKHOUSE_NAME is optional — if omitted, hosts are labeled by their index (Host 0, Host 1, …). For credentials, you can provide a single shared value (applied to all hosts) or one value per host position.
The URL parameter ?host=0 targets the first host, ?host=1 the second, and so on. The dashboard defaults to ?host=0 on first load.
Same credentials for all hosts
Section titled “Same credentials for all hosts”If all hosts share the same user and password, set a single value:
CLICKHOUSE_HOST=http://ch-1:8123,http://ch-2:8123CLICKHOUSE_NAME=ch-1,ch-2CLICKHOUSE_USER=defaultCLICKHOUSE_PASSWORD=Different credentials per host
Section titled “Different credentials per host”Set a value per position:
CLICKHOUSE_HOST=http://ch-1:8123,http://ch-2:8123CLICKHOUSE_NAME=Production,StagingCLICKHOUSE_USER=prod_user,staging_userCLICKHOUSE_PASSWORD=prod_pass,staging_passDocker examples
Section titled “Docker examples”Replace vX.Y.Z with the release tag you want to run.
Same credentials:
docker run -d \ -e CLICKHOUSE_HOST='http://ch-1:8123,http://ch-2:8123' \ -e CLICKHOUSE_NAME='ch-1,ch-2' \ -e CLICKHOUSE_USER='default' \ -e CLICKHOUSE_PASSWORD='' \ -p 3000:3000 \ --name chmonitor \ ghcr.io/duyet/chmonitor:vX.Y.ZDifferent credentials:
docker run -d \ -e CLICKHOUSE_HOST='http://ch-1:8123,http://ch-2:8123' \ -e CLICKHOUSE_NAME='ch-1,ch-2' \ -e CLICKHOUSE_USER='user1,user2' \ -e CLICKHOUSE_PASSWORD='password1,password2' \ -p 3000:3000 \ --name chmonitor \ ghcr.io/duyet/chmonitor:vX.Y.ZKubernetes / Helm examples
Section titled “Kubernetes / Helm examples”## values.yaml — same credentialsenv: - name: CLICKHOUSE_HOST value: "http://ch-1:8123,http://ch-2:8123" - name: CLICKHOUSE_NAME value: "ch-1,ch-2" - name: CLICKHOUSE_USER value: "default" - name: CLICKHOUSE_PASSWORD value: ""## values.yaml — different credentialsenv: - name: CLICKHOUSE_HOST value: "http://ch-1:8123,http://ch-2:8123" - name: CLICKHOUSE_NAME value: "Production,Staging" - name: CLICKHOUSE_USER value: "prod_user,staging_user" - name: CLICKHOUSE_PASSWORD value: "prod_pass,staging_pass"Install or upgrade:
helm repo add chmonitor https://charts.chmonitor.devhelm upgrade --install chmonitor chmonitor/chmonitor -f values.yaml- Adding or removing a host requires a restart (env change).
- Health alerts run over all configured hosts when
HEALTH_ALERT_ENABLED=true. - The agent API accepts a
hostIdparameter to target a specific host.
See Custom Name for display labels, and Environment Variables for the full connection reference.