The simple Next.js dashboard that relies on system.*
tables to help monitor and provide an overview of your ClickHouse cluster.
Features:
- Query monitor: current queries, query history, query resources (memory, parts read, file_open, ...), most expensive queries, most used tables or columns, etc.
- Cluster monitor: total memory/CPU usage, distributed queue, global settings, mergetree settings, metrics, etc.
- Tables and parts information: size, row count, compression, part size, etc., at the column level detail.
- Useful tools: Zookeeper data exploration, query EXPLAIN, kill queries, etc.
- Visualization metric charts: queries and resource usage, number of merges/mutation, merge performance, query performance, etc.
To get the project up and running on your local machine, follow these steps:
-
Clone the repository
-
Install dependencies with
npm install
oryarn install
-
Create a
.env.local
file by copying the.env.example
file and filling in the required environment variables:CLICKHOUSE_HOST
: ClickHouse host, for examplehttp://localhost:8123
CLICKHOUSE_USER
: ClickHouse user with permission to query thesystem
database.CLICKHOUSE_PASSWORD
: ClickHouse password for the specified user.CLICKHOUSE_MAX_EXECUTION_TIME
:max_execution_time
timeout in seconds. Default is10
.CLICKHOUSE_TZ
: ClickHouse server timezone. Default:''
.NEXT_QUERY_CACHE_TTL
: TTL ofunstable_cache
- cache the results of most charts to speed up and reuse them across multiple requests. Default:86400
.
-
Run the development server with
npm run dev
oryarn dev
-
Open http://localhost:3000 in your browser to see the dashboard.
For easy deployment, use the Vercel Platform, created by the makers of Next.js. Refer to the Next.js deployment documentation for more details.
Using the latest image here: https://github.com/duyet/clickhouse-monitoring/pkgs/container/clickhouse-monitoring
docker run -it \
-e CLICKHOUSE_HOST='http://localhost' \
-e CLICKHOUSE_USER='default' \
-e CLICKHOUSE_PASSWORD='' \
-e CLICKHOUSE_TZ='Asia/Ho_Chi_Minh' \
-e CLICKHOUSE_MAX_EXECUTION_TIME='15' \
-e NEXT_QUERY_CACHE_TTL='86400' \
--name clickhouse-monitoring \
ghcr.io/duyet/clickhouse-monitoring:main
Using the latest helm chart here: https://github.com/duyet/charts/tree/master/clickhouse-monitoring
helm repo add duyet https://duyet.github.io/charts
cat <<EOF >> values.yaml
env:
- name: CLICKHOUSE_HOST
value: http://localhost:8123
- name: CLICKHOUSE_USER
value: default
- name: CLICKHOUSE_PASSWORD
value: ''
- name: CLICKHOUSE_TZ
value: 'Asia/Ho_Chi_Minh'
- name: CLICKHOUSE_MAX_EXECUTION_TIME
value: '15'
- name: NEXT_QUERY_CACHE_TTL
value: '86400'
EOF
helm install -f values.yaml clickhouse-monitoring-release duyet/clickhouse-monitoring
# File: users.d/monitoring_role.xml
<clickhouse>
<users>
<monitoring>
<!-- define password here -->
<profile>default</profile>
<networks><ip>::/0</ip></networks>
<grants>
<query>GRANT monitoring_role</query>
</grants>
</monitoring>
</users>
<roles>
<monitoring_role>
<grants>
<query>REVOKE ALL ON *.*</query>
<query>GRANT SELECT,SHOW,dictGet,REMOTE ON *.*</query>
<query>GRANT SELECT,INSERT,ALTER,CREATE,DROP,TRUNCATE,OPTIMIZE,SHOW,dictGet ON system.*</query>
</grants>
</monitoring_role>
</roles>
</clickhouse>
Feedback and contributions are welcome! Feel free to open issues or submit pull requests.
MIT. See LICENSE for more details.