Zabbix-proxy

Install

rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
rpm -ivh http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
yum install zabbix-proxy-mysql -y
yum install mariadb-server -y
systemctl enable mariadb && systemctl start mariadb

Prepare database with little script - vi mysql_secure_installation.sql:

UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
FLUSH PRIVILEGES;
mysql -sfu root < mysql_secure_installation.sql

mysql -u root -p

zcat /usr/share/doc/zabbix-proxy-mysql-4.2.1/schema.sql.gz | mysql -u zabbixuser zabbix_proxy -p

You can use jinja template for config of zabbix-agent /etc/zabbix/zabbix_proxy.conf. Default settings on agent (other options generally useless):

PidFile=/var/run/zabbix/zabbix_proxy.pid
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
Server={{ Proxy[hostname] }}
ServerActive={{ Proxy[hostname] }}
Hostname={{ Host[hostname] }} # !!!Must be like name of host in web
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

If we use selinux, need allow zabbix-agent, or check that selinux disabled. Change rules of firewalld and start:

firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --reload
systemctl enable zabbix-proxy & systemctl start zabbix-proxy

Monitoring in zabbix

Using default template Template App Zabbix Proxy. For collecting metrics from proxy, option Server/ServerActive must = in zabbix-agent config.

Upgrade

While upgrading Zabbix agents is not mandatory (but recommended), Zabbix server and proxies must be of the same major version. Therefore, in a server-proxy setup, Zabbix server and all proxies have to be stopped and upgraded. Keeping proxies running during server upgrade no longer will bring any benefit as during proxy upgrade their old data will be discarded and no new data will be gathered until proxy configuration is synced with server.

service zabbix-proxy stop & service zabbix-agent stop
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum upgrade zabbix-proxy-mysql zabbix-agent -y
systemctl start zabbix-proxy & systemctl start zabbix-agent

SQLite

Please note that if you have a proxy with a SQLite database, the history data of these proxies will be lost until the update. As updating the SQLite database file is not supported and this file must be deleted manually. When the proxy is started for the first time and the SQLite database file is missing, the proxy will create it automatically.

Playbook for update on Centos 7

    - name: STOP zabbix-proxy
      service:
        name: zabbix-proxy
        state: stopped

    - name: rpm-zabbix-5.0-1
      yum: name=https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

    - name: UPGRADE zabbix-proxy
      yum:
        name: zabbix-proxy
        state: latest

    - name: START zabbix-proxy
      service:
        name: zabbix-proxy
        state: started
  when: 
    - ansible_facts['distribution'] == 'CentOS'
    - ansible_facts['distribution_major_version'] == "7"
  become: true
  ignore_errors: yes

Parameters

When changing the parameters in the /etc/zabbix/zabbix_proxy.conf config, you need to restart the proxy to apply the changes: service zabbix-proxy restart or/etc/init.d/zabbix-proxy restart.

We check the proxy status via service zabbix-server status or if it is not clearjournalctl -xe and in the log /var/log/zabbix/zabbix-proxy.log.

To manually pull the configuration from the server without waiting for an automatic request: zabbix_proxy -R config_cache_reload

In the proxy parameters, there are Pollers - these are processes that poll agents. A lot of them are needed in two cases: a large network and many unavailable resources are monitored. The increase in processes puts a lot of stress, thereby consuming precious resources.

There is also an important timeout parameter that needs to be adjusted for current tasks. All checks that do not fit into it will be spent.

If you do not monitor the use of pollers, then triggers of the form "Zabbix unreachable poller processes more than 75% busy" will probably appear, which indicate that their number is not enough. It can be the same with the cache, especially considering that there are several of them.

https://www.zabbix.com/documentation/5.0/manual/concepts/proxy?s[]=proxy https://www.zabbix.com/documentation/5.0/manual/distributed_monitoring/proxies?s[]=proxy

Built on GitHub with MkDocs and Pure theme