1. 架构及主机
实验环境:zabbix6.0LTS /CentOS8.4 /MariaDB /NGINX
两台服务器: 192.168.250.18 Zabbix-Server 和 192.168.250.28 MarriaDB10.7 数据库服务器
2. 数据库服务器准备
特别提示:经过反复折腾和看日志,发现Zabbix6.0LTS对于Mariadb数据库的版本有要求: 不能低于 10.05.00,详见下面的截图;当时用10.03版本,zabbix的服务无法正常启动,后来直接将MarriaDB升级到10.07版本,又看到界面下建议不要用过新的版本,不建议新过 10.06,经过最终测试在10.07下可以正常启动服务,完全可以正常工作的,这个官方提示是否仅仅是一个警告或者官方没搭配过最新MarriDB测试过呢。
下面两幅图是针对MarriaDB版本的一个提示信息截图:
#### Zabbix 6LTS版本marriaDB版本10.05.00 以上的版本,为此在IP192.168.250.38 上通过官网提供的yum安装的方式和方法,开始完成最新的MariaDB-server10.7.3版本的安装。看到后面安装好了又有不能高过 10.0.06版本,但是可用。在配置文件内好像有对数据库版本的检测,应该可以关掉监测。#### MarriaDB官网提供的yum仓库信息及yum安装数据的命令, MariaDB 10.7 CentOS repository list - created 2022-05-08 05:24 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.7/centos8-amd64
module_hotfixes=1
gpgkey=https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
sudo dnf install MariaDB-server
sudo systemctl start mariadb
####################################################################
#### 数据库准备的调试过程
[root@CentOS84-IP38 ]#cd /etc/yum.repos.d
[root@CentOS84-IP38 ]#vim MariaDB.repo
[root@CentOS84-IP38 ]#cat MariaDB.repo
# MariaDB 10.7 CentOS repository list - created 2022-05-08 05:20 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.7/centos8-amd64
module_hotfixes=1
gpgkey=https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
[root@CentOS84-IP38 ]#
[root@CentOS84-IP38 ]#dnf info MariaDB-server
.................
Name : MariaDB-server
Version : 10.7.3
.................
[root@CentOS84-IP38 ]#dnf install -y MariaDB-server
[root@CentOS84-IP38 ]#systemctl enable --now mariadb
####################################################################
#### 配置 zabbix需要的数据库环境,本次没对root进行设置密码,实际生产环境中建议设置下root的安全登录,也就是对数据库安全进行初始化
[root@CentOS84-IP38 ]#mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.7.3-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
# 下面这行命令定义了数据库的字符集,并创建数据库
MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> create user zabbix@"192.168.%.%" identified by 'shone123456';
Query OK, 0 rows affected (0.002 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@"192.168.%.%";
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit
Bye
####################################################################
[root@CentOS84-IP38 ]#mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.7.3-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
| zabbix |
+--------------------+
6 rows in set (0.002 sec)
3. 官网步骤yum安装zabbix服务器
下图是官网提供的选项性质的官网版本安装方法截图,相比redis的yum安装最新版本,真的是非常清晰明了。
#### a. Install Zabbix repository
[root@CentOS84-IP18 ]#rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
warning: /var/tmp/rpm-tmp.Ui9aBC: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-6.0-1.el8 ################################# [100%]
[root@CentOS84-IP18 ]#dnf clean all
33 files removed
#####################################################################
#### b. 安装Zabbix server,Web前端,agent
[root@CentOS84-IP18 ]#dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
Last metadata expiration check: 0:06:53 ago on Sun 08 May 2022 11:05:50 AM CST.
Package zabbix-server-mysql-6.0.4-1.el8.x86_64 is already installed.
Package zabbix-web-mysql-6.0.4-1.el8.noarch is already installed.
Package zabbix-nginx-conf-6.0.4-1.el8.noarch is already installed.
Package zabbix-sql-scripts-6.0.4-1.el8.noarch is already installed.
Package zabbix-selinux-policy-6.0.4-1.el8.x86_64 is already installed.
Package zabbix-agent-6.0.4-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@CentOS84-IP18 ]#
#####################################################################
## 导入初始架构和数据,系统将提示您输入新创建的密码。
[root@CentOS84-IP18 ]#ll /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz
-rw-r--r-- 1 root root 3445487 May 3 15:31 /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz
## 安装数据库客户端
[root@CentOS84-IP18 ]#yum -y install mariadb
## 初始化数据库
[root@CentOS84-IP18 ]#zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -pshone123456 zabbix -h192.168.250.38
####################################################################
## 在zabbix-server的服务器上对数据库初始化后看到的表信息
[root@CentOS84-IP18 ]#mysql -uzabbix -pshone123456 zabbix -h192.168.250.38
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.3.28-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [zabbix]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| zabbix |
+--------------------+
2 rows in set (0.001 sec)
MariaDB [(none)]> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
| alerts |
| auditlog |
| autoreg_host |
| conditions |
| config |
| config_autoreg_tls |
| corr_condition |
| corr_condition_group |
| corr_condition_tag |
| corr_condition_tagpair |
| corr_condition_tagvalue |
| corr_operation |
| correlation |
| dashboard |
| dashboard_page |
| dashboard_user |
| dashboard_usrgrp |
| dbversion |
| dchecks |
| dhosts |
| drules |
| dservices |
| escalations |
| event_recovery |
| event_suppress |
| event_tag |
| events |
| expressions |
| functions |
| globalmacro |
| globalvars |
| graph_discovery |
| graph_theme |
| graphs |
| graphs_items |
| group_discovery |
| group_prototype |
| ha_node |
| history |
| history_log |
| history_str |
| history_text |
| history_uint |
| host_discovery |
| host_inventory |
| host_tag |
| hostmacro |
| hosts |
| hosts_groups |
| hosts_templates |
| housekeeper |
| hstgrp |
| httpstep |
| httpstep_field |
| httpstepitem |
| httptest |
| httptest_field |
| httptest_tag |
| httptestitem |
| icon_map |
| icon_mapping |
| ids |
| images |
| interface |
| interface_discovery |
| interface_snmp |
| item_condition |
| item_discovery |
| item_parameter |
| item_preproc |
| item_rtdata |
| item_tag |
| items |
| lld_macro_path |
| lld_override |
| lld_override_condition |
| lld_override_opdiscover |
| lld_override_operation |
| lld_override_ophistory |
| lld_override_opinventory |
| lld_override_opperiod |
| lld_override_opseverity |
| lld_override_opstatus |
| lld_override_optag |
| lld_override_optemplate |
| lld_override_optrends |
| maintenance_tag |
| maintenances |
| maintenances_groups |
| maintenances_hosts |
| maintenances_windows |
| media |
| media_type |
| media_type_message |
| media_type_param |
| module |
| opcommand |
| opcommand_grp |
| opcommand_hst |
| opconditions |
| operations |
| opgroup |
| opinventory |
| opmessage |
| opmessage_grp |
| opmessage_usr |
| optemplate |
| problem |
| problem_tag |
| profiles |
| proxy_autoreg_host |
| proxy_dhistory |
| proxy_history |
| regexps |
| report |
| report_param |
| report_user |
| report_usrgrp |
| rights |
| role |
| role_rule |
| script_param |
| scripts |
| service_alarms |
| service_problem |
| service_problem_tag |
| service_status_rule |
| service_tag |
| services |
| services_links |
| sessions |
| sla |
| sla_excluded_downtime |
| sla_schedule |
| sla_service_tag |
| sysmap_element_trigger |
| sysmap_element_url |
| sysmap_shape |
| sysmap_url |
| sysmap_user |
| sysmap_usrgrp |
| sysmaps |
| sysmaps_element_tag |
| sysmaps_elements |
| sysmaps_link_triggers |
| sysmaps_links |
| tag_filter |
| task |
| task_acknowledge |
| task_check_now |
| task_close_problem |
| task_data |
| task_remote_command |
| task_remote_command_result |
| task_result |
| timeperiods |
| token |
| trends |
| trends_uint |
| trigger_depends |
| trigger_discovery |
| trigger_queue |
| trigger_tag |
| triggers |
| users |
| users_groups |
| usrgrp |
| valuemap |
| valuemap_mapping |
| widget |
| widget_field |
+----------------------------+
173 rows in set (0.003 sec)
MariaDB [zabbix]>
#####################################################################
#### 为Zabbix server配置数据库
## 编辑配置文件 /etc/zabbix/zabbix_server.conf
[root@CentOS84-IP18 ]#ll /etc/zabbix/zabbix_server.conf
-rw------- 1 root zabbix 25869 May 3 15:31 /etc/zabbix/zabbix_server.conf
[root@CentOS84-IP18 ]#vim /etc/zabbix/zabbix_server.conf
.......................
# DBHost=localhost
DBHost=192.168.250.38
.......................
[root@CentOS84-IP18 ]#
## 列出有效的配置行
[root@CentOS84-IP18 ]#grep "^[a-Z]" /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbix/zabbix_server.pid
SocketDir=/run/zabbix
DBHost=192.168.250.38
DBName=zabbix
DBUser=zabbix
DBPassword=shone123456
DBPort=3306
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
[root@CentOS84-IP18 ]#
#####################################################################
#### 为Zabbix前端配置PHP 因为我选择的是Nginx + Zabbix + MarriDB 组合的方式,所以下面要针对Nginx的conf文件进行配置
# listen 80;
# server_name example.com;
## 编辑配置文件 /etc/nginx/conf.d/zabbix.conf, uncomment and set 'listen' and 'server_name' directives.
[root@CentOS84-IP18 ]#ll /etc/nginx/conf.d/zabbix.conf
-rw-r--r-- 1 root root 1976 Feb 24 18:54 /etc/nginx/conf.d/zabbix.conf
[root@CentOS84-IP18 ]#cat /etc/nginx/conf.d/zabbix.conf
server {
listen 80;
server_name 192.168.250.18;
root /usr/share/zabbix;
index index.php;
location = /favicon.ico {
log_not_found off;
}
location / {
try_files $uri $uri/ =404;
}
location /assets {
access_log off;
expires 10d;
}
location /\.ht {
deny all;
}
location /(api\/|conf[^\.]|include|locale) {
deny all;
return 404;
}
location /vendor {
deny all;
return 404;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/run/php-fpm/zabbix.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT /usr/share/zabbix;
fastcgi_param SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
[root@CentOS84-IP18 ]#
#####################################################################
#### 启动Zabbix server和agent进程;
## 启动Zabbix server和agent进程,并为它们设置开机自启。
[root@CentOS84-IP18 ]#systemctl enable zabbix-server zabbix-agent nginx php-fpm
[root@CentOS84-IP18 ]#reboot
4. Zabbix 启动及验证信息
#### 正常启动和重启zabbix 看到的状态信息####################################################################
[root@CentOS84-IP18 ]#systemctl status zabbix-server.service
● zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2022-05-08 17:52:13 CST; 1s ago
Process: 6252 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 6255 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 6257 (zabbix_server)
Tasks: 48 (limit: 23544)
Memory: 45.8M
CGroup: /system.slice/zabbix-server.service
├─6257 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
├─6258 /usr/sbin/zabbix_server: ha manager
├─6259 /usr/sbin/zabbix_server: service manager #1 started
├─6260 /usr/sbin/zabbix_server: configuration syncer [synced configuration in 0.274754 sec, idle 60 sec]
├─6261 /usr/sbin/zabbix_server: alert manager #1 started
├─6262 /usr/sbin/zabbix_server: alerter #1 started
├─6263 /usr/sbin/zabbix_server: alerter #2 started
├─6264 /usr/sbin/zabbix_server: alerter #3 started
├─6265 /usr/sbin/zabbix_server: preprocessing manager #1 started
├─6266 /usr/sbin/zabbix_server: preprocessing worker #1 started
├─6267 /usr/sbin/zabbix_server: preprocessing worker #2 started
├─6268 /usr/sbin/zabbix_server: preprocessing worker #3 started
├─6269 /usr/sbin/zabbix_server: lld manager #1 started
├─6270 /usr/sbin/zabbix_server: lld worker #1 started
├─6271 /usr/sbin/zabbix_server: lld worker #2 started
├─6272 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
├─6273 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.004814 sec, idle 46 sec]
├─6274 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.001071 sec, idle 5 sec]
├─6275 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000964 sec, idle 60 sec]
├─6276 /usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.000078 sec, idle 1 sec]
├─6277 /usr/sbin/zabbix_server: history syncer #2 [processed 0 values, 0 triggers in 0.000049 sec, idle 1 sec]
├─6278 /usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000062 sec, idle 1 sec]
├─6279 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000070 sec, idle 1 sec]
├─6280 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.006538 sec, idle 3 sec]
├─6281 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000145 sec, idle 5 sec]
├─6282 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000073 sec, idle 1 sec]
├─6283 /usr/sbin/zabbix_server: task manager [started, idle 2 sec]
├─6284 /usr/sbin/zabbix_server: poller #1 [got 1 values in 0.011752 sec, idle 2 sec]
├─6285 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000278 sec, idle 2 sec]
├─6286 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000076 sec, idle 2 sec]
├─6287 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000093 sec, idle 2 sec]
├─6288 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000074 sec, idle 2 sec]
├─6289 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000218 sec, idle 5 sec]
├─6290 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection]
├─6291 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]
├─6292 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]
├─6293 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]
├─6294 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]
├─6295 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000288 sec, idle 5 sec]
├─6296 /usr/sbin/zabbix_server: alert syncer [queued 0 alerts(s), flushed 0 result(s) in 0.002902 sec, idle 1 sec]
├─6297 /usr/sbin/zabbix_server: history poller #1 [got 0 values in 0.000178 sec, idle 5 sec]
├─6298 /usr/sbin/zabbix_server: history poller #2 [got 0 values in 0.000224 sec, idle 5 sec]
├─6299 /usr/sbin/zabbix_server: history poller #3 [got 0 values in 0.000171 sec, idle 5 sec]
├─6300 /usr/sbin/zabbix_server: history poller #4 [got 0 values in 0.000363 sec, idle 5 sec]
├─6301 /usr/sbin/zabbix_server: history poller #5 [got 0 values in 0.000226 sec, idle 5 sec]
├─6302 /usr/sbin/zabbix_server: availability manager #1 started
├─6303 /usr/sbin/zabbix_server: trigger housekeeper [startup idle for 60 second(s)]
└─6304 /usr/sbin/zabbix_server: odbc poller #1 [got 0 values in 0.000214 sec, idle 5 sec]
May 08 17:52:13 CentOS84-IP18 systemd[1]: Starting Zabbix Server...
May 08 17:52:13 CentOS84-IP18 systemd[1]: Started Zabbix Server.
lines 16-60/60 (END)
[3]+ Stopped systemctl status zabbix-server.service
####################################################################
#### 数据库升级以后满足zabbix要求以后,看到的端口监听,实际上多出了一个 10051 agent的监控端口
[root@CentOS84-IP18 ]#ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:10051 0.0.0.0:*
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
LISTEN 0 128 [::]:10051 [::]:*
LISTEN 0 511 [::]:80 [::]:*
LISTEN 0 128 [::]:10050 [::]:*
[root@CentOS84-IP18 ]#
[root@CentOS84-IP18 ]#ps -ef | grep zabbix
.............. 会看到很多信息,不列出了
####################################################################
[root@CentOS84-IP18 ]#
[root@CentOS84-IP18 ]#tail -n 80 /var/log/zabbix/zabbix_server.log
1048:20220508:175212.201 Got signal [signal:15(SIGTERM),sender_pid:6252,sender_uid:0,reason:0]. Exiting ...
1637:20220508:175212.267 HA manager has been paused
1656:20220508:175212.268 syncing history data in progress...
1656:20220508:175212.268 syncing history data done
1637:20220508:175213.295 HA manager has been stopped
1048:20220508:175213.302 syncing trend data...
1048:20220508:175213.354 syncing trend data done
1048:20220508:175213.356 Zabbix Server stopped. Zabbix 6.0.4 (revision 3d787ff402e).
6257:20220508:175213.389 Starting Zabbix Server. Zabbix 6.0.4 (revision 3d787ff402e).
6257:20220508:175213.390 **** Enabled features **
6257:20220508:175213.390 SNMP monitoring: YES
6257:20220508:175213.390 IPMI monitoring: YES
6257:20220508:175213.390 Web monitoring: YES
6257:20220508:175213.390 VMware monitoring: YES
6257:20220508:175213.390 SMTP authentication: YES
6257:20220508:175213.390 ODBC: YES
6257:20220508:175213.390 SSH support: YES
6257:20220508:175213.390 IPv6 support: YES
6257:20220508:175213.390 TLS support: YES
6257:20220508:175213.390 ****************************
6257:20220508:175213.390 using configuration file: /etc/zabbix/zabbix_server.conf
6257:20220508:175213.411 Unsupported DB! MariaDB version is 100703 which is higher than maximum of 100699
6257:20220508:175213.414 current database version (mandatory/optional): 06000000/06000000
6257:20220508:175213.414 required mandatory version: 06000000
6258:20220508:175213.424 starting HA manager
6258:20220508:175213.430 HA manager started in active mode
6257:20220508:175213.431 server #0 started [main process]
6259:20220508:175213.432 server #1 started [service manager #1]
6260:20220508:175213.433 server #2 started [configuration syncer #1]
6261:20220508:175213.714 server #3 started [alert manager #1]
6262:20220508:175213.714 server #4 started [alerter #1]
6263:20220508:175213.715 server #5 started [alerter #2]
6264:20220508:175213.716 server #6 started [alerter #3]
6265:20220508:175213.717 server #7 started [preprocessing manager #1]
6266:20220508:175213.718 server #8 started [preprocessing worker #1]
6267:20220508:175213.719 server #9 started [preprocessing worker #2]
6268:20220508:175213.720 server #10 started [preprocessing worker #3]
6269:20220508:175213.720 server #11 started [lld manager #1]
6270:20220508:175213.721 server #12 started [lld worker #1]
6271:20220508:175213.722 server #13 started [lld worker #2]
6272:20220508:175213.723 server #14 started [housekeeper #1]
6273:20220508:175213.724 server #15 started [timer #1]
6274:20220508:175213.725 server #16 started [http poller #1]
6275:20220508:175213.726 server #17 started [discoverer #1]
6276:20220508:175213.727 server #18 started [history syncer #1]
6277:20220508:175213.728 server #19 started [history syncer #2]
6278:20220508:175213.729 server #20 started [history syncer #3]
6279:20220508:175213.730 server #21 started [history syncer #4]
6280:20220508:175213.732 server #22 started [escalator #1]
6281:20220508:175213.732 server #23 started [proxy poller #1]
6283:20220508:175213.734 server #25 started [task manager #1]
6284:20220508:175213.735 server #26 started [poller #1]
6285:20220508:175213.736 server #27 started [poller #2]
6286:20220508:175213.737 server #28 started [poller #3]
6287:20220508:175213.738 server #29 started [poller #4]
6288:20220508:175213.738 server #30 started [poller #5]
6290:20220508:175213.740 server #32 started [trapper #1]
6291:20220508:175213.741 server #33 started [trapper #2]
6292:20220508:175213.742 server #34 started [trapper #3]
6293:20220508:175213.743 server #35 started [trapper #4]
6294:20220508:175213.744 server #36 started [trapper #5]
6295:20220508:175213.746 server #37 started [icmp pinger #1]
6296:20220508:175213.747 server #38 started [alert syncer #1]
6297:20220508:175213.748 server #39 started [history poller #1]
6298:20220508:175213.749 server #40 started [history poller #2]
6299:20220508:175213.750 server #41 started [history poller #3]
6300:20220508:175213.751 server #42 started [history poller #4]
6301:20220508:175213.752 server #43 started [history poller #5]
6302:20220508:175213.753 server #44 started [availability manager #1]
6303:20220508:175213.754 server #45 started [trigger housekeeper #1]
6289:20220508:175213.754 server #31 started [unreachable poller #1]
6282:20220508:175213.757 server #24 started [self-monitoring #1]
6304:20220508:175213.758 server #46 started [odbc poller #1]
6272:20220508:182213.824 executing housekeeper
6272:20220508:182213.837 housekeeper [deleted 0 hist/trends, 0 items/triggers, 0 events, 0 problems, 0 sessions, 0 alarms, 0 audit, 0 records in 0.009421 sec, idle for 1 hour(s)]
6272:20220508:192213.938 executing housekeeper
6272:20220508:192213.959 housekeeper [deleted 0 hist/trends, 0 items/triggers, 0 events, 0 problems, 0 sessions, 0 alarms, 0 audit, 0 records in 0.019145 sec, idle for 1 hour(s)]
6272:20220508:202214.060 executing housekeeper
6272:20220508:202214.082 housekeeper [deleted 0 hist/trends, 0 items/triggers, 0 events, 0 problems, 0 sessions, 0 alarms, 0 audit, 0 records in 0.019194 sec, idle for 1 hour(s)]
[root@CentOS84-IP18 ]#
####################################################################
#### 正常运行应该看到的run目录下的文件清单
[root@CentOS84-IP18 ]#ll /run/zabbix/
total 8
-rw-rw-r-- 1 zabbix zabbix 4 May 8 2022 zabbix_agentd.pid
srwx------ 1 zabbix zabbix 0 May 8 17:52 zabbix_server_alerter.sock
srwx------ 1 zabbix zabbix 0 May 8 17:52 zabbix_server_availability.sock
srwx------ 1 zabbix zabbix 0 May 8 17:52 zabbix_server_haservice.sock
srwx------ 1 zabbix zabbix 0 May 8 17:52 zabbix_server_lld.sock
-rw-rw-r-- 1 zabbix zabbix 4 May 8 17:52 zabbix_server.pid
srwx------ 1 zabbix zabbix 0 May 8 17:52 zabbix_server_preprocessing.sock
srwx------ 1 zabbix zabbix 0 May 8 17:52 zabbix_server_rtc.sock
srwx------ 1 zabbix zabbix 0 May 8 17:52 zabbix_server_service.sock
[root@CentOS84-IP18 ]#
5. WEB页面初始化
初始化zabbix 的图形化过程 zabbix 6.0 LTS 直接就看到是中文版本了
WEB页面的配置手册: 6 Web界面安装 (zabbix.com) 里面有比较详细的介绍;下面是我们实验过程中的主要步骤截图
关于Zabbix数据库的安全链接,在官网上有比较详细的介绍! 4 安全的连接数据库 (zabbix.com) 关于这块的内容后续再研究下。
Database TLS encryption 1 MySQL 加密配置 - Zabbix 中文文档 v5.0 - 文江博客 (wenjiangs.com) 这个文档内有非常好的解决方案!
配置文件 "etc/zabbix/web/zabbix.conf.php" 已创建。
#### 配置文件 "etc/zabbix/web/zabbix.conf.php" 已创建。[root@CentOS84-IP18 ]#find / -name zabbix.conf.php
/etc/zabbix/web/zabbix.conf.php
[root@CentOS84-IP18 ]#cat /etc/zabbix/web/zabbix.conf.php
// Zabbix GUI configuration file.
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '192.168.250.38';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'shone123456';
// Schema name. Used for PostgreSQL.
$DB['SCHEMA'] = '';
// Used for TLS connection.
$DB['ENCRYPTION'] = false;
$DB['KEY_FILE'] = '';
$DB['CERT_FILE'] = '';
$DB['CA_FILE'] = '';
$DB['VERIFY_HOST'] = false;
$DB['CIPHER_LIST'] = '';
// Vault configuration. Used if database credentials are stored in Vault secrets manager.
$DB['VAULT_URL'] = '';
$DB['VAULT_DB_PATH'] = '';
$DB['VAULT_TOKEN'] = '';
// Use IEEE754 compatible value range for 64-bit Numeric (float) history values.
// This option is enabled by default for new Zabbix installations.
// For upgraded installations, please read database upgrade notes before enabling this option.
$DB['DOUBLE_IEEE754'] = true;
// Uncomment and set to desired values to override Zabbix hostname/IP and port.
// $ZBX_SERVER = '';
// $ZBX_SERVER_PORT = '';
$ZBX_SERVER_NAME = 'Zabbix192.168.250.18';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
// Uncomment this block only if you are using Elasticsearch.
// Elasticsearch url (can be string if same url is used for all types).
//$HISTORY['url'] = [
// 'uint' => 'http://localhost:9200',
// 'text' => 'http://localhost:9200'
//];
// Value types stored in Elasticsearch.
//$HISTORY['types'] = ['uint', 'text'];
// Used for SAML authentication.
// Uncomment to override the default paths to SP private key, SP and IdP X.509 certificates, and to set extra settings.
//$SSO['SP_KEY'] = 'conf/certs/sp.key';
//$SSO['SP_CERT'] = 'conf/certs/sp.crt';
//$SSO['IDP_CERT'] = 'conf/certs/idp.crt';
//$SSO['SETTINGS'] = [];
[root@CentOS84-IP18 ]#
6. 完善中文字体
新Zabbix 6.0版本已经可以直接界面下配置时区和中文(必须系统已经安装了中文语言支持包),但是界面内的图像等中文是乱码!需要完善!!
中文字体,虽然在界面已经是中文了,但是里面很多地方是乱码
#### 了解zabbix 6 LTS下的中文关联关系,是通过软链接来完成的。
## 这个就是配置字体的一个文件
[root@CentOS84-IP18 ]#find / -name defines.inc.php
/usr/share/zabbix/include/defines.inc.php
[root@CentOS84-IP18 ]#
[root@CentOS84-IP18 ]#cat /usr/share/zabbix/include/defines.inc.php | grep font
define('ZBX_FONTPATH', realpath('assets/fonts')); // where to search for font (GD > 2.0.18)
define('ZBX_GRAPH_FONT_NAME', 'graphfont'); // font file name
define('ZBX_FONT_NAME', 'graphfont');
define('ZBX_STYLE_MONOSPACE_FONT', 'monospace-font');
[root@CentOS84-IP18 ]#
#### 【graphfont】字体实际上是一个软链接 ----> 【/etc/alternatives/zabbix-web-font】 ----> 【/usr/share/fonts/dejavu/DejaVuSans.ttf】 从上面的关系看到实际上最终的字体是调用了系统的 DejaVuSans.ttf 字体。
####################################################################
[root@CentOS84-IP18 ]#find / -name fonts
/boot/efi/EFI/centos/fonts
/etc/fonts
/usr/lib64/firefox/fonts
/usr/share/fonts
/usr/share/doc/HTML/common/fonts
/usr/share/X11/fonts
/usr/share/cockpit/base1/fonts
/usr/share/cockpit/static/fonts
/usr/share/yelp/mathjax/fonts
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts
/usr/share/zabbix/assets/fonts
## 【graphfont】字体实际上是一个软链接 ----> 【/etc/alternatives/zabbix-web-font】
[root@CentOS84-IP18 ]#ll /usr/share/zabbix/assets/fonts
total 0
lrwxrwxrwx 1 root root 33 May 8 11:11 graphfont.ttf -> /etc/alternatives/zabbix-web-font
## 【/etc/alternatives/zabbix-web-font】 ----> 【/usr/share/fonts/dejavu/DejaVuSans.ttf】
[root@CentOS84-IP18 ]#ll /etc/alternatives/zabbix-web-font
lrwxrwxrwx 1 root root 38 May 8 11:11 /etc/alternatives/zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
[root@CentOS84-IP18 ]#
## 继续查看系统的字体情况
[root@CentOS84-IP18 ]#ll /usr/share/fonts/
total 36
drwxr-xr-x. 2 root root 136 Nov 17 20:08 abattis-cantarell
drwxr-xr-x. 2 root root 4096 Nov 17 20:15 dejavu
drwxr-xr-x. 2 root root 4096 Nov 17 20:15 gnu-free
drwxr-xr-x. 2 root root 4096 Nov 17 20:08 google-droid
drwxr-xr-x. 2 root root 4096 Nov 17 20:15 google-noto
drwxr-xr-x. 2 root root 4096 Nov 17 20:15 google-noto-cjk
drwxr-xr-x. 2 root root 74 Nov 17 20:08 google-noto-emoji
drwxr-xr-x. 2 root root 56 Nov 17 20:15 jomolhari
drwxr-xr-x. 2 root root 4096 Nov 17 20:15 julietaula-montserrat
drwxr-xr-x. 2 root root 88 Nov 17 20:15 khmeros
drwxr-xr-x. 2 root root 190 Nov 17 20:08 liberation-mono
drwxr-xr-x. 2 root root 190 Nov 17 20:08 liberation-sans
drwxr-xr-x. 2 root root 45 Nov 17 20:15 lohit-assamese
drwxr-xr-x. 2 root root 44 Nov 17 20:15 lohit-bengali
drwxr-xr-x. 2 root root 47 Nov 17 20:15 lohit-devanagari
drwxr-xr-x. 2 root root 45 Nov 17 20:15 lohit-gujarati
drwxr-xr-x. 2 root root 45 Nov 17 20:15 lohit-gurmukhi
drwxr-xr-x. 2 root root 44 Nov 17 20:15 lohit-kannada
drwxr-xr-x. 2 root root 41 Nov 17 20:15 lohit-odia
drwxr-xr-x. 2 root root 42 Nov 17 20:15 lohit-tamil
drwxr-xr-x. 2 root root 43 Nov 17 20:15 lohit-telugu
drwxr-xr-x. 2 root root 48 Nov 17 20:15 paktype-naskh-basic
drwxr-xr-x. 2 root root 127 Nov 17 20:15 paratype-pt-sans
drwxr-xr-x. 2 root root 46 Nov 17 20:15 sil-abyssinica
drwxr-xr-x. 2 root root 39 Nov 17 20:15 sil-nuosu
drwxr-xr-x. 2 root root 68 Nov 17 20:15 sil-padauk
drwxr-xr-x. 2 root root 36 Nov 17 20:15 smc
drwxr-xr-x. 2 root root 114 Nov 17 20:15 stix
drwxr-xr-x. 2 root root 112 Nov 17 20:15 thai-scalable
drwxr-xr-x. 2 root root 8192 Nov 17 20:13 urw-base35
[root@CentOS84-IP18 ]#ll /usr/share/fonts/dejavu/
total 9708
-rw-r--r--. 1 root root 641716 May 17 2015 DejaVuSans-BoldOblique.ttf
-rw-r--r--. 1 root root 704128 May 17 2015 DejaVuSans-Bold.ttf
-rw-r--r--. 1 root root 640124 May 17 2015 DejaVuSansCondensed-BoldOblique.ttf
-rw-r--r--. 1 root root 702324 May 17 2015 DejaVuSansCondensed-Bold.ttf
-rw-r--r--. 1 root root 632248 May 17 2015 DejaVuSansCondensed-Oblique.ttf
-rw-r--r--. 1 root root 754120 May 17 2015 DejaVuSansCondensed.ttf
-rw-r--r--. 1 root root 356588 May 17 2015 DejaVuSans-ExtraLight.ttf
-rw-r--r--. 1 root root 253116 May 17 2015 DejaVuSansMono-BoldOblique.ttf
-rw-r--r--. 1 root root 331536 May 17 2015 DejaVuSansMono-Bold.ttf
-rw-r--r--. 1 root root 251472 May 17 2015 DejaVuSansMono-Oblique.ttf
-rw-r--r--. 1 root root 340240 May 17 2015 DejaVuSansMono.ttf
-rw-r--r--. 1 root root 633836 May 17 2015 DejaVuSans-Oblique.ttf
-rw-r--r--. 1 root root 756072 May 17 2015 DejaVuSans.ttf
-rw-r--r--. 1 root root 358424 May 17 2015 DejaVuSerif-BoldItalic.ttf
-rw-r--r--. 1 root root 355692 May 17 2015 DejaVuSerif-Bold.ttf
-rw-r--r--. 1 root root 357492 May 17 2015 DejaVuSerifCondensed-BoldItalic.ttf
-rw-r--r--. 1 root root 354828 May 17 2015 DejaVuSerifCondensed-Bold.ttf
-rw-r--r--. 1 root root 357940 May 17 2015 DejaVuSerifCondensed-Italic.ttf
-rw-r--r--. 1 root root 378904 May 17 2015 DejaVuSerifCondensed.ttf
-rw-r--r--. 1 root root 358616 May 17 2015 DejaVuSerif-Italic.ttf
-rw-r--r--. 1 root root 379740 May 17 2015 DejaVuSerif.ttf#### 进入zabbix的自有的字体文件夹,上传一个简单点的隶书字体文件 simli.ttf,开始用微软字体有三个子集用不起来。
[root@CentOS84-IP18 ]#cd /usr/share/zabbix/assets/fonts
[root@CentOS84-IP18 ]#rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring simli.ttf...
100% 9006 KB 692 KB/sec 00:00:13 0 Errors
[root@CentOS84-IP18 ]#ll /usr/share/zabbix/assets/fonts
total 28196
lrwxrwxrwx 1 root root 33 May 8 11:11 graphfont.ttf -> /etc/alternatives/zabbix-web-font
-rw-r--r-- 1 root root 9223160 Oct 17 2021 simli.ttf
## 这个文件夹的最后一个软链接就是字体定义的
[root@CentOS84-IP18 ]#ll /etc/alternatives/
total 0
........................
lrwxrwxrwx 1 root root 38 May 8 11:11 zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
## 删除这个字体的软链接指向/usr/share/fonts/dejavu/DejaVuSans.ttf的定义
[root@CentOS84-IP18 ]#rm zabbix-web-font
rm: remove symbolic link 'zabbix-web-font'? y
## 确定软链接删除成功了,最后一行没有 zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf 这行了
[root@CentOS84-IP18 ]#ll /etc/alternatives/
## 创建新的软链接指自己上传的字体
[root@CentOS84-IP18 ]#pwd
/etc/alternatives
[root@CentOS84-IP18 ]#ln -s /usr/share/zabbix/assets/fonts/simli.ttf /etc/alternatives/zabbix-web-font
## 最后一行看到新的字体定义软链接了
[root@CentOS84-IP18 ]#ll
..................................
lrwxrwxrwx 1 root root 40 May 8 23:07 zabbix-web-font -> /usr/share/zabbix/assets/fonts/simli.ttf
## 可以重新下WEB页面也可以不启动会直接生效了。
[root@CentOS84-IP18 ]#systemctl restart zabbix-server zabbix-agent nginx php-fpm