运行环境
zabbix server可安装在Linux中,这里server用RedHat6.4_x86_64
zabbix软件下载
官方网站:
http://www.zabbix.com
这里我们下载支持RedHat的zabbix软件包进行安装(里面包含server和agent等)
zabbix-2.4.3.tar.gz
所必需的软件包:
安装zabbix server需要http服务、PHP提供运行环境,和数据库(这里用MySQL)。
大部分软件包,系统镜像中都自带。以下是必须安装的软件包。
[root@zabb ~]# rpm -qa |grep httpd
httpd-tools-2.2.15-26.el6.x86_64
httpd-manual-2.2.15-26.el6.noarch
httpd-2.2.15-26.el6.x86_64
[root@zabb ~]# rpm -qa |grep php
php-mysql-5.3.3-22.el6.x86_64
php-common-5.3.3-22.el6.x86_64
php-pdo-5.3.3-22.el6.x86_64
php-bcmath-5.3.3-22.el6.x86_64 #RedHat6.4光盘镜像中没有,需要自己下载
php-cli-5.3.3-22.el6.x86_64
php-gd-5.3.3-22.el6.x86_64
php-mbstring-5.3.3-22.el6.x86_64 #RedHat6.4光盘镜像中没有,需要自己下载
php-pear-1.9.4-4.el6.noarch
php-xml-5.3.3-22.el6.x86_64
php-5.3.3-22.el6.x86_64
[root@zabb ~]# rpm -qa |grep mysql
php-mysql-5.3.3-22.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
mysql-5.1.66-2.el6_3.x86_64
mysql-libs-5.1.66-2.el6_3.x86_64
mysql-devel-5.1.66-2.el6_3.x86_64
mysql-server-5.1.66-2.el6_3.x86_64
开始安装
1. 关闭防火墙
service iptables stop
chkconfig iptables off
2. 创建用户/用户组
groupadd zabbix
useradd zabbix -g zabbix
3. 启动httpd服务,
service httpd start
4. 启动MySQL数据库
service mysqld start
5. 创建数据库并导入数据
#tar -xvf zabbix-2.4.3.tar.gz
#cd zabbix-2.4.3
#mysql -uroot -p
>create database zabbix;
>grant all on zabbix.* to zabbix@localhost identified by '123';
>flush privileges;
#mysql -uroot zabbix<create/schema/mysql.sql
#mysql -uroot zabbix<create/data/data.sql
#mysql -uroot zabbix<create/data/images_mysql.sql
6. 编译安装zabbix
#./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
#make install
7. 添加zabbix服务对应的端口(可以省略,安装后,以下配置信息就已存在)
#vi /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
.....
8. 拷贝zabbix的配置文件到etc下,web相关文件拷贝到web目录下
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
cp -R frontends/php /var/www/html/zabbix
9. 修改zabbix server配置文件,连接的数据库的用户名和密码
#vi /usr/local/zabbix/etc/zabbix_server.conf
.....
DBName=zabbix
DBUser=zabbix
DBUDBPassword=123
.....
10. 修改zabbix agent配置文件
#vi /usr/local/zabbix/etc/zabbix_agnetd.conf
....
Server=10.201.251.30,127.0.0.1 #zabbix server ip地址或hostname
ServerActive=10.201.251.30 #zabbix server ip地址或hostname
Hostname=Zabb #zabbix agent ip地址或hostname
....
11. 修改php配置文件,修改如下内容
#vi /etc/php.ini
....
date_default_timezone_set(”Asia/Shanghai”)
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
....
12. 启动zabbix服务,并添加相关服务到开机启动
service zabbix_server start
service zabbix_agentd start
chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
chkconfig zabbix_agentd on
13. WEB页面配置
linux桌面打开Firefox,地址栏输入http://ip/zabbix
配置方法参考如下网址:
http://bguncle.blog.51cto.com/3184079/1330247/
14. 假如配置完成后,agent和server连接有问题,重启一下操作系统。