一、节点信息概述
server1: shard1(9001端口) shard3副本(9002端口)
server2: shard2(9001端口) shard1副本(9002端口)
server4: shard3(9001端口) shard2副本(9002端口)
二、前期准备
1)xmllint安装
下载地址:https://centos.pkgs.org/7/centos-x86_64/libxml2-2.9.1-6.el7_2.3.x86_64.rpm.html
rpm -ivh libxml2-2.9.1-6.el7_2.3.x86_64.rpm
2)确保clickhouse-client已经安装
三、配置
1)修改zabbix-agent配置
# 新增文件
/etc/zabbix/zabbix_agentd.d/userparameter_clickhouse.conf
________________________________________________________
UserParameter=ch_params[*],sh /etc/clickhouse-server/zbx_clickhouse_monitor.sh "$1" "localhost" 9001 "gzdata" /etc/clickhouse-server/config9001.xml
UserParameter=ch_params-replication[*],sh /etc/clickhouse-server/zbx_clickhouse_monitor.sh "$1" "localhost" 9002 "gzdata" /etc/clickhouse-server/config9002.xml
________________________________________________________
2)下载脚本和模板(zbx_clickhouse_monitor.sh)
下载地址:https://github.com/Altinity/clickhouse-zabbix-template
1)把 zbx_clickhouse_monitor.sh 放到 /etc/clickhouse-server 目录下
2)导入 zbx_clickhouse_template.xml 模板
四、重启zabbix-agent服务
systemctl restart zabbix-agent
附件:
配置下载,修改后的,支持clickhouse账号密码,配置文件可变的脚本
(zbx_clickhouse_monitor.sh、zbx_clickhouse_template.xml、zbx_clickhouse_template-replication.xml)
https://download.csdn.net/download/qq_23160237/11812433