Zabbix–部署–03–proxy安装–6.0
1、介绍
1.1、官方安装文档
https://www.zabbix.com/cn/download
1.2、环境介绍
- 操作系统:centos7
- zabbix版本:6.0 LTS
2、准备工作
2.1、关闭SELinux,防火墙
# 关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
# 永久禁用SELinux,将SELinux=enforcing改为SELinux=disabled
sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/sysconfig/selinux
# 配置后再重启
reboot
2.2、初始化 软件仓库
用来找到zabbix官方网站提供的软件
# 改用清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/
rpm -Uvh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-4.el7.noarch.rpm
yum clean all
2.3、替换为 清华镜像源
# 替换清华镜像
sed -i 's#https://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g' /etc/yum.repos.d/zabbix.repo
sed -i 's#https://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g' /etc/yum.repos.d/zabbix-agent2-plugins.repo
2.4、修改主机名称
sysctl kernel.hostname=zbx-proxy
sed -i 's/zhoufei/zbx-proxy/g' /etc/hostname
3、安装 Zabbix proxy
yum install -y zabbix-proxy-mysql zabbix-sql-scripts zabbix-selinux-policy
4、安装MySql
https://blog.csdn.net/zhou920786312/article/details/115252051
5、创建zabbix数据库
5.1、创建初始数据库
create database zabbix_proxy character set utf8mb4 collate utf8mb4_bin;
create user zabbix@localhost identified by '1234';
grant all privileges on zabbix_proxy.* to zabbix@localhost;
flush privileges;
set global log_bin_trust_function_creators = 1;
quit;
5.2、导入sql脚本
cat /usr/share/zabbix-sql-scripts/mysql/proxy.sql | mysql --default-character-set=utf8mb4 -uzabbix -p1234 --database=zabbix_proxy
5.3、导入数据后禁用log_bin_trust_function_creators选项
mysql> set global log_bin_trust_function_creators = 0;
6、配置与启动
6.1、修改配置
vim /etc/zabbix/zabbix_proxy.conf
# 为Zabbix proxy配置数据库密码
DBPassword=1234
# 配置zabbix server服务器
sed -i 's#Server=127.0.0.1#Server=192.168.187.11#g' /etc/zabbix/zabbix_proxy.conf
# 配置zabbix proxy名称
sed -i 's#Hostname=Zabbix proxy#Hostname=zbx-proxy#g' /etc/zabbix/zabbix_proxy.conf
# 查看配置
grep '^[a-Z]' /etc/zabbix/zabbix_proxy.conf
6.2、启动Zabbix proxy
systemctl restart zabbix-proxy
systemctl enable zabbix-proxy
6.3、查看日志
cat /var/log/zabbix/zabbix_proxy.log
7、常见错误
7.1、数据库连接不上
[Z3001] connection to database 'zabbix_proxy' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
Cannot connect to the database. Exiting...
解决方法
# 登录Mysql
mysql -u root -p
# 修改加密规则
ALTER USER 'zabbix'@'localhost' IDENTIFIED BY '1234' PASSWORD EXPIRE NEVER;
# 更新一下用户的密码
ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234';
# 刷新权限
FLUSH PRIVILEGES;
# 重置密码
alter user 'zabbix'@'localhost' identified by '1234';
7.2、cannot send proxy data to server at “192.168.187.11”: proxy “zbx-proxy” not found
看这里
Zabbix--基础--4.6.2--进阶--proxy代理--配置