准备

系统:CentOS 6.6_x86_64

前提:提前准备好编译环境(gcc),防火墙和selinux都关闭

机器数量:4

官方文档:https://www.zabbix.com/documentation/3.0/manual/installation/install

规划

服务 地址
zabbix-web 10.10.10.100
zabbix-mysql 10.10.10.101
zabbix-server 10.10.10.102
zabbix-agent 10.10.10.103

部署

zabbix-mysql

安装mysql服务:

yum install mysql-server
 
service mysqld restart

创建、配置zabbix数据库:

CREATE DATABASE zabbix;
GRANT ALL ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY '123456';
GRANT ALL ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;

下载、解压源码:

wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz
tar xvzf zabbix-3.0.0alpha2.tar.gz

导入数据:

cd zabbix-3.0.0alpha2/database/mysql/
mysql -uzabbix -p123456 zabbix < schema.sql           //导入顺序不能错
mysql -uzabbix -p123456 zabbix < images.sql
mysql -uzabbix -p123456 zabbix < data.sql

zabbix-server

安装依赖:

注意:需要发邮件功能的常见 安装最新版libcurl

yum -y install mysql-devel libxml2-devel net-snmp-devel libcurl-devel gcc

下载、解压源码:

wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz
tar xvzf zabbix-3.0.0alpha2.tar.gz

添加zabbix用户组和用户:

groupadd zabbix
useradd -g zabbix zabbix

编译安装zabbix-server:

cd zabbix-3.0.0alpha2
./configure --prefix=/usr/local/zabbix-server --enable-server --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make install

配置:

mkdir /var/log/zabbix
chown -R zabbix:zabbix /var/log/zabbix
vim /usr/local/zabbix-server/etc/zabbix_server.conf
------------------------------------------------------------->
LogFile=/var/log/zabbix/zabbix_server.log
DBHost=10.10.10.101
DBName=zabbix
DBUser=zabbix
DBPassword=123456
ListenIP=127.0.0.1,10.10.10.102
<-------------------------------------------------------------

启动:

/usr/local/zabbix-server/sbin/zabbix_server -c /usr/local/zabbix-server/etc/zabbix_server.conf

zabbix-web

安装依赖:

注意:centos 6.6 php默认是5.3的版本,但是zabbix需要5.4以上版本。

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
vim /etc/yum.repos.d/remi.repo
------------------------------------------------------------------>
[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
 
[remi-php55]
name=Remi's PHP 5.5 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php55/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
<------------------------------------------------------------------
yum -y install httpd php php-mysql libXpm php-bcmath php-gd php-mbstring php-xml t1lib

下载、拷贝web源码:

mkdir /var/www/html/zabbix
wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz
tar xf zabbix-3.0.0alpha2.tar.gz
cd zabbix-3.0.0alpha2/frontends/php/
cp -a . /var/www/html/zabbix/

配置php、重启apache2:

vim /etc/php.ini
----------------------------------------->
date.timezone = Asia/Shanghai
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
<-----------------------------------------
service httpd start

用浏览器访问http://10.10.10.100/zabbix,并按照提示安装:

填写正确配置,最后下载配置文件存放到相应目录:

安装完成

zabbix-agent

下载源码、编译安装:

yum install gcc
wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz
tar xf zabbix-3.0.0alpha2.tar.gz 
cd zabbix-3.0.0alpha2
groupadd zabbix-agent
useradd -g zabbix-agent zabbix-agent
./configure --prefix=/usr/local/zabbix-agent --enable-agent
make install

配置:

mkdir /var/log/zabbix
chown -R zabbix-agent:zabbix-agent /var/log/zabbix/
vim /usr/local/zabbix-agent/etc/zabbix_agentd.conf
------------------------------------------------------------>
LogFile=/var/log/zabbix/zabbix_agentd.log
Server=10.10.10.102
ServerActive=10.10.10.102
Hostname=10.10.10.103
User=zabbix-agent
<------------------------------------------------------------

启动:

/usr/local/zabbix-agent/sbin/zabbix_agentd -c /usr/local/zabbix-agent/etc/zabbix_agentd.conf

在web界面添加刚刚的agent节点。

完成!!

zabbix-proxy

安装依赖:

注意:需要发邮件功能的参见 安装最新版libcurl

注意:proxy需要自己的数据库,但是只需要导入schema.sql

yum -y install mysql-devel libxml2-devel net-snmp-devel libcurl-devel gcc

下载、解压源码:

wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz
tar xvzf zabbix-3.0.0alpha2.tar.gz

添加zabbix用户组和用户:

groupadd zabbix-proxy
useradd -g zabbix-proxy zabbix-proxy

编译安装zabbix-proxy:

cd zabbix-3.0.0alpha2
./configure --prefix=/usr/local/zabbix-proxy --enable-proxy --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make install

配置:

mkdir /var/log/zabbix
chown -R zabbix-proxy:zabbix-proxy /var/log/zabbix
vim /usr/local/zabbix-proxy/etc/zabbix_proxy.conf
------------------------------------------------------------->
LogFile=/var/log/zabbix/zabbix_proxy.log
Server=10.10.10.102
Hostname=0.0.0.0
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
ListenIP=0.0.0.0
User=zabbix-proxy
<-------------------------------------------------------------

启动:

/usr/local/zabbix-proxy/sbin/zabbix_proxy -c /usr/local/zabbix-proxy/etc/zabbix_proxy.conf

汉化

开启中文选项:

vim /var/www/html/zabbix/include/locales.inc.php +55
 
'zh_CN' => ['name' => _('Chinese (zh_CN)'),     'display' => true],  # 将false改为true

下载一个中文字体:

自己下,并将下载好的字体放入/var/www/html/zabbix/fonts目录下
将自己的字体修改为原先的ttf文件名,备份原来的字体

mv DejaVuSans.ttf DejaVuSans-old.ttf
mv my.ttf DejaVuSans.ttf

评论

请输入您的评论. 可以使用维基语法: