if [ -f /etc/issue ]
  then
    SYS_VER=$(cat /etc/issue|awk '{print $1,$2}')
fi
if [ -f /etc/redhat-release ]
  then
    SYS_VER=$(cat /etc/redhat-release|awk '{print $1,$2}')
fi
case "${SYS_VER}" in
     Ubuntu?18.04*)
         wget https://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+bionic_all.deb
         dpkg -i zabbix-release_3.4-1+bionic_all.deb
         apt update
         apt-get install -y zabbix-agent
         ;;
     Ubuntu?16.04*)
         wget https://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
         dpkg -i zabbix-release_3.4-1+xenial_all.deb
         apt update
         apt-get install -y zabbix-agent
         ;;
     Ubuntu?14.04*)
         wget https://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+trusty_all.deb
         dpkg -i zabbix-release_3.4-1+trusty_all.deb
         apt update
         apt-get install -y zabbix-agent
         ;;
     CentOS?*)
         rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
         yum install -y zabbix-agent zabbix-sender
         ;;
     *)
     echo '不能识别的操作系统'
     exit
     ;;
esac
sed -i 's/Server=127.0.0.1/Server=118.24.186.59/g' /etc/zabbix/zabbix_agentd.conf
sed -i 's/ServerActive=127.0.0.1/ServerActive=118.24.186.59/g' /etc/zabbix/zabbix_agentd.conf
systemctl enable zabbix-agent.service
systemctl restart zabbix-agent.service

