zabbix-logo.png
Zabbix乱码是由于默认使用DejaVuSan.ttf字体,该字体不支持中文,切换语言成中文Zh_cn后,在图表上中文出现乱码,如下图:
lm.png

解决zabbix乱码方法如下:
找到本地C:WindowsFontsmsyh.ttf(微软雅黑)上传到服务器zabbix网站目录fonts目录下
修改includedefines.inc.php中的DejaVuSans为msyh

define('ZBX_GRAPH_FONT_NAME',        'msyh');
define('ZBX_FONT_NAME', 'msyh');

再次刷新即可正常;
tb.png

如果还乱码,就需要检查数据库编码是否是utf8编码了

show create database zabbixdb; #查看数据库创建编码
root@monitor-db 09:23:05 [(none)]>show create database zabbixdb;
+----------+-------------------------------------------------------------------+
| Database | Create Database                                                   |
+----------+-------------------------------------------------------------------+
| zabbixdb | CREATE DATABASE `zabbixdb` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+-------------------------------------------------------------------+
1 row in set (0.00 sec)

若数据库是utf8编码,但还乱码,就需要继续盘查,php编译参数中是否编译了jpeg、png、freetype等组件,
编译顺序如下:

安装libmcrypt:
cd /opt
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure && make && make install

安装 jpeg6

 mkdir /usr/local/jpeg6
 mkdir /usr/local/jpeg6/bin
 mkdir /usr/local/jpeg6/lib
 mkdir /usr/local/jpeg6/include
 mkdir /usr/local/jpeg6/man
 mkdir /usr/local/jpeg6/man/man1
cd /opt
tar zxf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess .
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make && make install

安装png

cd /opt
tar zxvf libpng-1.6.10.tar.gz
./configure --prefix=/usr/local/png --enable-shared
make && make install

安装freetype

cd /opt
tar zxvf freetype-2.5.3.tar.gz
cd freetype-2.5.3
./configure --prefix=/usr/local/freetype --enable-shared
make && make install

最后编译php参数如下:

./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql --with-mysqli=/usr/bin/mysql_config --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir=/usr/local/png --with-freetype-dir=/usr/local/freetype --with-mcrypt=/usr/local/libmcrypt --enable-maintainer-zts --with-ldap=shared --without-gdbm 
make -j 8
make install
带符号 * 的表示必填项