- #!/bin/bash
- read -p "please input the zabbix server name:" $A
- read -p "please input your hostname:" $B
- echo "start..."
- tar xvf zabbix-1.8.4.tar.gz &> /dev/null
- cd zabbix-1.8.4
- ./configure --prefix=/u/zabbix --enable-agent &>/dev/null
- wait
- make &>/dev/null
- echo "make...."
- make install &>/dev/null
- echo "add user..."
- groupadd -g 36 zabbix
- useradd -u 36 -g 36 -s /sbin/nologin -M zabbix
- id zabbix
- echo "configue..."
- mkdir /etc/zabbix
- #cp misc/conf/zabbix_agentd.conf /etc/zabbix/
- #sed -i -e "s/Server=127.0.0.1/Server=$A/g" -e "s/Hostname=Zabbix #server/Hostname=$B/g" /etc/zabbix/zabbix_agentd.conf
- cat>>/etc/zabbix/zabbix_agentd.conf<<EOF
- LogFile=/tmp/zabbix_agentd.log
- Server=$A
- Hostname=$B
- EOF
- mkdir /var/log/zabbix
- chown -R zabbix: /var/log/zabbix/
- echo -e "zabbix-agent 10050/tcp #Zabbix Agent \nzabbix-agent 10050/udp #Zabbix Agent" >>/etc/services
- cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/
- sed -i 's#BASEDIR=/opt/zabbix#BASEDIR=/u/zabbix#g' /etc/init.d/zabbix_agentd_ctl
- chmod a+x /etc/init.d/zabbix_agentd_ctl
- /etc/init.d/zabbix_agentd_ctl start
- netstat -tunlp | grep zabbix
本文转自 490999122 51CTO博客,原文链接:http://blog.51cto.com/lyp0909/624096,如需转载请自行联系原作者