#!/bin/bash
[ -d /usr/local/zabbix ] && echo "/usr/local/zabbix exist" && exit
if ps -ef | grep zabbix_agentd | grep -v grep ; then
echo "zabbix agent is installed"
exit
fi
yum install -y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel net-snmp\* libxml2 libxml2-devel bzip2 libpng-devel freetype-devel bzip2-devel curl* curl-devel libjpeg\* openjpeg\*
if [ $? != 0 ] ;then
echo -e "\033[31mInstall rpm failed\033[0m"
exit 0
fi
useradd zabbix
cd /tmp
wget http://10.10.45.81:8000/zabbix-3.2.6.tar.gz
tar zvxf zabbix-3.2.6.tar.gz
cd zabbix-3.2.6
./configure --prefix=/usr/local/zabbix --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make
make install
while true
do
ifconfig
echo -e "\033[31mPlease input network\033[0m"
read input
if ifconfig $input>/dev/null ; then
ip=`ifconfig $input | grep "inet addr" | awk '{print $2}' | awk -F ':' '{print $2}'`
echo $ip
break
else
echo -e "\033[31mInput Err\033[0m"
fi
done
sed -i 's/Server=127.0.0.1/Server=10.10.45.152/g' /usr/local/zabbix/etc/zabbix_agentd.conf
sed -i 's/ServerActive=127.0.0.1/ServerActive=10.10.45.152/g' /usr/local/zabbix/etc/zabbix_agentd.conf
sed -i "s/Hostname=Zabbix server/Hostname=$ip/g" /usr/local/zabbix/etc/zabbix_agentd.conf
echo "------------------------------- show zabbix agent conf file -------------------------------"
awk '/^[^#]/' /usr/local/zabbix/etc/zabbix_agentd.conf
/usr/local/zabbix/sbin/zabbix_agentd
if grep zabbix_agentd /etc/rc.local >/dev/null ;then
echo -e "\033[31mNo need change rc.local\033[0m"
else
echo "/usr/local/zabbix/sbin/zabbix_agentd" >> /etc/rc.local
fi安装zabbix agent shell 脚本
原创ConfusedSnail 博主文章分类:Zabbix ©著作权
©著作权归作者所有:来自51CTO博客作者ConfusedSnail的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
zabbix-agent脚本安装
zabbix-agent批量安装
zabbix-agent 脚本安装 -
zabbix-agent自动安装脚本
zabbix-agent自动安装脚本
zabbix-agent自动安装脚本 -
zabbix-agent脚本安装2
zabbix-agent脚本安装2
脚本 agent zabbix -
Zabbix 安装agent
服务端安装参考:https://datamining.blog.csdn.net/article/details/95362947安装前首先添加对应insta...
zabbix agent 安装 Server 重启 vim
















