Centos6.5部署Zabbix3.2(备忘)

1.配置yum源

wget --no-check-certificatehttp://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/epel?codeblock=0 -O epel.repo
wget --no-check-certificatehttp://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/epel?codeblock=1 -O epel-testing.repo
yuminstall  -y http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
rpm -Uvhhttp://mirror.webtatic.com/yum/el6/latest.rpm
 

2.安装LNMP环境及依赖包

yum -y installnginxPercona-Server-server-57 Percona-Server-client-57 Percona-Server-devel-57 Percona-Server-tokudb-57  php56wphp56w-fpmphp56w-mysqlgcc-c++ libxml2-develnet-snmp-devel  libcurl-develfpingphp56w-bcmathphp56w-mbstringphp56w-gdphp56w-xmlwriterphp56w-xmlreader
 

3.数据库初始化,支持TokuDB

数据库初始化
mysqld --initialize-insecure --user=mysql --datadir=/data/mysql/data/
启用TokuDB
ps_tokudb_admin --enable -uroot -pgeekwolf
 
若无法加载tokudb引擎,请查看hugepages是否关闭:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
 

4.安装Zabbix

wgethttps://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.2/zabbix-3.2.2.tar.gz
groupaddzabbix
useradd -g zabbix -s /sbin/nologin
tarxfzabbix-3.2.2.tar.gz
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
make -j8
makeinstall
 
 

5.配置zabbix_agent

vim /usr/local/etc/zabbix_agentd.conf
PidFile=/tmp/zabbix_agentd.pid
LogFile=/tmp/zabbix_agentd.log
LogFileSize=0
Server=192.168.1.1
ServerActive=192.168.1.1
Hostname=192.168.1.2
UnsafeUserParameters=1
 

**6.配置zabbix_server

**

vim /usr/local/etc/zabbix_server.conf
DBHost=192.168.1.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DebugLevel=3
StartPollers=80
CacheSize=32M
TrendCacheSize=32M
HistoryCacheSize=32M
LogFile=/tmp/zabbix_server.log
AlertScriptsPath=/usr/local/etc/scripts
FpingLocation=/usr/bin/fping
StartPingers=20
HousekeepingFrequency=1
MaxHousekeeperDelete=10000
Timeout=10
 

7.拷贝Zabbix FrontEnd,创建数据库,修改php.ini配置

cd  zabbix-3.2.2/
cpfrontends/php/* /usr/share/zabbix/
chownapache.apache /usr/share/zabbix -R
mysql>createdatabasezabbix;
mysql>sourcedatabase/mysql/schema.sql;
mysql>sourcedatabase/mysql/images.sql;
mysql>sourcedatabase/mysql/data.sql;
拷贝启动脚本:
cp  misc/init.d/fedora/core5/* /etc/rc.d/init.d/
配置Nginx:
vim /etc/nginx/conf.d/zabbix.conf
server {
    listen 80;
    server_namezbx.simlinux.com;
    indexindex.htmlindex.php;
    root /usr/share/zabbix;
    location ~ .php$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}
 
 

启动agent和server服务:

servicezabbix_agentdstart
servicezabbix_serverstart
servicenginxreload
 

修改php.ini配置:

always_populate_raw_post_data = -1
max_execution_time = 300
max_input_time = 300
data.timezone = PRC
post_max_size=16M
servicephp-fpmreload
 

8.修改数据表引擎和创建分区表

altertablehistoryengines=tokudb;
altertablehistory_logengines=tokudb;
altertablehistory_strengines=tokudb;
altertablehistory_textengines=tokudb;
altertabletrendsengines=tokudb;
 

分区表可参考http://www.simlinux.com/archives/1776.html

9.安装Zabbix Web

访问http://192.168.1.1 进行安装,默认账号密码: admin zabbix

10.遇到的问题

A. Zabbix设置中文显示时,图形部分字体显示方框

解决方法:

Zabbix默认使用DejaVuSan.ttf字体,不支持中文

拷贝本地C:WindowsFonts下的微软雅黑字体上传到Zabbix Web目录fonts下,即msyh.ttf

sed -i ‘s/DejaVuSans/msyh/g’ ./include/defines.inc.php

B. Zabbix_server日志提示20434:20161217:105010.997 fping failed: fping6: Address family for hostname not supported

解决方法:

zabbix_server.conf中指定fping和fping6路径

FpingLocation=/usr/sbin/fping

Fping6Location=/usr/sbin/fping6

  • 版权声明: 本文源自互联网, 于3个月前,由整理发表,共 3398字。
  • 原文链接:点此查看原文