What's New in 3.0.0alpha4php
[ZBXNEXT-1762] added years, months and half of months periods displaying on graphs X axishtml
[ZBXNEXT-1679] implemented value map import/exportmysql
[ZBXNEXT-1679] added checkbox column in value map list view and bulk "Delete" buttonlinux
[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 prototypesnginx
[ZBXNEXT-1679] added value map sorting by nameweb
[ZBXNEXT-1679] added limit for the amount of records and paging in value mapssql
[ZBXNEXT-1679] replaced built-in confirmation dialog with modal window dialog for image import when selecting "Update existing"shell
[ZBXNEXT-2683] added user macro context數據庫
[ZBX-2616] updated bundled DejaVu font from 2.34 to 2.35vim
[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以上)
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,且不能切換,後者不裝時,會報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
|
這裏修不修改端口均可,若是編譯php時你沒有帶上--with-mysqli=mysqlnd 你會悲劇的發現這裏默認出現的是SQLite3,且沒法更換。。。
須要給此目錄下/application/nginx/html/zabbix/conf的zabbix.conf.php w+x權限,不然install以前會報錯須要下載conf,且賦權。
安裝至此完畢。界面以下(是比之前好看了。。):
中文支持:
zabbix實際是有中文語言的,咱們能夠經過修改web端源文件來開啓中文語言。
修改你的locales.inc.php 這個文件
1
|
'zh_CN'
=> [
'name'
=> _(
'Chinese (zh_CN)'
),
'display'
=>
true
],
#也就是把false改成true
|
而後點擊zabbix監控網頁端右上角人頭頭像修改成中文語言便可。
更換語言後,圖形會出現亂碼,咱們作以下修改便可。
修改你的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 目錄下便可。
http://boris05.blog.51cto.com/1073705/1715682?utm_source=tuicool&utm_medium=referral