1
|
yum -y groupinstall
"Development Tools"
|
1
|
yum -y
install
httpd mysql mysql-server php php-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-devel net-snmp net-snmp-devel perl-DBI php-xml ntpdate php-bcmath
|
1
|
ntpdate pool.ntp.rog
|
1
2
|
groupadd -g 201 zabbix
useradd
-g zabbix -u 201 -m zabbix
|
1
|
/etc/init
.d
/mysqld
start
|
1
2
3
4
5
|
mysqladmin -uroot -h127.0.0.1 password
"123456"
mysql -uroot -h127.0.0.1 -p
create database zabbix character
set
utf8;
grant all privileges on zabbix.* to zabbixuser@
'%'
identified by
'zabbixpass'
;
flush privileges;
|
1
2
3
|
wget http:
//sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz/download
cd /usr/src/
tar xf zabbix-
2.2
.
2
.tar.gz
|
1
2
3
4
5
|
cd
zabbix-2.2.2
mysql -uzabbixuser -h192.168.239.130 -p zabbix mysql -uzabbixuser -h192.168.239.130 -p zabbix mysql -uzabbixuser -h192.168.239.130 -p zabbix #登录数据库查看下表是否都创建成功
|
1
2
3
|
.
/configure
--sysconfdir=
/etc/zabbix/
--
enable
-server --
enable
-agent --with-net-snmp --with-libcurl --with-mysql
make
&&
make
install
#此处指定sysconfdir配置文件的路径就在/etc/zabbix/目录下了,如果不指定默认在/usr/local/etc下
|
1
2
3
|
cp
misc
/init
.d
/tru64/zabbix_agentd
/etc/init
.d/
cp
misc
/init
.d
/tru64/zabbix_server
/etc/init
.d/
chmod
+x
/etc/init
.d
/zabbix_
*
|
1
2
3
|
mkdir
/var/www/html/zabbix
cp
-a zabbix-2.2.2
/frontends/php/
*
/var/www/html/zabbix/
chown
-R apache.apache
/var/www/html/zabbix/
|
1
2
3
4
5
6
7
|
vim /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time =
300
max_input_time =
300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload =
2
|
1
2
3
4
5
6
|
vim
/etc/httpd/conf/httpd
.conf
ServerName 127.0.0.1
DocumentRoot
"/var/www/html"
ServerName 192.168.239.130
<
/VirtualHost
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
vim
/etc/zabbix/zabbix_server
.conf
DBHost=192.168.239.130
DBName= zabbix
DBUser=zabbixuser
DBPassword=zabbixpass
StartPollers=30
#开启多线程数,一般不要超过30个
StartTrappers=20
#trapper线程数
StartPingers=10
#fping线程数
StartDiscoverers=120
MaxHousekeeperDelete=5000
CacheSize=1024M
#用来保存监控数据的缓存数,根据监控主机的数量适当调整
StartDBSyncers=8
#数据库同步时间
HistoryCacheSize=1024M
TrendCacheSize=128M
#总趋势缓存大小
HistoryTextCacheSize=512M
AlertScriptsPath=
/etc/zabbix/alertscripts
LogSlowQueries=1000
|
1
2
|
/etc/init
.d
/httpd
start
/etc/init
.d
/zabbix_server
start
|
1
|
http:
//192
.168.239.130
/zabbix/setup
.php
|
1
|
#如果因为手误,数据库密码或者用户名等的填写错了,后面会一直报错,我们可以手动的去编辑配置文件vim /var/www/html/zabbix/conf/zabbix.conf.php 手动定义相关的参数即可
|
1
|
#至此,server端的安装完成
|
1
2
|
yum -y groupinstall
"Development Tools"
yum –y
install
ntpdate
|
1
|
ntpdate pool.ntp.org
|
1
2
|
groupadd -g 201 zabbix
useradd
-g zabbix -u 201 -m zabbix
|
1
2
3
4
5
|
cd
/usr/src/
tar
xf zabbix-2.2.2.
tar
.gz
cd
zabbix-2.2.2
.
/configure
--sysconfdir=
/etc/zabbix
--
enable
-agent
make
&&
make
install
|
1
2
|
cp
misc
/init
.d
/tru64/zabbix_agentd
/etc/init
.d/
chmod
+x
/etc/init
.d
/zabbix_agentd
|
1
2
3
4
5
6
|
vim
/etc/zabbix/zabbix_agentd
.conf
#此处千万别写成了zabbix_agent.conf,否则配置了不生效
Server=192.168.239.130
#填写Server的IP地址
ServerActive=192.168.239.130
#修改为Server的IP地址
Hostname=Centos-03
#填写本机的HostName,注意Server端要能解析
UnsafeUserParameters=1
#是否允许自定义的key,1为允许,0为不允许
Include= etc
/zabbix/zabbix_agentd
.conf.d/
#自定义的agentd配置文件(key)可以在这里面写;
|
1
|
/etc/init
.d
/zabbix_agentd
start
|
1
2
3
|
vim
/var/www/html/zabbix/include/defines
.inc.php
#修改以下两行
define(
'ZBX_FONT_NAME'
,
'simkai'
);
define(
'ZBX_GRAPH_FONT_NAME'
,
'simkai'
);
|