Altinity
ClickHouse Leading Service Provider

Blog

ClickHouse monitoring with Zabbix

Sept 4, 2018

Intro

Altinity is happy to introduce a new tool in ClickHouse environment - Zabbix template for monitoring ClickHouse. It is open source and available on github

Let's walk in details on how to install and setup this template.

Prerequisites

The following tools are required to be installed before we can start:

  • Zabbix monitoring platform. More details are available here
  • xmllist - command line XML tool
  • clickhouse-client - ClickHouse CLI client tool

xmllint is used to parse clickhouse's config file, which is an XML. xmllint is included in libxml package, so you may need to install it.

clickhouse-client is used to run commands with ClickHouse. clickhouse-client packages are available for installations for

  • deb-based distributions. More details and installation instructions here
  • rpm-based distributions. More details and installation instructions here

Getting started

ClickHouse monitoring template is available on github.

Setup monitoring

You need to obtain the template locally. You can either:

  • clone it with git as
    git clone https://github.com/Altinity/clickhouse-zabbix-template
  • or download two files, one of which is a monitoring script, the other is Zabbix template XML file.
    wget https://raw.githubusercontent.com/Altinity/clickhouse-zabbix-template/master/zbx_clickhouse_monitor.sh
    wget https://raw.githubusercontent.com/Altinity/clickhouse-zabbix-template/master/zbx_clickhouse_template.xml
    Make monitoring script executable
    chmod a+x zbx_clickhouse_monitor.sh
    Now, having template and monitoring script locally available, we can setup Zabbix configuration.
  • Edit /etc/zabbix/zabbix_agentd.conf and add launch command for monitoring script. Example:
    UserParameter=ch_params[*],sh /PATH/TO/zbx_clickhouse_monitor.sh "$1" "HOST_WHERE_CLICKHOUSE_IS_RUNNING"
    Where:
  • zbx_clickhouse_monitor.sh is a monitoring script, which is in charge of fetching monitoring data samples from clickhouse being monitored.
  • /PATH/TO/zbx_clickhouse_monitor.sh depends on where you've cloned template's repo.
  • HOST_WHERE_CLICKHOUSE_IS_RUNNING is an optional parameter which tells what clickhouse instance are we going to fetch data from. In case none specified localhost would be used.

Setup Zabbix template

Import template as following:

  • Open Zabbix
  • Select Configuration
image01.png
  • Select Templates
image02.png
  • Click Import Template
image03.png
  • Choose zbx_clickhouse_template.xml file. Location depends on where you've cloned Zabbix template
image04.png
image05.png
  • Click Import That's it - now ClickHouse monitoring should be availbale and new Graphs with ClickHouse data should be added.

Graphs available

image06.png
image07.png
image08.png
image09.png
image10.png
image11.png

Conclusion

It is easy to setup ClickHouse monitoring with Zabbix by using Altinity's Zabbix template. Give it a try!

Links