# #!/bin/bash
#Zabbix-Agent 5.0
Zabbix Service=192.168.63.20
#安装zabbix源、aliyun YUM源
cd /etc/yum.repos.d/
pm -Uvh https://repo.zabbix.com/zabbix/5.o/rhel/7/x86 64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i.bak 's#repo.zabbix.com#mirrors.aliyun.com/zabbix#'zabbix.reposed -i's#enabled=o#enabled=1#'zabbix.repo
#安装zabbix
yum -y install zabbix-agent
#修改配置文件
sed -ibak "s/^Server=127.0.0.1/Server=$Zabbix Service/" /etc/zabbix/zabbix agentd.confsed -i"s/^ServerActive=127.0.0.1/ServerActive=SZabbix Service/" /etc/zabbixzabbix agentd.conf
sed-i"/^Hostname=/c Hostname=S(echo hostname )" /etc/zabbix/zabbix agentd.conf
#开启zabbix-agent服务 10050 端口
systemctl start zabbix-agent
#设置开机自启
systemctl enable zabbix-agent
#输出提示
echo -e "Now you can use o33[32mnetstat -tnlp o33[om check 033[33mport:10050 033[om