- 环境:
192.168.117.132——zabbix server
192.168.117.133——zabbix proxy - 安装路径为/zabbix
- 安装zabbix proxy及zabbix agent
1.安装部署mysql
https://www.cnblogs.com/old-path-white-cloud/p/13861748.html
2.安装proxy
proxy安装和server安装大致相同,只是编译时的选项有所不同,细节步骤可以参考
https://www.cnblogs.com/old-path-white-cloud/p/13863755.html
以下是差异部分
编译安装
tar -xf zabbix-4.0.25.tar.gz cd zabbix-4.0.25 #proxy和agent同时安装 ./configure --prefix=/zabbix/zabbix --enable-proxy --enable-agent --with-mysql=/zabbix/mysql/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi make -j4 && make install
导入数据
mysql -uzabbix -pzabbixpasswd zabbix < /root/zabbix-4.0.25/database/mysql/schema.sql
编辑配置文件
#proxy配置文件 cat > /zabbix/zabbix/etc/zabbix_proxy.conf << EOF Server=192.168.117.132 ListenPort=10051 LogFile=/zabbix/zabbix/logs/zabbix_proxy.log PidFile=/zabbix/zabbix/logs/zabbix_proxy.pid #主机名要与server web页面上的主机名一致
Hostname=ricky04 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbixpasswd DBPort=3306 DBSocket=/zabbix/mysql/logs/mysql.sock Timeout=4 LogSlowQueries=3000 User=zabbix Include=/zabbix/zabbix/etc/zabbix_proxy.conf.d/*.conf ProxyLocalBuffer=0 ProxyOfflineBuffer=3 HeartbeatFrequency=60 ConfigFrequency=60 DataSenderFrequency=1 CacheSize=2G HistoryCacheSize=64M HistoryIndexCacheSize=10M StartPollersUnreachable=20 Timeout=6 EOF
#赋权
chown -R zabbix.zabbix /zabbix/zabbix
#添加systemctl cat > /usr/lib/systemd/system/zabbix-proxy.service << EOF [Unit] Description=Zabbix Proxy After=syslog.target After=network.target [Service] Environment="CONFFILE=/zabbix/zabbix/etc/zabbix_proxy.conf" Type=forking Restart=on-failure PIDFile=/zabbix/zabbix/logs/zabbix_proxy.pid KillMode=control-group ExecStart=/usr/sbin/zabbix_proxy -c $CONFFILE ExecStop=/bin/kill -SIGTERM $MAINPID RestartSec=10s TimeoutSec=0 [Install] WantedBy=multi-user.target EOF #复制二进制文件至/usr/sbin cp /zabbix/zabbix/sbin/* /usr/sbin/ #添加库文件,不然启动报错 ln -sf /zabbix/mysql/mysql/lib/libmysqlclient.so.20 /usr/lib64
启动zabbix
systemctl start zabbix-proxy
#添加开机启动
systemctl enable zabbix-proxy
页面添加proxy
经过一段时间,zabbix-server就可以发现zabbix-proxy
#安装agent
方式同server的agent安装
只是配置文件有所不同
cat > /zabbix/zabbix/etc/zabbix_agentd.conf << EOF ListenPort=10050 LogFileSize=1 LogFile=/zabbix/zabbix/logs/zabbix_agentd.log PidFile=/zabbix/zabbix/logs/zabbix_agentd.pid Server=127.0.0.1,192.168.117.133 ServerActive=127.0.0.1,192.168.117.133 Hostname=ricky04 StartAgents=1 Timeout=5 User=zabbix Include=/zabbix/zabbix/etc/zabbix_agentd.conf.d/*.conf UnsafeUserParameters=1 EOF
启动之后需要在页面添加主机
添加2个模板
状态已经正常
至此zabbix-proxy,zabbix-agent安装完成