首页 > 代码库 > shell脚本安装zabbix-agent
shell脚本安装zabbix-agent
[root@jboss shell]# cat zabbix.sh
#!/bin/bash
set -x
HOST=`hostname`
DIR=/root
service iptables stop
AZ ()
{
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
tar -zxvf $DIR/zabbix-1.8.5.tar.gz
cd zabbix-1.8.5
./configure --prefix=/usr/local/zabbix --enable-agent
make
make install
mkdir /etc/zabbix
cp $DIR/zabbix_agentd.conf /etc/zabbix/
sed -i "s/Hostname=.*/Hostname=$HOST/g" /etc/zabbix/zabbix_agentd.conf
/usr/local/zabbix/sbin/zabbix_agentd
echo "/usr/local/zabbix/sbin/zabbix_agentd &" >> /etc/rc.local
}
rpm -qa | grep ^gcc &> /dev/null
if [ $? -eq 0 ];then
echo -ne "\033[31m \033[05m start........\033[0m"
AZ
else
echo -ne "\033[31m \033[05m you are not install gcc ,Now we install gcc\033[0m"
yum install gcc -y
AZ
fi
本文出自 “路由汗水交换成功” 博客,请务必保留此出处http://ghnhl.blog.51cto.com/1630025/1553291
shell脚本安装zabbix-agent