2020.05 The long-awaited Zabbix 5.0 LTS version is officially released. The new Zabbix 5.0 LTS refactors the front-end web to bring a new user experience. Release of the next-generation Zabbix Agent2 based on the Go language and comprehensive security upgrades and many other features. Next, I will introduce the simple use of Zabbix 5.0 LTS and Agent 2 and the Zabbix 5.0 LTS platform on CentOS 8.
What's New in Zabbix 5.0 LTS
https://www.zabbix.com/whats_new_5_0
Zabbix 5.0 LTS version requirements
PHP
PHP ≥ 7.2.0
Database version
MySQL ≥ 5.5.62
MariaDB ≥ 10.0.37
PostgreSQL ≥ 9.2.24
Oracle ≥ 11.2
system version
[ root@zabbix-server /]# cat /etc/redhat-release
CentOS Linux release 8.1.1911(Core)
selinux
sed -i '/SELINUX/s/enforcing/disabled/'/etc/selinux/config
setenforce 0
System software package
dnf install sysstat traceroute net-tools telnet tree \
net-snmp-utils vim lrzsz tcpdump wget git zip tar
firewall
firewall-cmd --add-port=10050/tcp --permanent
firewall-cmd --add-port=10051/tcp --permanent
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
PHP
Install php components
dnf install php php-opcache php-gd php-curl php-mysqlnd \
php-fpm php-xml php-mbstring php-bcmath php-json php-ldap
php optimization
vim /etc/php.ini
expose_php = Off #Suppress the display of php version information
short_open_tag = On #Cancel the previous;, Modify it to On. Indicates support for php short tags
cgi.fix_pathinfo=1 #Remove the comment and enable the pathinfo pseudo-static function of PHP.
post_max_size = 100M #The maximum data for a single submission, this item is not a limitation on the size of a single file,It restricts the submitted data of the entire form, the default is 8M
upload_max_filesize = 50M #The maximum permitted size of uploaded files, the default is 2M
max_execution_time =600 #The maximum time the script runs, the default is 30 seconds
max_input_time =600 #The time that the script can consume, the default is 60 seconds
memory_limit = 256M #The maximum memory consumed by the script running, change the value according to your needs, the default is 128M
date.timezone = asia/shanghai #Set time zone
Start php-fpm
systemctl start php-fpm
systemctl enable php-fpm
Mariadb
Install Mariadb
dnf install mariadb-server mariadb -y
systemctl start mariadb && systemctl enable mariadb
mysql_secure_installation
Zabbix database authorization
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@zabbix';
grant all privileges on zabbix.* to [email protected] identified by 'zabbix@zabbix';
flush privileges;
show databases;
select host,user,plugin from mysql.user;
Zabbix Server
Add aliyun zabbix warehouse
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#'/etc/yum.repos.d/zabbix.repo
dnf clean all
**Install zabbix-server-mysql zabbix-web-mysql zabbix-agent **
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-agent
Import Zabbix table structure
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix -h 127.0.0.1
Zabbix configuration file
vim /etc/zabbix/zabbix_server.conf
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix@zabbix
Nginx
Install nginx
dnf install nginx
nginx configuration file
server {
listen 80;
server_name 172.18.30.27;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 128k;
location /{
root /usr/share/nginx/html;
index index.html index.htm index.php;}
error_page 500502503504/50x.html;
location =/50x.html {
root /usr/share/nginx/html;}
location ~ \.php$ {
root html;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;}
Start nginx
nginx -t
systemctl start nginx
systemctl enable nginx
Copy /usr/share/zabbix to /usr/share/nginx/html
cp -r /usr/share/zabbix /usr/share/nginx/html/
Test nginx + php
**Create info.php **
cd /usr/share/nginx/html/
vim info.php
<? php
phpinfo();?>
Test nginx connection php info
http://172.18.30.27/info.php
Start Zabbix server and agent process
systemctl start zabbix-server zabbix-agent nginx php-fpm
systemctl restart zabbix-server zabbix-agent nginx php-fpm
Zabbix****Web UI
http://server_ip_or_name/zabbix
Zabbix 5.0 web interface cannot choose Chinese and Chinese garbled code
Chinese language
Install zh_CN language pack
dnf install langpacks-zh_CN.noarch
Install glibc-common to realize the recognition of language packs
dnf install glibc-common
# If you have already installed it, you need to reinstall it
dnf reinstall glibc-common
View zh_CN language pack
locale -a | grep zh_CN
Chinese garbled
Find the italics (regular) in C:\Windows\Fonts in the Windows system and copy it to the windows desktop, and use cecureFX or lrzsz to transfer to the /usr/share/zabbix/assets/fonts/ directory
cd/usr/share/zabbix/fonts/
ls
graphfont.ttf simkai.ttf
chmod 777 simkai.ttf
cp graphfont.ttf graphfont.ttf.bak
mv simkai.ttf graphfont.ttf
rm -f /etc/alternatives/zabbix-web-font
ln -s /usr/share/zabbix/assets/fonts/graphfont.ttf /etc/alternatives/zabbix-web-font
Zabbix agent 2
Add aliyun zabbix warehouse
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#'/etc/yum.repos.d/zabbix.repo
yum clean all
Install zabbix-agent2
yum install zabbix-agent2
zabbix-agent2 configuration file
Start zabbix-agent2
systemctl start zabbix-agent2
systemctl enable zabbix-agent2
firewall
firewall-cmd --add-port=10050/udp --permanent
firewall-cmd --reload
Automatic registration
Event notification
Email alert
Dingding alarm
python environment
dnf -y install python36 python3-devel
pip3 install switch-i https://mirrors.aliyun.com/pypi/simple/
pip3 install requests -i https://mirrors.aliyun.com/pypi/simple/
Dingding alarm script
[ root@zabbix-server alertscripts]# cat dingdinggaojing.py
#! /usr/bin/python3
# - *- coding: utf-8-*-import time
import requests
import json
import sys
import os
headers ={'Content-Type':'application/json;charset=utf-8'}
api_url ="https://oapi.dingtalk.com/robot/send?access_token=bb057e70118421c046b90939015d28d7beb815963f1d"
def msg(text):
json_text={"msgtype":"text","at":{"atMobiles":[""],"isAtAll": False
}," text":{"content": text
}} print(requests.post(api_url,json.dumps(json_text),headers=headers).content)if __name__ =='__main__':
text = sys.argv[1]msg(text)[root@zabbix-server alertscripts]#
Dingding script test
[ root@zabbix-server alertscripts]# chmod 755 dingdinggaojing.py
[ root@zabbix-server alertscripts]# python3 dingdinggaojing.py zabbix5.0test
Zabbix 5.0 redesigned the front end, replacing the horizontal menu with the sidebar vertical menu
Zabbix 5.0 monitors the new host function module, can check the host's problem events, the latest data, etc.
A new test button is added to the monitoring item in the Zabbix 5.0 host. The monitoring item can be tested to determine whether the monitoring item is configured correctly and to obtain the collected data
Zabbix 5.0 SNMP credential parameters migrated to host interface configuration
Zabbix 5.0 supports displaying macro variables in front-end ciphertext. Use the drop-down list to select the "Secret text" type macro to hide the value of the macro variable
Recommended Posts