#!/bin/bash #./zabbixagent.sh 172.16.103.16 172.16.103.134 #$1 master address, $2 local_listen_ip groupadd zabbix && useradd zabbix -g zabbix cat >>/etc/services<<EOF zabbix-agent 10050/tcp Zabbix Agent zabbix-agent 10050/udp Zabbix Agent zabbix-trapper 10051/tcp Zabbix Trapper zabbix-trapper 10051/udp Zabbix Trapper EOF cp /root/zabbix_agentd /etc/init.d/ chmod a+x /etc/init.d/zabbix_agentd cp /root/zabbix_agentd.conf /usr/local/etc/zabbix_agentd.conf sed -i "s/Hostname=Zabbix server/Hostname=`hostname`/" /usr/local/etc/zabbix_agentd.conf sed -i "s/Server=127.0.0.1/Server=$1/" /usr/local/etc/zabbix_agentd.conf sed -i "s/# ListenPort=10050/ListenPort=10050/" /usr/local/etc/zabbix_agentd.conf sed -i "s/# ListenIP=0.0.0.0/ListenIP=$2/" /usr/local/etc/zabbix_agentd.conf service iptables stop /etc/init.d/zabbix_agentd start echo "zabbix-agent successful!"
本文出自 “muzinan的技术博客” 博客,谢绝转载!
原文地址:http://muzinan110.blog.51cto.com/684213/1559781