Ubuntu系统配置Zabbix前端及中文乱码解决方案 

                              作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.安装zabbix

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie2020/p/12302137.html
    https://www.cnblogs.com/yinzhengjie2020/p/12305427.html

二.配置zabbix前端(参考连接:https://www.zabbix.com/documentation/4.0/manual/installation/install#installing_frontend)

1>.访问zabbix的前端地址(http://zabix201.yinzhengjie.org.cn/zabbix/setup.php)进入欢迎界面

2>.如下图所示,下拉进度条进行条件检查,如果所有的参数都是"OK",则可以进入下一步啦

3>.配置zabbix前端的数据库信息

4>.配置zabbix server信息

5>.将之前的配置review一下,做最后的确认若没有问题的话继续下一步

6>.安装完成后,回自动将前端的配置信息存放在zabbix 服务器上,如下图所示。

[root@yinzhengjie.org.cn ~]# cat /usr/share/zabbix/conf/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB; $DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '172.200.5.201';
$DB['PORT'] = '';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'yinzhengjie'; // Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = ''; $ZBX_SERVER = '172.200.5.201';
$ZBX_SERVER_PORT = '';
$ZBX_SERVER_NAME = 'Yinzhengjie\'s Zabbix Server'; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# cat /usr/share/zabbix/conf/zabbix.conf.php

7>.安装完成后会自动跳转到登录界面

三.登录zabbix数据库

1>.使用默认的用户名(Admin)和密码(yinzhengjie)登录zabbix WebUI

2>.登录成功啦

四.修改Zabbix WebUI管理员的默认密码 

1>.如下图所示,登录zabbix WebUI后,点击右上角的小人图标

2>.如下图所示,点击"Change password"

3>.修改管理员用户的密码

五.配置ubuntu支持中文界面

1>.如下图所示,登录zabbix WebUI后,点击右上角的小人图标

2>.查看zabbix支持的语言

3>.Ubuntu系统安装中文语言相关软件包

[root@yinzhengjie.org.cn ~]# apt-get -y install language-pack-zh*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'language-pack-zh-hant-base' for glob 'language-pack-zh*'
Note, selecting 'language-pack-zh-hans-base' for glob 'language-pack-zh*'
Note, selecting 'language-pack-zh' for glob 'language-pack-zh*'
Note, selecting 'language-pack-zh-base' for glob 'language-pack-zh*'
Note, selecting 'language-pack-zh-hans' for glob 'language-pack-zh*'
Note, selecting 'language-pack-zh-hant' for glob 'language-pack-zh*'
The following NEW packages will be installed:
language-pack-zh-hans language-pack-zh-hans-base language-pack-zh-hant language-pack-zh-hant-base
upgraded, newly installed, to remove and not upgraded.
Need to get , kB of archives.
After this operation, 20.1 MB of additional disk space will be used.
Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 language-pack-zh-hans-base all 1:18.04+20180712 [1,692 kB]
Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 language-pack-zh-hans all 1:18.04+20200123 [1,119 kB]
Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 language-pack-zh-hant-base all 1:18.04+20180712 [1,221 kB]
Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 language-pack-zh-hant all 1:18.04+20200123 [778 kB]
Fetched , kB in 1s (, kB/s)
Selecting previously unselected package language-pack-zh-hans-base.
(Reading database ... files and directories currently installed.)
Preparing to unpack .../language-pack-zh-hans-base_1%3a18.+20180712_all.deb ...
Unpacking language-pack-zh-hans-base (:18.04+) ...
Selecting previously unselected package language-pack-zh-hans.
Preparing to unpack .../language-pack-zh-hans_1%3a18.+20200123_all.deb ...
Unpacking language-pack-zh-hans (:18.04+) ...
Replacing files in old package language-pack-zh-hans-base (:18.04+) ...
Selecting previously unselected package language-pack-zh-hant-base.
Preparing to unpack .../language-pack-zh-hant-base_1%3a18.+20180712_all.deb ...
Unpacking language-pack-zh-hant-base (:18.04+) ...
Selecting previously unselected package language-pack-zh-hant.
Preparing to unpack .../language-pack-zh-hant_1%3a18.+20200123_all.deb ...
Unpacking language-pack-zh-hant (:18.04+) ...
Replacing files in old package language-pack-zh-hant-base (:18.04+) ...
Setting up language-pack-zh-hant (:18.04+) ...
Setting up language-pack-zh-hant-base (:18.04+) ...
Generating locales (this might take a while)...
zh_HK.UTF-... done
zh_TW.UTF-... done
Generation complete.
Setting up language-pack-zh-hans (:18.04+) ...
Setting up language-pack-zh-hans-base (:18.04+) ...
Generating locales (this might take a while)...
zh_CN.UTF-... done
zh_SG.UTF-... done
Generation complete.
[root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# apt-get -y install language-pack-zh*

4>.配置环境变量

[root@yinzhengjie.org.cn ~]# cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]# vim /etc/environment
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]# cat /etc/environment       #添加下面2行
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
LANG="ch_CN.UTF-8"
LANGUAGE="ch_CN:zh:en_US:en"
[root@yinzhengjie.org.cn ~]#

5>.选择编码"zh_CN.UTF-8"

[root@yinzhengjie.org.cn ~]# dpkg-reconfigure locales          #会弹出如下图所示的一个界面,选中语言。

  上一步配置后,会弹出如下图所示的对话框,继续选择"zh_CN.UTF-8"

7>.重启服务使得配置生效

[root@yinzhengjie.org.cn ~]# systemctl restart zabbix-server zabbix-agent apache2

8>.刷新zabbix WebUI网页

六.解决zabbix中文乱码问题

1>.选择中文语言支持

2>.如下图所示,出现乱码显式啦

3>.将window操作系统的字体上传到zabbix web所在服务器(温馨提示:字体是闭源的,请不要将windows操作系统的字体拿去商业化,否则可能会为你带来不必要的法律责任)

[root@yinzhengjie.org.cn ~]# apt -y install lrzsz
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
minicom
The following NEW packages will be installed:
lrzsz
upgraded, newly installed, to remove and not upgraded.
Need to get 74.8 kB of archives.
After this operation, kB of additional disk space will be used.
Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 lrzsz amd64 0.12.21-10~build0.18.04.1 [74.8 kB]
Fetched 74.8 kB in 0s ( kB/s)
Selecting previously unselected package lrzsz.
(Reading database ... files and directories currently installed.)
Preparing to unpack .../lrzsz_0.12.21-~build0.18.04.1_amd64.deb ...
Unpacking lrzsz (0.12.-~build0.18.04.) ...############...............................................................................................................................................................................................................]
Setting up lrzsz (0.12.-~build0.18.04.) ...##############################################################################################............................................................................................................................]
Processing triggers for man-db (2.8.-2ubuntu0.) ...###########################################################################################################################################################################..........................................]
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# apt -y install lrzsz

4>.将字体上传到zabbix默认的路径

[root@yinzhengjie.org.cn ~]# find / -name defines.inc.php
/usr/share/zabbix/include/defines.inc.php
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]# grep -i graphfont /usr/share/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'graphfont'); // font file name
define('ZBX_FONT_NAME', 'graphfont');
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]# find /usr/share/zabbix/ -name graphfont*
/usr/share/zabbix/assets/fonts/graphfont.ttf
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]# ll /usr/share/zabbix/assets/fonts/
total
drwxr-xr-x root root Feb : ./
drwxr-xr-x root root Feb : ../
lrwxrwxrwx root root Feb : graphfont.ttf -> /etc/alternatives/zabbix-frontend-font
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]# cd /usr/share/zabbix/assets/fonts/
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]#
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]# rz [root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]#
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]# ll
total
drwxr-xr-x root root Feb : ./
drwxr-xr-x root root Feb : ../
lrwxrwxrwx root root Feb : graphfont.ttf -> /etc/alternatives/zabbix-frontend-font
-rw-r--r-- root root Mar simkai.ttf
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]#
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]# cp /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/include/defines.inc.php-`date +%F`
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]#
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]# sed -r -i 's#graphfont#simkai#' /usr/share/zabbix/include/defines.inc.php
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]#
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]#
[root@yinzhengjie.org.cn /usr/share/zabbix/assets/fonts]# cd
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]# grep -i simkai /usr/share/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'simkai'); // font file name
define('ZBX_FONT_NAME', 'simkai');
[root@yinzhengjie.org.cn ~]#
[root@yinzhengjie.org.cn ~]#

5>.再次刷新Zabbix WebUI网页,中文字段显式正常啦

Ubuntu系统配置Zabbix前端及中文乱码解决方案的更多相关文章

  1. Ubuntu 12.04 gedit编辑器 中文乱码

    百度一下查看了很多关于这个问题的解决方法,无非是用通过配置编辑器修改键值来解决.但是由于我的ubuntu是12.04版本的,搜索到的很多方法都不能用,网上一般的解决办法如下: 打开“注册表”(从字面理 ...

  2. aspx页面,中文乱码解决方案

    由于文件编码方式编码方式不统一出现样式中文乱码解决方案: 今天碰到的问题:页面字体样式设置的'微软雅黑',可页面没引用.我调试看到样式出现中文乱码了 这种问题,就需要转换文件的编码方式,如下两步即可解 ...

  3. JSP中pageEncoding和charset区别,中文乱码解决方案(转载)

    转载自:JSP中pageEncoding和charset区别,中文乱码解决方案 JSP指令标签中<%@ page contentType="text/html;charset=GB23 ...

  4. boost::xml——基本操作以及中文乱码解决方案 (续)

    本博文主要想说明以下两点: 1.对于上一篇的<boost::xml——基本操作以及中文乱码解决方案>解释,这篇博文基本解决了正确输入输出中英文问题,但是好像还没有解决修改中文出现乱码的问题 ...

  5. 基于Windows环境下cmd/编译器无法输入中文,显示中文乱码解决方案

    基于Windows环境下cmd/编译器无法输入中文,显示中文乱码解决方案 两个月前做C++课设的时候,电脑编译器编译结果出现了中文乱码,寻求了百度和大神们,都没有解决这个问题,百度上一堆解释是对编译器 ...

  6. JS传值中文乱码解决方案

    JS传值中文乱码解决方案 一.相关知识 1,Java相关类: (1)java.net.URLDecoder类 HTML格式解码的实用工具类,有一个静态方法:public static  String ...

  7. ubuntu 12.04 LTS server 中文乱码【转】

    ubuntu 12.04 LTS server 中文乱码 最近装了一台ubuntu 12.04 server装完后是没有桌面的,后来又手动安装了桌面,但进行后发现桌面是乱码,应该是缺少字体在googl ...

  8. Zabbix 监控页面中文乱码

    问题描述: 如题,我相信大多数人都遇到过这个问题,Zabbix 监控图 中文乱码. 解决这个问题也很简单:( Zabbix 网页目录中缺少字体 ) 1.打开 Windows 的 C:\Windows\ ...

  9. Java中文乱码解决方案

    Java中文乱码解决方案   1.中文乱码解决方案,确保每个文件的默认编码是UTF-8         加入 URIEncoding="UTF-8" 代码中的设置 1>在se ...

随机推荐

  1. ES Search API

    Search API 搜索请求 SearchRequest用于与搜索文档.聚合.suggestions相关的任何操作,还提供了在结果文档上请求高亮的方法. 在最基本的表单中,我们可以向请求添加查询: ...

  2. python--脚本传参与shell脚本传参(位置参数)

    写一个最简单的shell脚本,了解shell脚本是如何传参 1. vim test1.sh name=$1 age=$2 echo ${name} echo ${age} 2.调用脚本并传参 sh t ...

  3. MySQL高级-索引1

    1.索引是什么 索引(Index)是帮助MySQL高效获取数据的数据结构.可以得到索引的本质:索引是数据结构. 可以理解为“排好序的快速查找数据结构” 在数据之外,数据库系统还维护着满足特定查找算法的 ...

  4. Python - 同时运行两个以上的脚本

    在c.py中 import os os.system("python a.py") os.system("python b.py")

  5. cross_val_score 交叉验证与 K折交叉验证,嗯都是抄来的,自己作个参考

    因为sklearn cross_val_score 交叉验证,这个函数没有洗牌功能,添加K 折交叉验证,可以用来选择模型,也可以用来选择特征 sklearn.model_selection.cross ...

  6. 2019年mybatils面试高频题(java)

    前前言 2019即将过去,伴随我们即将迎来的又是新的一年,过完春节,马上又要迎来新的金三银四面试季. 那么,作为程序猿的你,是否真的有所准备的呢,亦或是安于本职工作,继续做好手头上的事情. 当然,不论 ...

  7. Nessus忘记用户名和密码

    以管理员身份运行cmd,切换到Nessus的安装目录,执行以下操作.

  8. python多线程下载ts文件

    # -*- coding: utf-8 -*- """ Created on Wed Aug 22 15:56:19 2018 @author: Administrato ...

  9. 使用SQL语句还原数据库 2012.3.20

    --返回由备份集内包含的数据库和日志文件列表组成的结果集. --主要获得逻辑文件名 USE master RESTORE FILELISTONLY FROM DISK = 'g:\back.Bak' ...

  10. Ngnix调整

    1.隐藏版本号,防止针对版本攻击   http {    server_tokens off;2.增加并发连接   2.1 worker_processes :改为CPU核数一致,因为异步IO进程是单 ...