centos7 上安装zabbix-agent3.4

rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install  zabbix-agent -y
grep -E '^Server|^Hostname' /etc/zabbix/zabbix_agentd.conf
ip=`ifconfig eth0 |grep "inet "|awk -F" " '{print $2}'|awk '{print $1}'`
sed   -i.bak  's/^Server=127.0.0.1/Server=10.0.9.2/g;s/^ServerActive=127.0.0.1/ServerActive=10.0.9.2/g;s/^Hostname=Zabbix server/Hostname='$ip'/g' /etc/zabbix/zabbix_agentd.conf |grep -E '^Server|^Hostname'  /etc/zabbix/zabbix_agentd.conf
sed   -i.bak  's/^Server=127.0.0.1/Server=10.0.9.2/g;s/^ServerActive=127.0.0.1/ServerActive=10.0.9.2/g;s/^Hostname=Zabbix server/Hostname='$ip'/g' /etc/zabbix/zabbix_agentd.conf |grep -E '^Server|^Hostname'  /etc/zabbix/zabbix_agentd.conf
grep -E '^Server|^Hostname'  /etc/zabbix/zabbix_agentd.conf
systemctl enable  zabbix-agent
systemctl restart zabbix-agent
systemctl status zabbix-agent

你可能感兴趣的:(shell)