为了以后批量部署,节省时间和人力就把zabbix_agent的安装方法改成源码的,仅供参考
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
44
45
|
#!/bin/bash
#zabbix server 端IP 地址
SERVER=
"10.10.99.78"
#zabbix 版本号,也就是源码包.tar.gz前面的部分
VER=
"/usr/local/src/zabbix-2.4.4"
groupadd zabbix
useradd
-g zabbix zabbix -s
/sbin/nologin
tar
xvf $VER.
tar
.gz
cd
$VER
.
/configure
--prefix=
/usr/local/zabbix
--
enable
-agent
make
install
#该版本zabbix不需要make,直接make install即可,其它版本请酌情修改
echo
"Installation completed !"
mkdir
/var/log/zabbix
chown
zabbix.zabbix
/var/log/zabbix
cp
misc
/init
.d
/fedora/core/zabbix_agentd
/etc/init
.d/
chmod
755
/etc/init
.d
/zabbix_agentd
sed
-i
"s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g"
/etc/init
.d
/zabbix_agentd
ln
-s
/usr/local/zabbix/etc
/etc/zabbix
ln
-s
/usr/loca/zabbix/bin/zabbix_get
/usr/bin/
ln
-s
/usr/loca/zabbix/bin/zabbix_sender
/usr/bin/
ln
-s
/usr/loca/zabbix/sbin/zabbix_agent
/usr/sbin/
ln
-s
/usr/loca/zabbix/sbin/zabbix_agentd
/usr/sbin/
echo
"zabbix-agent 10050/tcp #Zabbix Agent"
>>
/etc/services
echo
"zabbix-agent 10050/udp #Zabbix Agent"
>>
/etc/services
echo
"zabbix-trapper 10051/tcp #Zabbix Trapper"
>>
/etc/services
echo
"zabbix-trapper 10051/udp #Zabbix Trapper"
>>
/etc/services
sed
-i
"s/Server\=127.0.0.1/Server=$SERVER/g"
/etc/zabbix/zabbix_agentd
.conf
sed
-i
"s/ServerActive\=127.0.0.1/ServerActive=$SERVER:10051/g"
/etc/zabbix/zabbix_agentd
.conf
sed
-i
"s#tmp/zabbix_agentd.log#var/log/zabbix/zabbix_agentd.log#g"
/etc/zabbix/zabbix_agentd
.conf
sed
-i
"s#UnsafeUserParameters=0#UnsafeUserParameters=1#g"
/etc/zabbix/zabbix_agentd
.conf
sed
-i
"s%# Include=/usr/local/etc/zabbix_agentd.userparams.conf%Include=/etc/zabbix/zabbix_agentd.conf.d/%g"
/etc/zabbix/zabbix_agentd
.conf
chkconfig zabbix_agentd on
service zabbix_agentd start
|
本文转自 shouhou2581314 51CTO博客,原文链接:http://blog.51cto.com/thedream/1844447,如需转载请自行联系原作者