zabbix_agent监控脚本

#/bin/bash
AGENT_IP=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
rpm -ivh zabbix-agent-3.2.6-1.el6.x86_64.rpm
mkdir /tools/zabbix_agent
cp -r /etc/zabbix/ /tools/zabbix_agent
sed -i -e "s/Server=172.17.25.16/Server=172.17.26.15/g" /tools/zabbix_agent/zabbix/zabbix_agentd.conf
sed -i -e "s/Zabbix server/$AGENT_IP/g" /tools/zabbix_agent/zabbix/zabbix_agentd.conf
sed -i -e "s/ServerActive=172.17.25.16/ServerActive=172.17.26.15/g" /tools/zabbix_agent/zabbix/zabbix_agentd.conf
sed -i "s:conf=/etc/zabbix/zabbix_agentd.conf/:conf=/tools/zabbix_agent/zabbix/zabbix_agent.conf:g" /etc/init.d/zabbix-agent
/etc/init.d/zabbix-agent start
chkconfig --add zabbix-agent
chkconfig zabbix-agent on

猜你喜欢

转载自www.cnblogs.com/quemengqio/p/11949469.html