2019-09-27Centos7.2安装zabbix_agents.sh脚本

脚本使用说明:sh file eth0 sh install-zabbix-agent.sh

 ethoIP1为zabbix-server端的ip地址 192.168.68.40

$1指脚本外传的eth0网卡的参数


#/bin/bash

IP=$(/sbin/ifconfig $1 |awk 'NR==2{print $0}'|awk '{print $2}')

IP1=10.1.1.19

/usr/bin/wget -P /home/py http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-agent-4.2.1-1.el7.x86_64.rpm

/bin/rpm -ivh /home/py/zabbix-agent-4.2.1-1.el7.x86_64.rpm

systemctl enable zabbix-agent.service

#systemctl start zabbix-agent.service

sed -i "s/Server\=127.0.0.1/Server\=$IP1/g;s/ServerActive\=127.0.0.1/ServerActive\=$IP1/g;s/\# ListenIP\=0.0.0.0/ListenIP=${IP}/g;s/Hostname\=Zabbix server/Hostname\=${IP}/g;s/\# UnsafeUserParameters\=0/UnsafeUserParameters\=1/g" /etc/zabbix/zabbix_agentd.conf

systemctl restart zabbix-agent.service

你可能感兴趣的:(2019-09-27Centos7.2安装zabbix_agents.sh脚本)