1、首先下载agent2的安装包
我是X86的centos 7系统,zabbix-agent2-5.0.42-1.el7.x86_64.rpm下载地址,另外很多国产系统统信、中科方德也适用这个版本。
这个网站里面有其他版本的,自行选择下载
https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/
zabbix_agent2_installsh_6">2、zabbix_agent2_install.sh脚本如下
#!/bin/bash
if [ ! -f /etc/zabbix/zabbix-agent2.conf ]; then
cd /root
wget https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-agent2-5.0.42-1.el7.x86_64.rpm
systemctl status zabbix_agentd
systemctl stop zabbix_agentd
systemctl disable zabbix_agentd
rm -f /usr/local/systemd/system/zabbix_agentd.service
rm -f /etc/rc.d/init.d/zabbix_agentd
systemctl daemon-reload
systemctl status zabbix_agentd
rm -rf /usr/local/zabbix
cd /root
yum install zabbix-agent2-5.0.42-1.el7.x86_64.rpm -y
systemctl start zabbix-agent2
systemctl enable zabbix-agent2
systemctl status zabbix-agent2
fi