zabbix_3.0安装部署与中文支持

zabbix_3.0安装部署与中文支持

Zabbix 3.0界面焕然一新,一改10多年的老面孔,alpha4的更新具体记录如下:http://www.zabbix.com/rn3.0.0alpha4.php

What's New in 3.0.0alpha4

  • [ZBXNEXT-1762] added years, months and half of months periods displaying on graphs X axis

  • [ZBXNEXT-1679] implemented value map import/export

  • [ZBXNEXT-1679] added checkbox column in value map list view and bulk "Delete" button

  • [ZBXNEXT-1679] added "Used in items" column in value map list view and green text "Yes" if value map is used in items or item prototypes

  • [ZBXNEXT-1679] added value map sorting by name

  • [ZBXNEXT-1679] added limit for the amount of records and paging in value maps

  • [ZBXNEXT-1679] replaced built-in confirmation dialog with modal window dialog for image import when selecting "Update existing"

  • [ZBXNEXT-2683] added user macro context

  • [ZBX-2616] updated bundled DejaVu font from 2.34 to 2.35

  • [ZBX-9935] added check for item delay, to be between 0 and 86400 seconds

  • [ZBX-1357] updated Brazilian Portuguese, Czech, Finnish, Japanese, Polish, Russian and Slovak translations; thanks to Zabbix translators

  • [ZBXNEXT-2678] implemented trigger description and URL popups in the dashboard's "Last 20 issues" and screen element's "Host group issues" and "Host issues"

  • [ZBX-2517] minimum period for time navigator set to 5 minutes; thanks to Zabbix community

  • [ZBXNEXT-1424] implemented value mapping API, added clone button in value map edit form and slightly improved performance of value map caching in frontend

  • [ZBXNEXT-2960] reduced the default MaxLinesPerSecond value to 20

Zabbix 3.0安装过程与2.x的变化类似,但又少许需要注意的坑(以下标红的),否则会坑的不行。。。

基础环境:

Nginx:1.9.7

Mysql:5.5.32

PHP:5.5.30(zabbix_3.0 要求php版本至少在5.4以上)

wKiom1ZRxCfwQC9lAAAdIXeNAeQ108.png

Nginx安装:

1
2
3
4
5
6
7
8
9
1.rpm -qa pcre pcre-devel
2.yum install pcre pcre-devel openssl openssl-devel -y
4.useradd nginx -s /sbin/nologin -M
5../configure  --user=nginx --group=nginx --prefix=/application/nginx-1.9.7 --with-http_stub_status_module  --with-http_ssl_module
make && make installln -s /application/nginx-1.9.7 /application/nginx
6.ls -l /application/
7./application/nginx/sbin/nginx
8.ps -ef|grep nginx
9.ss -lntup|grep nginx

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[root@zabbix_3.0 conf]# egrep -v  "#|^$" nginx.conf.default > nginx.conf
[root@zabbix_3.0 conf]# vim /application/nginx/conf/nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.php index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ \.(php|php5)?$ {
            root           /application/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
           # fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  /application/nginx/html$fastcgi_script_name;
            include        fastcgi_params;
            }
        }
}

 

 

MySql安装:

1
2
3
4
5
6
7
8
9
10
11
12
13
yum install tree nmap lrzsz dos2unix -y
[root@zabbix_3.0 tools]# tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz [root@zabbix_3.0 tools]# mv mysql-5.5.32-linux2.6-x86_64 /application/mysql-5.5.32[root@zabbix_3.0 tools]# ln -s /application/mysql-5.5.32/ /application/mysql
[root@zabbix_3.0tools]# useradd mysql -s /sbin/nologin -M[root@zabbix_3.0 tools]# chown -R mysql.mysql /application/mysql 
[root@zabbix_3.0 tools]# cd /application/mysql
vim /etc/hosts[root@zabbix_3.0 mysql]# ./scripts/mysql_install_db  --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
 cp support-files/my-small.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
 source /etc/profile
[root@zabbix_3.0 application]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

 

1
2
3
[root@zabbix_3.0 application]# cp -a /application/mysql/bin/* /usr/local/sbin
service mysqld start
mysqladmin -uroot password jiayuan.com

 

 

PHP安装:

1
2
3
4
1.yum -y install zlib-devel libxml2-devel libjpeg-devel libiconv-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel
2.wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gzcd libiconv-1.14./configure --prefix=/usr/local/libiconvmakemake installcd ../
3.yum -y install libmcrypt-devel mhash mcrypt

 

1
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/

 

 

php 5.5.30:(--with-mysqli=mysqlnd和--with-gettext一定要加上,否则前者不装时安装zabbix时database type没有选项 默认出来的数据库是SqLite3,且不能切换j_0064.gif,后者不装时,会报PHP gettext warning)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
./configure \
--prefix=/application/php5.5.30 \
--with-mysql=/application/mysql/ \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--with-gettext \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no
1
make && make install
1
2
3
4
5
6
7
8
9
10
11
12
13
[root@zabbix_3.0 php-5.5.30]# ln -s /application/php-5.5.30/ /application/php
生成配置php配置文件
[root@zabbix_3.0 php-5.5.30]# pwd
/tools/php-5.5.30
[root@zabbix_3.0 php-5.5.30]# cp php.ini-production /application/php/lib/php.ini
[root@zabbix_3.0 php-5.5.30]# cd /application/php/etc/
[root@zabbix_3.0 etc]# pwd
/application/php/etc
[root@zabbix_3.0 etc]# cp php-fpm.conf.default php-fpm.conf
php启动测试
[root@zabbix_3.0 etc]# /application/php/sbin/php-fpm
验证是否成功启动
[root@zabbix_3.0 etc]# netstat -lntup|grep php-fpm

验证LNMP安装是否成功。

Zabbix安装:

1
[root@zabbix_3.0 ~]# wget http://110.96.193.9:81/1Q2W3E4R5T6Y7U8I9O0P1Z2X3C4V5B/downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha4/zabbix-3.0.0alpha4.tar.gz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@zabbix_3.0 ~]# tar xf zabbix-3.0.0alpha4.tar.gz
[root@zabbix_3.0 ~]# groupadd zabbix
[root@zabbix_3.0 ~]# useradd -g zabbix zabbix
[root@zabbix_3.0 ~]# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2 #添加软连接
[root@zabbix_3.0 ~]# /sbin/ldconfig #使配置立即生效
[root@zabbix_3.0 ~]# cd zabbix-3.0.0alpha4
[root@oldboy zabbix-3.0.0alpha4]# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
参数说明
—prefix=/usr/local/zabbix为指定安装目录为/usr/local/zabbix
enable-server为安装zabbix服务端程序
enable-agent为安装agent程序
—with-mysql为使用mysql数据库
enable-ipv6为启用ipv6支持
—with-net-snmp为启用snmp支持
—with-libcurl为启用curl
—with-libxml2编译xml模块,主要用于监控vm虚拟机
[root@oldboy zabbix-3.0.0alpha4]# make && make install 
 
shell> mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> flush privileges;
mysql> quit;
按照SQL语句顺序导入SQL:
shell> mysql -uzabbix -p<password> zabbix < database/mysql/schema.sql
# stop here if you are creating database for Zabbix proxy
shell> mysql -uzabbix -p<password> zabbix < database/mysql/images.sql
shell> mysql -uzabbix -p<password> zabbix < database/mysql/data.sql

修改zabbix.conf:

1
2
3
4
5
6
7
[root@oldboy zabbix-3.0.0alpha4]# vim /usr/local/etc/zabbix_server.conf 
增加:DBPassword=zabbix
DBName=zabbix #数据库名称 
DBUser=zabbix #数据库用户名 
DBPassword=jiayuan.com #数据库密码 
ListenIP=localhost #数据库ip地址 
AlertScriptsPath=****/zabbix/alertscripts #zabbix运行脚本存放目录

zabbix 3.0启动方式:

1
2
3
[root@oldboy zabbix-3.0.0alpha4]# cp /application/tools/zabbix-3.0.0alpha4/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server #服务端 
[root@oldboy zabbix-3.0.0alpha4]# cp /application/tools/zabbix-3.0.0alpha4/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd #客户端
shell> zabbix_server

修改php.ini:(php5.5默认值较小)

1
2
3
4
5
vim /application/php/lib/php.ini 主要为下面几个参数
PHP option post_max_size 16M
PHP option max_execution_time 300
PHP option max_input_time 300
PHP time zone Asia/Shanghai

 

然后启动php

/application/php/sbin/php-fpm 

配置web环境:

1
2
cd /application/tools/zabbix-3.0.0alpha4/frontends
cp -rf php /application/nginx/html/zabbix

wKioL1ZSldGhiZrIAAIsDawroMU581.jpg

wKioL1ZSldbw_biUAAHMdm5KxZA035.jpg

这里修不修改端口都可,如果编译php时你没有带上--with-mysqli=mysqlnd 你会悲剧的发现这里默认出现的是SQLite3,且无法更换。。。wKiom1ZSlXnSpBmzAAFu6y_BDUk230.jpg

 

wKiom1ZRyCyztqwMAAFu6y_BDUk279.jpg

 

wKioL1ZRyOrD3rOnAAEyYpoELiI084.jpg

wKioL1ZRyQOSp_FGAAGV6gXNzJ4861.jpg

需要给此目录下/application/nginx/html/zabbix/conf的zabbix.conf.php w+x权限,否则install之前会报错需要下载conf,且赋权。

 

wKioL1ZRyWXzxTyRAAD7CZKyfBA492.jpg

 

安装至此完毕。界面如下(是比以前好看了。。):

wKioL1ZRhaqj2B0MAAB4__sqdyc185.png

 

wKiom1ZRhdyTCh-wAAGkDXohhCk260.png

 

中文支持:

zabbix实际是有中文语言的,我们可以通过修改web端源文件来开启中文语言。

修改你的locales.inc.php 这个文件

1
'zh_CN' =&gt; ['name' =&gt; _('Chinese (zh_CN)'), 'display' =&gt; true], #也就是把false改为true

然后点击zabbix监控网页端右上角人头头像修改为中文语言即可。

wKiom1ZRzIrCSnt5AAIC2o-6EQM752.png

更换语言后,图形会出现乱码,我们做如下修改即可。

修改你的defines.inc.php 这个文件

1
2
3
4
#修改第93行
define('ZBX_FONT_NAME''msyh'); 
#修改第45行改为 
define('ZBX_GRAPH_FONT_NAME''msyh')

 

然后下载微软雅黑字体,改名为msyh传入/home/www/zabbix/fonts 目录下即可。


wKioL1ZR1UKwPzJ9AAFE5bXFEjQ452.png

 

http://boris05.blog.51cto.com/1073705/1715682?utm_source=tuicool&utm_medium=referral

posted @ 2016-10-18 15:08  chenjianwen  阅读(358)  评论(0编辑  收藏  举报