zabbix 实践笔记:安装服务端和客户端,解决中文图表字体问题
根据官方下载安装文档一路下来:
https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=nginx
原文如下:
Install and configure Zabbix server for your platform
a. Install Zabbix repository
产品手册
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all
b. Install Zabbix server and agent
# yum install zabbix-server-mysql zabbix-agent
c. Install Zabbix frontend
产品手册
Enable Red Hat Software Collections
# yum install centos-release-scl
编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend]
...
enabled=1
...
Install Zabbix frontend packages.
# yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
d. 创建初始数据库
产品手册
Make sure you have database server up and running.
在数据库主机上运行以下代码。
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
导入初始架构和数据,系统将提示您输入新创建的密码。
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
e. 为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=password
f. 为Zabbix前端配置PHP
编辑配置文件 /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf, uncomment and set 'listen' and 'server_name' directives.
# listen 80;
# server_name example.com;
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, add nginx to listen.acl_users directive.
listen.acl_users = apache,nginx
Then uncomment and set the right timezone for you.
; php_value[date.timezone] = Europe/Riga
g. 启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:
# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm我的不同:
机子已经先安装了bt的宝塔系统,安装有nginx + mysql + php 环境
按照zabbix步骤,我安装nginx和php的时候用了官方的方法安装了nging和php72,mysql用了宝塔安装的mysql
当我进入后台时,看到了 zabbix-server is not runing的提示,找到 /etc/zabbix/zabbix_server.conf 中的日志文件路径 /var/log/zabbix/zabbix_server.log ,再查看日志,发现报错是没有连接到mysql,原因是默认配置的DBSocket和我的环境不一致,宝塔的mysql 套接字路径是 /tmp/mysql.sock,修改配置,重启zabbix-server,发现跑起来了
解决切换成中文后,图表中的汉字显示成方框的问题
进入win10系统 C:\Windows\Fonts 目录,双击一个简体字包,进去后有三个字体,ctrl+c复制出来一个字体文件,上传到 /usr/share/zabbix/assets/fonts
原来的文件是一个软链接
graphfont.ttf -> /etc/alternatives/zabbix-web-font
备份一下
mv graphfont.ttf graphfont.ttf.bak
添加一个软链接 graphfont.ttf -> msyhl.ttc
ln -s msyhl.ttc graphfont.ttf
现在刷新图表页面,显示正常的汉字内容了
版权属于:Joyber
本文链接:https://blog.qqvbc.com/default/395.html
转载时须注明出处及本声明