Zabbix distributed monitoring platform deployment <5>--zabbix-proxy deployment and combined with Ruixiang Cloud to issue warnings

1. Introduction to zabbix-proxy

Zabbix proxy can replace the zabbix server to collect performance and availability data, and then report the data to the zabbix server, and to a certain extent share the pressure of the zabbix server.
In addition, when all agents and proxies report to a Zabbix server and all data is collected in a centralized manner When using proxy is the easiest way to achieve centralized and distributed monitoring.
Zabbix proxy usage scenario:
monitor remote area equipment
monitor local network unstable area
When zabbix monitors thousands of devices, use it to reduce the pressure on the server and
simplify the maintenance of distributed monitoring
Schematic diagram of working principle:
Insert picture description here
Zabbix proxy only needs a tcp connection to the zabbix server, so only one rule needs to be added to the firewall
Note 1:The zabbix proxy database must be separated from the server, otherwise the data will be destroyed.
After the proxy collects the data, it first caches the data locally, and then passes it to the zabbix server after a certain amount of time, so that data will not be lost due to any temporary communication problems with the server. This time is determined by the parameters ProxyLocalBuffer and ProxyOfflineBuffer in the proxy configuration file.
Note 2:Note that the proxy that directly updates the latest configuration from the Zabbix server database may be newer than the Zabbix server, and the configuration of the Zabbix server cannot be updated quickly due to CacheUpdateFrequency. Therefore, the data collected and sent by the proxy to the Zabbix server may be ignored.
Note 3: zabbix proxy is a data collector, it does not calculate triggers, process events, or send alarms

2. Specific department

1. Create a proxy host

这里我们将server3作为一个zabbix-proxy代理主机:
systemctl disable --now zabbix-agent.service      %先停止zabbix-agent服务
yum install -y zabbix-proxy-mysql             %安装工具包
hostnamectl set-hostname proxy             %设置主机名便于区分,并且记得添加解析

Insert picture description here
Insert picture description here

2. Create a proxy database and import the data into the database

MariaDB [(none)]> create database zabbix_proxy character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user 'zabbix'@'localhost' identified by 'westos';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix_proxy.* to 'zabbix'@'localhost';
Query OK, 0 rows affected (0.00 sec)

Insert picture description here
Insert picture description here

3. Modify the configuration file

[root@proxy ~]# grep -v ^# /etc/zabbix/zabbix_proxy.conf | uniq      %显示更改部分
Server=172.25.0.1
Hostname=proxy
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
SocketDir=/var/run/zabbix
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=westos
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

systemctl enable --now zabbix-proxy     %开启代理服务

Insert picture description here

4. Graphically add proxy host

Insert picture description here
Insert picture description here
Insert picture description here

5.zabbix-server refresh settings

zabbix_server -R config_cache_reload      %刷新使生效

proxy主机中:
[root@proxy zabbix-proxy-mysql-4.0.27]# grep -v ^# /etc/zabbix/zabbix_proxy.conf | uniq
Server=172.25.0.1
Hostname=proxy
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
SocketDir=/var/run/zabbix
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=westos
JavaGateway=172.25.0.1 
JavaGatewayPort=10052
StartJavaPollers=5
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

6. Settings in zabbix-agent (client)

vim /etc/zabbix/zabbix_agentd.conf      %修改配置文件
systemctl restart zabbix-agent.service  %重启服务使生效

proxy主机中:
systemctl restart zabbix-proxy.service  %重启服务

Insert picture description here
Note: Remember to add proxy resolution to all hosts
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

3. Issue warning information in conjunction with Ruixiang Cloud Platform

Significance: Cloud warnings can be used to access monitoring system/platform alarms, centralized alarm information, unified notifications, and unified analysis.
It supports direct integration of mainstream monitoring tools in the industry, such as: Zabbix, Nagios, Prometheus, OpenFalcon, SolarWinds, etc., and alarm information can also be accessed through Email integration or REST API.

1. Sign up for Ruixiang Cloud

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

2. Set the alarm media type on the monitoring terminal

Insert picture description here

3. Combine probes to enable the cloud warning platform to detect warning information (the connection between zabbix and the cloud warning platform)

tar zxf ca_zabbix_release-2.1.0.tar.gz -C /usr/bin/zabbix/alertscripts  %解压到指定路径下
[root@server1 bin]# pwd
/usr/lib/zabbix/alertscripts/cloudalert/bin
[root@server1 bin]#systemctl stop zabbix-agent.service
[root@server1 bin]# bash install.sh xxxxxxxxxxx  %使用上面获取的key来运行脚本

Insert picture description here
Insert picture description here

4. Test

systemctl stop zabbix-server      %将zabbix-server端服务关闭,看云警告平台是否能够及时向微信发送警告信息

Insert picture description here
Insert picture description here
Warning message notification received by mobile phone WeChat:
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/nk298120/article/details/115360064