Skip to main content
Grafana dashboards that monitor ClickHouse query tables of the system database. They do not need the default user. Create a role that has SELECT on the system tables the panels read, add the SHOW privileges that make the rows of those tables visible, and grant the role to a dedicated user.

Create the role and the user

The role below covers the system tables read by the ClickHouse - Cluster Analysis, ClickHouse - Data Analysis and ClickHouse - Query Analysis dashboards that are bundled with the ClickHouse data source plugin for Grafana:
Use the grafana user in the data source configuration. To adapt the list to your dashboards, search the SQL of their panels for system. and grant SELECT on every table you find. If a panel fails with an ACCESS_DENIED error, the message names the missing grant, for example:
The plugin also bundles the Advanced ClickHouse Monitoring Dashboard. Its panels read the metric log tables through the merge table function, and its Cloud overview panels query all replicas with clusterAllReplicas. For this dashboard, add:
The REMOTE grant is needed by any panel that uses the cluster or clusterAllReplicas table function. For the same grants applied to the dashboard built into ClickHouse, see Which grants does a user need to use the built-in advanced dashboard?. system.query_log contains the text of the queries of all users. Leave it out of the role if the people who use the dashboards must not see them.

Why the SHOW privileges are needed

SELECT on a system table is not enough for the tables that describe databases, tables, columns and dictionaries. These tables return only the rows about objects that the user is allowed to see, so without SHOW privileges the panels are empty and no error is reported. In the role above this affects: GRANT SHOW ON *.* grants these four privileges for all databases. It exposes the names and the structure of the objects, not their data: with this role, a SELECT from a table outside the system database is still refused. To limit what the dashboards show, grant SHOW on selected databases, for example GRANT SHOW ON db1.* TO grafana_monitoring. system.clusters, system.disks and system.query_log are not filtered this way. For details and the list of other filtered tables, see Why is system.parts empty for a user that has SELECT on it?.

Settings that the plugin changes

The role makes the user read-only through its privileges, and such a user can still change query settings. That matters because, as the Grafana integration guide explains, the user must be able to modify the max_execution_time setting. If you additionally restrict the user with readonly = 1, settings cannot be changed any more, so allow this one explicitly: