一、环境准备与安装部署

1.1、配置zabbix yum源

# rpm -Uvh https://repo.zabbix.com/zabbix/6.3/rhel/8/x86_64/zabbix-release-6.3-1.el8.noarch.rpm
# dnf clean all

1.2、安装zabbix-server

# dnf module switch-to php:7.4
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent -y
[root@zabbix-server-01 ~]# zabbix_server -V
zabbix_server (Zabbix) 6.4.0beta1
Revision a01f5df47bf 29 September 2022, compilation time: Sep 29 2022 12:52:41

Copyright (C) 2022 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <https://www.gnu.org/licenses/>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).

Compiled with OpenSSL 1.1.1k  FIPS 25 Mar 2021
Running with OpenSSL 1.1.1k  FIPS 25 Mar 2021
[root@zabbix-server-01 ~]# 

1.3、安装mysql数据库

[root@zabbix-server-01 ~]# yum -y install mysql-server 

[root@zabbix-server-01 ~]# systemctl enable –now mysqld

1.4、配置mysql

[root@zabbix-server-01 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.26 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.01 sec)

mysql> create user zabbix@localhost identified by '123456';
Query OK, 0 rows affected (0.03 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> set global log_bin_trust_function_creators = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@zabbix-server-01 ~]# 

如果mysql与zabbix-server不在同一台主机

mysql> create user zabbix@'172.16.88.%' identified by '123456';
mysql> grant all privileges on zabbix.* to zabbix@'172.16.88.%';
#注意: 如果使用MySQL8.0还需要执行下面 mysql
>ALTER USER zabbix@'172.16.88.%' IDENTIFIED WITH mysql_native_password BY '123456';
#或者执行下面 [root@zabbix
-server ~]#echo 'default-authentication-plugin=mysql_native_password' >> /etc/my.cnf.d/mysql-server.cnf [root@zabbix-server ~]#systemctl enable --now mysqld

1.5、导入zabbix数据表

vim 编辑server.sql.gz添加use zabbix;选项

[root@zabbix-server-01 ~]# vim /usr/share/zabbix-sql-scripts/mysql/server.sql.gz

不添加会报”No database selected”

[root@zabbix-server-01 mysql]# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1046 (3D000) at line 1: No database selected
[root@zabbix-server-01 mysql]#
[root@zabbix-server-01 mysql]# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zabbix-server-01 mysql]# 

导完数据库需要关闭log_bin_trust_function_creators

[root@zabbix-server-01 mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 8.0.26 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SET GLOBAL log_bin_trust_function_creators = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> 

1.6、配置zabbix-server数据库

[root@zabbix-server-01 ~]# vim /etc/zabbix/zabbix_server.conf

DBPassword=123456

启动服务

[root@zabbix-server-01 ~]# systemctl enable --now zabbix-server zabbix-agent nginx php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /usr/lib/systemd/system/zabbix-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /usr/lib/systemd/system/zabbix-agent.service.
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@zabbix-server-01 ~]# 

1.7、配置软链接

[root@zabbix-server-01 ~]# cd  /usr/share/nginx/html
[root@zabbix-server-01 html]# ln -s /usr/share/zabbix zabbix

否则nginx服务启动会报文件路径找不到

[root@zabbix-server-01 ~]# less /var/log/nginx/error.log

1.8、配置zabbix

 检查安装条件

 解决办法

[root@zabbix-server-01 php-fpm.d]# egrep -v "^;|^#|^$" www.conf 
[www]
user = apache
group = apache
listen = /run/php-fpm/www.sock
listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path]    = /var/lib/php/session
php_value[soap.wsdl_cache_dir]  = /var/lib/php/wsdlcache
php_value[max_execution_time] = 300
php_value[post_max_size] = 32M
php_value[max_input_time] = 300
[root@zabbix-server-01 php-fpm.d]# 

[root@zabbix-server-01 php-fpm.d]# systemctl restart php-fpm.service

1.9、字符乱码

找到windows字体并上传到zabbix服务端

 

 导入并修改原有的字体

[root@zabbix-server-01 ~]# cd /usr/share/zabbix/assets/fonts
[root@zabbix-server-01 fonts]# ls
graphfont.ttf
[root@zabbix-server-01 fonts]# ll -h 
total 0
lrwxrwxrwx 1 root root 33 Oct  8 19:23 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@zabbix-server-01 fonts]# ls
graphfont.ttf
[root@zabbix-server-01 fonts]# ll -h /etc/alternatives/
total 0
lrwxrwxrwx. 1 root root 39 Jul 25 21:18 cifs-idmap-plugin -> /usr/lib64/cifs-utils/cifs_idmap_sss.so
lrwxrwxrwx. 1 root root 15 Jul 25 21:18 ld -> /usr/bin/ld.bfd
lrwxrwxrwx. 1 root root 34 Jul 25 21:17 libnssckbi.so.x86_64 -> /usr/lib64/pkcs11/p11-kit-trust.so
lrwxrwxrwx. 1 root root 45 Jul 25 21:22 libwbclient.so.0.15-64 -> /usr/lib64/samba/wbclient/libwbclient.so.0.15
lrwxrwxrwx. 1 root root 22 Jul 25 21:17 python -> /usr/libexec/no-python
lrwxrwxrwx. 1 root root 43 Jul 25 21:17 unversioned-python-man -> /usr/share/man/man1/unversioned-python.1.gz
lrwxrwxrwx  1 root root 29 Oct  8 19:23 zabbix-server -> /usr/sbin/zabbix_server_mysql
lrwxrwxrwx  1 root root 38 Oct  8 19:23 zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
[root@zabbix-server-01 fonts]# ll -h
total 11M
lrwxrwxrwx 1 root root  33 Oct  8 19:23 graphfont.ttf -> /etc/alternatives/zabbix-web-font
-rw-r--r-- 1 root root 11M Oct  8 21:32 STFANGSO.TTF #上传新的字体文件
[root@zabbix-server-01 fonts]# mv STFANGSO.TTF /usr/share/fonts/dejavu/ #把字体文件拷贝到zabbix字体路径
[root@zabbix-server-01 fonts]# cd /usr/share/fonts/dejavu/
[root@zabbix-server-01 dejavu]# ls
DejaVuSans-BoldOblique.ttf           DejaVuSansCondensed-Bold.ttf     DejaVuSans-ExtraLight.ttf       DejaVuSansMono-Oblique.ttf  DejaVuSans.ttf
DejaVuSans-Bold.ttf                  DejaVuSansCondensed-Oblique.ttf  DejaVuSansMono-BoldOblique.ttf  DejaVuSansMono.ttf          STFANGSO.TTF
DejaVuSansCondensed-BoldOblique.ttf  DejaVuSansCondensed.ttf          DejaVuSansMono-Bold.ttf         DejaVuSans-Oblique.ttf
[root@zabbix-server-01 dejavu]# ll -h
total 18M
-rw-r--r--  1 root root 627K May 17  2015 DejaVuSans-BoldOblique.ttf
-rw-r--r--  1 root root 688K May 17  2015 DejaVuSans-Bold.ttf
-rw-r--r--  1 root root 596K May 17  2015 DejaVuSansCondensed-BoldOblique.ttf
-rw-r--r--  1 root root 648K May 17  2015 DejaVuSansCondensed-Bold.ttf
-rw-r--r--  1 root root 584K May 17  2015 DejaVuSansCondensed-Oblique.ttf
-rw-r--r--  1 root root 664K May 17  2015 DejaVuSansCondensed.ttf
-rw-r--r--  1 root root 347K May 17  2015 DejaVuSans-ExtraLight.ttf
-rw-r--r--. 1 root root 248K May 17  2015 DejaVuSansMono-BoldOblique.ttf
-rw-r--r--. 1 root root 324K May 17  2015 DejaVuSansMono-Bold.ttf
-rw-r--r--. 1 root root 246K May 17  2015 DejaVuSansMono-Oblique.ttf
-rw-r--r--. 1 root root 333K May 17  2015 DejaVuSansMono.ttf
-rw-r--r--  1 root root 619K May 17  2015 DejaVuSans-Oblique.ttf
-rw-r--r--  1 root root 739K May 17  2015 DejaVuSans.ttf
-rw-r--r--  1 root root  11M Oct  8 21:32 STFANGSO.TTF
[root@zabbix-server-01 dejavu]# mv STFANGSO.TTF DejaVuSans.ttf #替换覆盖旧的字体
mv: overwrite 'DejaVuSans.ttf'? y
[root@zabbix-server-01 dejavu]# ll -h
total 17M
-rw-r--r--  1 root root 627K May 17  2015 DejaVuSans-BoldOblique.ttf
-rw-r--r--  1 root root 688K May 17  2015 DejaVuSans-Bold.ttf
-rw-r--r--  1 root root 596K May 17  2015 DejaVuSansCondensed-BoldOblique.ttf
-rw-r--r--  1 root root 648K May 17  2015 DejaVuSansCondensed-Bold.ttf
-rw-r--r--  1 root root 584K May 17  2015 DejaVuSansCondensed-Oblique.ttf
-rw-r--r--  1 root root 664K May 17  2015 DejaVuSansCondensed.ttf
-rw-r--r--  1 root root 347K May 17  2015 DejaVuSans-ExtraLight.ttf
-rw-r--r--. 1 root root 248K May 17  2015 DejaVuSansMono-BoldOblique.ttf
-rw-r--r--. 1 root root 324K May 17  2015 DejaVuSansMono-Bold.ttf
-rw-r--r--. 1 root root 246K May 17  2015 DejaVuSansMono-Oblique.ttf
-rw-r--r--. 1 root root 333K May 17  2015 DejaVuSansMono.ttf
-rw-r--r--  1 root root 619K May 17  2015 DejaVuSans-Oblique.ttf
-rw-r--r--  1 root root  11M Oct  8 21:32 DejaVuSans.ttf
[root@zabbix-server-01 dejavu]# 

二、zabbix对接grafana

2.1、准备一台机器并安装grafana

wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.1.7-1.x86_64.rpm
sudo yum install grafana-enterprise-9.1.7-1.x86_64.rpm

[root@grafana-01 ~]# systemctl enable –now grafana-server

2.2、在grafana中安装zabbix插件

[root@grafana-01 ~]# grafana-cli plugins list-remote|grep zabbix
id: alexanderzobnin-zabbix-app version: 4.2.10
[root@grafana-01 ~]# grafana-cli plugins install alexanderzobnin-zabbix-app 4.2.10
✔ Downloaded and extracted alexanderzobnin-zabbix-app v4.2.10 zip successfully to /var/lib/grafana/plugins/alexanderzobnin-zabbix-app

Please restart Grafana after installing plugins. Refer to Grafana documentation for instructions if necessary.

[root@grafana-01 ~]# grafana-cli plugins ls
installed plugins:
alexanderzobnin-zabbix-app @ 4.2.10
Please restart Grafana after installing plugins. Refer to Grafana documentation for instructions if necessary.

[root@grafana-01 ~]# systemctl restart grafana-server.service
[root@grafana-01 ~]#

在grafana中启用zabbix

 添加zabbix数据源

导入自带模板

 

原文地址:http://www.cnblogs.com/cyh00001/p/16770198.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性