|
系统:Linux centos 2.6.32-431.el6.x86_64
服务器已经安装有mysql,apache,php
1,下载和安装zabbix-server
1
2
3
4
5
6
7
8
| # yum install net-snmp-devel libxml2-devellibcurl-devel // 一定先安装依赖
# cd /usr/local/src
#wget"http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz?r=http%3A%2F%2Fwww.zabbix.com%2Fdownload.php&ts=1395066528&use_mirror=jaist"
# tar -xzvf zabbix-2.2.2.tar.gz
# cd zabbix-2.2.2
#./configure--prefix=/usr/local/zabbix-server/v2.2.2 --enable-server --with-mysql --with-ssh2--with-net-snmp --with-libcurl--enable-ipv6 --enable-agent (为了方便监控zabbix-server本身,所以也加上了zabbix-agent的编译选项)
# make
# make install
|
2,创建zabbix用户和用户组
1
2
| # groupadd zabbix
# useradd -g zabbix zabbix
|
3,导入sql文件
1
2
3
4
5
| ll/usr/local/src/zabbix-2.2.2/database/mysql/
total 2988
-rw-rw-r-- 1 1000 1000 970308 Feb 12 2014 data.sql
-rw-rw-r-- 1 1000 1000 1978341 Feb 12 2014 images.sql
-rw-rw-r-- 1 1000 1000 106560 Feb 12 2014 schema.sql
|
将上面三个sql文件导入到mysql数据库中
1
2
3
4
| # mysql -uroot -p123456 -e "createdatabase zabbix character set ='utf8';" 创建zabbix数据库,指定字符集
# mysql -uroot -p123456 zabbix </usr/local/src/zabbix-2.2.2/database/mysql/schema.sql
# mysql -uroot -p123456 zabbix </usr/local/src/zabbix-2.2.2/database/mysql/images.sql
# mysql -uroot -p123456 zabbix </usr/local/src/zabbix-2.2.2/database/mysql/data.sql
|
导入顺序schema.sql--> images.sql--> data.sql
4,配置zabbix
4.1配置zabbix_server配置文件
1
2
3
4
5
6
7
| #vim/usr/local/zabbix-server/v2.2.2/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=123456
ListenIP=0.0.0.0
|
4.2添加端口
1
2
3
4
5
| vim /etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
|
4.3修改ahache配置文件
修改vim /etc/httpd/conf/httpd.conf
DirectoryIndex index.html index.html.var--> DirectoryIndex index.html index.html.var index.php
4.4、修改php相关参数
# vim /etc/php.ini 找到如下几项
1
2
3
4
| max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
post_max_size = 32M
|
重启httpd
1
| # /etc/init.d/httpd restart
|
4.5配置php
1
2
3
4
5
6
| # pwd
/usr/local/src/zabbix-2.2.2
# cd frontends/
# cp -r php/ /var/www/html/
# cd /var/www/html
# mv php zabbix
|
4.6 启动zabbix server
1
2
3
| # pwd
/usr/local/zabbix-server/v2.2.2/sbin
#./zabbix_serverstart
|
1
2
3
4
5
6
7
8
9
10
11
| #tail -f /tmp/zabbix_server.log
32098:20160930:200528.677 server #19 started[discoverer #1]
32099:20160930:200528.678 server #20 started[history syncer #1]
32100:20160930:200528.679 server #21 started[history syncer #2]
32101:20160930:200528.680 server #22 started[history syncer #3]
32102:20160930:200528.680 server #23 started[history syncer #4]
32068:20160930:200528.684 server #0 started[main process]
32111:20160930:200528.723 server #25 started[proxy poller #1]
32112:20160930:200528.724 server #26 started[self-monitoring #1]
32110:20160930:200528.724 server #24 started[escalator #1]
32093:20160930:200528.754 housekeeper [deleted0 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in0.076180 sec, idle 1 hour(s)]
|
看错误日志是滞有报错,如果有报错根据错误提醒定位问题
5,zabbix server页面配置
5.1浏览器打开http://10.32.1.72/zabbix/setup.php
|
|