环境:
系统:redhat7.9
zabbix版本 5.0 (版本的话无所谓直接根据需求换版本就行)
需要可以联网,如果不能联网就根据链接下载rpm包就可以
#install zabbix
#need network,or else install;
rpm -ivh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
yum repolist
yum install zabbix-agent -y
if rpm -qa | grep -q zabbix-release-5.0-1.el7.noarch; then
echo "zabbix-agent install succeed"
sed -i "s/^Server=127.0.0.1/Server=192.168.50.53/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/^ServerActive=127.0.0.1/ServerActive=192.168.50.53/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/Hostname=Zabbix server/Hostname=`hostname`/g" /etc/zabbix/zabbix_agentd.conf
systemctl enable zabbix-agent
if systemctl start zabbix-agent; then
echo "zabbix-agent starting success"
else
echo "zabbix-agent starting failed"
fi
else
echo "please check zabbix-agent"
fi
这个就是最基本的脚本哈 只是我给串联起来了 相信大家都可以看懂