Grafana

You can install grafana on bare metal or you use their docker image. Either way, if you want to use it with Clickhouse, you must download the according connector plugin. This is for bare metal:

sudo grafana-cli plugins install vertamedia-clickhouse-datasource
sudo grafana-cli plugins update vertamedia-clickhouse-datasource

Then tell grafana, that its ok to use that plugin:

vim /etc/grafana/grafana.ini
//in this file set the prop "allow_loading_unsigned_plugins"=vertamedia-clickhouse-datasource

Then restart grafana:

service grafana-server restart

You can check that the clickhouse-connector is available by typing ‘localhost:3000’ into your browser:

If you are using Docker you need to download the zip file for the connector and then copy it into the image using the “volume”-option, i.e. “-v”. It is important to pass the absolute path. The property is passed as a command line parameter when starting the container:

docker run -v /home/xx/programs/pluginsGrafana:/var/lib/grafana/plugins -d    --rm -e "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=vertamedia-clickhouse-datasource"  -p 3000:3000  --name=grafana grafana/grafana 

Now, that Grafana is up and working we must add a new datasource. We click “add datasource” and choose “clickhouse”. We must then configure how we want to access the database. As access chose “server default”.

As URL we choose localhost:8123 since this is clickhouse’s default. We also need to configure the login. If we created the database with default user and no password we must specify this here. So – activate “basic auth” and “with credentials”. Below in the “User” field write “default” and click into the field for the password and click, since its empty. Its important that you overwrite the offered standardsettings, although they look exactly like what you type in. But if you don’t explicitly specifiy this, it will give you a connection error.