zabbix proxy 安装

zabbix proxy 4.0.x 安装

# 官方安装参考链接:
https://www.zabbix.com/download?zabbix=4.0&os_distribution=centos&os_version=7&components=proxy&db=mysql&ws=

# Install Zabbix repository
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all

# Install Zabbix proxy
yum install zabbix-proxy-mysql -y

# 安装、初始化数据库。Zabbix-proxy也要连接一个数据库,一般安装在本地即可。
yum install -y mariadb*  # (其实只下载mariadb、mariadb-server、mariadb-devel也可)
systemctl start mariadb
systemctl enable mariadb

#mysql_secure_installation 设置mysql账户root密码

# 也可以直接设置mysql密码,mariadb 如果在本机是第一次安装,是没有密码滴,可以直接设置;如果在本机是再次安装,需要删除之前mysql的数据
/usr/bin/mysqladmin -u root password 'newpassword'

# Create initial database
mysql -uroot -p
newpassword
MariaDB [(none)]> create database zabbix_proxy character set utf8 collate utf8_bin;
MariaDB [(none)]> create user zabbix_proxy@localhost identified by 'zabbix_proxy';
MariaDB [(none)]> grant all privileges on zabbix_proxy.* to zabbix_proxy@localhost;
MariaDB [(none)]>  flush privileges;

# 导入 zabbix proxy 表结构
zcat /usr/share/doc/zabbix-proxy-mysql*/schema.sql.gz | mysql -uzabbix_proxy -p zabbix_proxy

# 修改 zabbix proxy 配置文件
/etc/zabbix/zabbix_proxy.conf
Server=127.0.0.1 # zabbix server IP地址
DBName=zabbix_proxy
DBUser=zabbix_proxy
DBPassword=zabbix_proxy
# zabbix 中的简单检查需要依赖 ping,所以需要配置fping命令
FpingLocation=/usr/sbin/fping

# 另外需要给 fping 配置 zabbix 用户的权限
[root@ip-10-250-0-214 zabbix]# whereis fping
fping: /usr/sbin/fping /usr/share/man/man8/fping.8.gz
chown root:zabbix /usr/sbin/fping
chmod 4710 /usr/sbin/fping
groups zabbix
usermod -a -G zabbix zabbix
# 官方链接:https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/simple_checks

# 启动 zabbix proxy
systemctl restart zabbix-proxy
systemctl enable zabbix-proxy

# 查看 zabbix proxy启动进程
[root@ip-10-23-12-6 ec2-user]# ps axu |grep zabbix
zabbix    3534  0.0  0.2 228660  8496 ?        S    03:40   0:00 /usr/sbin/zabbix_proxy -c /etc/zabbix/zabbix_proxy.conf

# 查看 zabbix proxy 日志
[root@ip-10-23-12-6 ec2-user]# tail -5 /var/log/zabbix/zabbix_proxy.log
  3547:20221104:035046.808 cannot send proxy data to server at "127.0.0.1": empty string received
  3547:20221104:035047.808 cannot send proxy data to server at "127.0.0.1": empty string received
  3547:20221104:035048.809 cannot send proxy data to server at "127.0.0.1": empty string received
  3547:20221104:035049.809 cannot send proxy data to server at "127.0.0.1": empty string received
  3547:20221104:035050.810 cannot send proxy data to server at "127.0.0.1": empty string received

posted @ 2022-11-04 11:52  Star-Hitian  阅读(232)  评论(0编辑  收藏  举报