For the installation of Grafana+Prometheus, please refer to the installation of Grafana+Prometheus+Pushgateway Three Musketeers_Those Fun Blogs-CSDN Blog Blog Post
1: Modify the clickhouse configuration file /etc/clickhouse-server/config.xml , open config.xml, and modify the following configuration. This configuration should be commented out, just open it. It is the configuration of the interface exposed by clickhouse.
<prometheus>
<endpoint>/metrics</endpoint>
<port>9363</port>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
<status_info>true</status_info>
</prometheus>
2: Restart clickhouse
sudo systemctl start clickhouse-server
3: Open the browser and visit http://xx.xx.xx.xx:9363/metrics to check whether the access is successful, (xx.xx.xx.xx is the ip of the clickhouse server installed)
4: Prometheus adds clickhouse configuration, fill in job_nam casually, do not repeat, targets is the address that clickhouse exposes the interface to Prometheus
- job_name: 'clickhouse-xx.xx.xx.xx'
static_configs:
- targets: ['xx.xx.xx.xx:9363']
5: Grafana adds a data template, visit the dashboard address: Dashboards | Grafana Labs ; search clickhouse to find the data template, find the downloaded json file that matches your own and import it into Grafana or directly load and import it by id.