Zabbix is another enterprise grade open source monitoring tool that has the advantage to be MySQL/PostgreSQL/SQLite/Oracle backed for storing
all the configurations and collected data.
As an alternative to installing agent on hosts it includes support for SNMP, TCP and ICMP checks, also JMX, SSH, Telnet, IPMI.
List of interesting features:
- High performance, high capacity
- Auto-discovery support
- Distributed monitoring
- Web based interface
- Agent and Agent-less support
Setup prerequisites:
- 2 LXC containers for Zabbix instances
- Pre-installed and working Galera cluster
- Pre-installed and working HAProxy cluster
Steps to create Zabbix HA:
Install Zabbix on both containers
for host in {zabbix01,zabbix02}; do ssh [email protected]$host 'rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm'; done
for host in {zabbix01,zabbix02}; do ssh [email protected]$host 'yum -y install zabbix-server-mysql zabbix-web-mysql'; done
Create database user on the Galera cluster
create database zabbix;
grant all privileges on zabbix.* to [email protected]'192.168.%' identified by 'Password123';
Populate the database with initial configuration
zcat /usr/share/doc/zabbix-server-mysql-3.0.0/create.sql.gz | mysql -u root -p zabbix -h galera.domain.tld
Configure Zabbix
vi /etc/zabbix/zabbix_server.conf
and change the lines below to march your Galera informations
DBHost=galera.domain.tld
DBName=zabbix
DBUser=zabbix
DBPassword=Password123
Enable and start Zabbix
for host in {zabbix01,zabbix02}; do ssh [email protected]$host 'systemctl enable zabbix && systemctl start zabbix'; done
for host in {zabbix01,zabbix02}; do ssh [email protected]$host 'systemctl enable httpd && systemctl start httpd'; done
Avoid deadlocks because of HAProxy and Zabbix internals
Login to your HAProxy cluster nodes and make sure you are not using round robin load balancing but active-backup for Galera nodes
vi /etc/haproxy/haproxy.cfg
And change it to be similar to the setup below:
# Zabbix web frontend
listen http *:80
option httplog
option httpclose
option forwardfor
reqadd X-Forwarded-Proto:\ http
# define hosts
acl zabbix hdr(host) -i zabbix.domain.tld
# figure out what backends to use based on request
use_backend zabbix_cluster if zabbix
backend zabbix_cluster
balance roundrobin
server zabbix01 192.168.100.30:80 check
server zabbix02 192.168.100.31:80 check
# Galera backend
listen galera *:3306
mode tcp
option httpchk
balance leastconn
server galera01 192.168.100.101:3306 check port 9200
server galera02 192.168.100.102:3306 check port 9200 backup
server galera03 192.168.100.103:3306 check port 9200 backup
For HAProxy health check on Galera nodes go http://www.zeding.ro/galera-cluster-for-mysql-true-multi-master-on-centosrhel-7-x/ at paragraph HAProxy monitoring for Galera.
Restart HAProxy
systecmtl restart haproxy
Now access you Zabbix setup
Point your browser to http://zabbix.domain.tld
Default credentials are: Admin / zabbix
Now you can start customizing and using it.