You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To get the project up and running on your local machine, follow these steps:
39
-
40
-
1. Clone the repository
41
-
2. Install dependencies using `npm install` or `yarn install`
42
-
3. Create a `.env.local` file by copying the `.env.example` file and filling in the required environment variables:
43
-
44
-
-`CLICKHOUSE_HOST`: ClickHouse host(s), for example `http://localhost:8123` or `http://ch-1:8123,http://ch-2:8123`
45
-
-`CLICKHOUSE_NAME`: (Optional) Name of ClickHouse instance, must match the number of hosts in `CLICKHOUSE_HOST`, for example `localhost` or `ch-1,ch-2`.
46
-
-`CLICKHOUSE_USER`: ClickHouse user with permission to query the `system` database.
47
-
-`CLICKHOUSE_PASSWORD`: ClickHouse password for the specified user.
48
-
-`CLICKHOUSE_MAX_EXECUTION_TIME`: [`max_execution_time`](https://clickhouse.com/docs/en/operations/settings/query-complexity#max-execution-time) timeout in seconds. Default is `10`.
49
-
-`CLICKHOUSE_TZ`: ClickHouse server timezone. Default: `''`.
50
-
-`NEXT_QUERY_CACHE_TTL`: TTL of [`unstable_cache`](https://nextjs.org/docs/app/api-reference/functions/unstable_cache) - cache the results of most charts to speed up and reuse them across multiple requests. Default: `86400`.
51
-
-`NEXT_PUBLIC_LOGO`: (Optional) HTTP path to logo image.
52
-
-`EVENTS_TABLE_NAME`: The table name for storing dashboard self-tracking events. Default: `system.monitoring_events`
53
-
54
-
4. Run the development server with `npm run dev` or `yarn dev`
55
-
5. Open [http://localhost:3000](http://localhost:3000) in your browser to see the dashboard.
56
-
57
-
## ClickHouse Requirements
58
-
59
-
### 1. Monitoring user role
60
-
61
-
Suggested role for "monitoring" user must have these privileges on `system` database:
62
-
63
-
```xml
64
-
# File: users.d/monitoring_role.xml
65
-
<clickhouse>
66
-
<users>
67
-
<monitoring>
68
-
<password><!-- define password here --></password>
69
-
<profile>monitoring_profile</profile>
70
-
<networks><ip>::/0</ip></networks>
71
-
<grants>
72
-
<query>GRANT monitoring_role</query>
73
-
</grants>
74
-
</monitoring>
75
-
</users>
76
-
77
-
<roles>
78
-
<monitoring_role>
79
-
<grants>
80
-
<query>REVOKE ALL ON *.*</query>
81
-
<query>GRANT SELECT,SHOW,dictGet,REMOTE ON *.*</query>
82
-
<query>GRANT SELECT,INSERT,ALTER,CREATE,DROP,TRUNCATE,OPTIMIZE,SHOW,dictGet ON system.*</query>
83
-
<query>GRANT CREATE TEMPORARY TABLE ON *.*</query>
84
-
</grants>
85
-
</monitoring_role>
86
-
</roles>
87
-
</clickhouse>
88
-
```
89
-
90
-
`CREATE TEMPORARY TABLE` is needed because the UI using `FROM merge(system, '^query_log')` allows retrieving all the data from old tables that were renamed during the upgrade.
For easy deployment, use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme), created by the makers of Next.js. Refer to the [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
117
-
118
-
### 2. Docker
119
-
120
-
Using the latest image here: https://github.com/duyet/clickhouse-monitoring/pkgs/container/clickhouse-monitoring
121
-
122
-
```bash
123
-
docker run -it \
124
-
-e CLICKHOUSE_HOST='http://localhost' \
125
-
-e CLICKHOUSE_USER='default' \
126
-
-e CLICKHOUSE_PASSWORD='' \
127
-
-e CLICKHOUSE_TZ='Asia/Ho_Chi_Minh' \
128
-
-e CLICKHOUSE_MAX_EXECUTION_TIME='15' \
129
-
-e NEXT_QUERY_CACHE_TTL='86400' \
130
-
--name clickhouse-monitoring \
131
-
ghcr.io/duyet/clickhouse-monitoring:main
132
-
```
133
-
134
-
### 3. Kubernetes Helm Chart
135
-
136
-
Using the latest helm chart here: https://github.com/duyet/charts/tree/master/clickhouse-monitoring
You can configured the [`/history-queries`](http://clickhouse-monitoring.vercel.app/0/history-queries) page to filter out the `monitoring` users by default.
10
+
To do this, using these environment variables:
11
+
12
+
-`CLICKHOUSE_EXCLUDE_USER_DEFAULT`: for example `monitoring,healthcheck`.
0 commit comments