Blog:博客園 個人
本部署文檔適用於CentOS 8.X/RHEL 8.X/Anolis OS 8.X/AlmaLinux 8.X/Rockey Linux 8.X。
Zabbix 6.0 LTS於2022年2月15日發布,本次大版本更新,最大亮點是增加了原生HA、機器學習、Kubernetes監控等。
Requirements
硬件要求
Name | Platform | CPU/Memory | Database | Monitored hosts |
---|---|---|---|---|
Small | CentOS | Virtual Appliance | MySQL InnoDB | 100 |
Medium | CentOS | 2 CPU cores/2GB | MySQL InnoDB | 500 |
Large | RedHat Enterprise Linux | 4 CPU cores/8GB | RAID10 MySQL InnoDB or PostgreSQL | >1000 |
Very large | RedHat Enterprise Linux | 8 CPU cores/16GB | Fast RAID10 MySQL InnoDB or PostgreSQL | >10000 |
軟件要求
Database management system
Software | Supported versions | Comments |
---|---|---|
MySQL/Percona | 8.0.X | Required if MySQL (or Percona) is used as Zabbix backend database. InnoDB engine is required. We recommend using the MariaDB Connector/C library for building server/proxy. |
MariaDB | 10.5.00-10.6.X | InnoDB engine is required. We recommend using the MariaDB Connector/C library for building server/proxy. |
Oracle | 19c - 21c | Required if Oracle is used as Zabbix backend database. |
PostgreSQL | 13.X | Required if PostgreSQL is used as Zabbix backend database. |
TimescaleDB for PostgreSQL | 2.0.1-2.3 | Required if TimescaleDB is used as Zabbix backend database. Make sure to install the distribution of TimescaleDB with the compression supported. |
SQLite | 3.3.5-3.34.X | SQLite is only supported with Zabbix proxies. Required if SQLite is used as Zabbix proxy database. |
Frontend
The minimum supported screen width for Zabbix frontend is 1200px.
Software | Version | Comments |
---|---|---|
Apache | 1.3.12 or later | |
PHP | 7.2.5 or later | PHP 8.0 is not supported. |
PHP extensions: | ||
gd | 2.0.28 or later | PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and FreeType 2 (--with-freetype-dir). |
bcmath | php-bcmath (--enable-bcmath) | |
ctype | php-ctype (--enable-ctype) | |
libXML | 2.6.15 or later | php-xml, if provided as a separate package by the distributor. |
xmlreader | php-xmlreader, if provided as a separate package by the distributor. | |
xmlwriter | php-xmlwriter, if provided as a separate package by the distributor. | |
session | php-session, if provided as a separate package by the distributor. | |
sockets | php-net-socket (--enable-sockets). Required for user script support. | |
mbstring | php-mbstring (--enable-mbstring) | |
gettext | php-gettext (--with-gettext). Required for translations to work. | |
ldap | php-ldap. Required only if LDAP authentication is used in the frontend. | |
openssl | php-openssl. Required only if SAML authentication is used in the frontend. | |
mysqli | Required if MySQL is used as Zabbix backend database. | |
oci8 | Required if Oracle is used as Zabbix backend database. | |
pgsql | Required if PostgreSQL is used as Zabbix backend database. |
Server
Mandatory requirements are needed always. Optional requirements are needed for the support of the specific function.
Requirement | Status | Description |
---|---|---|
libpcre | Mandatory | PCRE library is required for Perl Compatible Regular Expression (PCRE) support. The naming may differ depending on the GNU/Linux distribution, for example 'libpcre3' or 'libpcre1'. PCRE v8.x and PCRE2 v10.x (from Zabbix 6.0.0) are supported. |
libevent | Required for bulk metric support and IPMI monitoring. Version 1.4 or higher. Note that for Zabbix proxy this requirement is optional; it is needed for IPMI monitoring support. | |
libpthread | Required for mutex and read-write lock support. | |
zlib | Required for compression support. | |
OpenIPMI | Optional | Required for IPMI support. |
libssh2 or libssh | Required for SSH checks. Version 1.0 or higher (libssh2); 0.6.0 or higher (libssh). libssh is supported since Zabbix 4.4.6. | |
fping | Required for ICMP ping items. | |
libcurl | Required for web monitoring, VMware monitoring, SMTP authentication, web.page.* Zabbix agent items, HTTP agent items and Elasticsearch (if used). Version 7.28.0 or higher is recommended. Libcurl version requirements: - SMTP authentication: version 7.20.0 or higher - Elasticsearch: version 7.28.0 or higher |
|
libxml2 | Required for VMware monitoring and XML XPath preprocessing. | |
net-snmp | Required for SNMP support. Version 5.3.0 or higher. | |
GnuTLS, OpenSSL or LibreSSL | Required when using encryption. |
Agent
Requirement | Status | Description |
---|---|---|
libpcre | Mandatory | PCRE library is required for Perl Compatible Regular Expression (PCRE) support. The naming may differ depending on the GNU/Linux distribution, for example 'libpcre3' or 'libpcre1'. PCRE v8.x and PCRE2 v10.x (from Zabbix 6.0.0) are supported. |
GnuTLS, OpenSSL or LibreSSL | Optional | Required when using encryption. On Microsoft Windows systems OpenSSL 1.1.1 or later is required. |
Agent 2
Requirement | Status | Description |
---|---|---|
libpcre | Mandatory | PCRE library is required for Perl Compatible Regular Expression (PCRE) support. The naming may differ depending on the GNU/Linux distribution, for example 'libpcre3' or 'libpcre1'. PCRE v8.x and PCRE2 v10.x (from Zabbix 6.0.0) are supported. |
OpenSSL | Optional | Required when using encryption. OpenSSL 1.0.1 or later is required on UNIX platforms. The OpenSSL library must have PSK support enabled. LibreSSL is not supported. On Microsoft Windows systems OpenSSL 1.1.1 or later is required. |
環境
- 系統:Rockey Linux 8.5
- 數據庫:MySQL 8.0.26
數據庫
wget -O /etc/yum.repos.d/mysql80.repo https://repo.mysql.com//mysql80-community-release-el8-3.noarch.rpm
dnf clean all
dnf install mysql-server mysql mysql-devel
systemctl enable mysqld
systemctl start mysqld
修改root密碼
mysql> ALTER user 'root'@'localhost' IDENTIFIED BY 'PASSWORD';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
安裝
rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
dnf clean all
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent2
創建初始數據庫
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@'%' identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@'%';
mysql> quit;
導入初始架構和數據,系統將提示您輸入新創建的密碼。
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix
配置
為Zabbix server配置數據庫
編輯配置文件 /etc/zabbix/zabbix_server.conf:
DBPassword=password
為Zabbix前端配置PHP
編輯配置文件/etc/nginx/conf.d/zabbix.conf:
listen 80;
💡Tips:同時需要刪除/etc/nginx/nginx.conf中的80端口相關配置,否則會打不開Zabbix前端。
啟動Zabbix server和agent進程
啟動Zabbix server和agent進程,並為它們設置開機自啟:
systemctl restart zabbix-server zabbix-agent2 nginx php-fpm
systemctl enable zabbix-server zabbix-agent2 nginx php-fpm
配置前端
連接到新安裝的Zabbix前端: http://server_ip_or_name
選擇中文:
必要條件檢測(世界上最好的語言😁):
配置DB連接:
配置:
安裝完成,少年😀
默認用戶名密碼:Admin/zabbix:
進入一個和Zabbix 5.0版本差不多的界面:
中文亂碼解決
圖表界面出現亂碼:
解決:
需要手動上傳本地Windows的字體(如微軟雅黑)到Zabbix服務器的/usr/share/zabbix/assets/fonts/,通常Win10字體文件在C:\Windows\Fonts路徑下。
cd /usr/share/zabbix/assets/fonts
mv graphfont.ttf graphfont.ttf.backup
ln -s msyh.ttf graphfont.ttf
刷新一下圖表,已顯示中文: