安装zabbix agent shell 脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值