The construction of zabbix monitoring system
system version:
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
[root@localhost ~]# cat /proc/version
Linux version 3.10.0-957.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 8 23:39:32 UTC 2018
zabbix
zabbix components
zabbix agent: deployed on the monitored host, responsible for collecting data on the monitored host, and sending the collected data to the zabbix server
zabbix server: responsible for receiving the data sent by the agent, statistical data, management data
zabbix database: used to store all zabbix configuration information and monitoring data
zabbix web: administrators manage, configure and view related monitoring information through the web interface
zabbix-proxy: distributed monitoring, used to share the pressure of zabbix server
Version
- zabbix stable version: LTS stands for stable version, and the official technical support time is up to 5 years (free)
- zabbix Standard Edition: without LTS label, the official technical support time is 7 months (free)
Query address: https://www.zabbix.com/cn/life_cycle_and_release_policy
prepare the environment;
script
=system environment initialization script=
——>> Turn off firewall and SELinux <<<——
——>> Create Ali warehouse <<<——
——>>> Set time zone and sync time <<<——
Install Zabbix repository
[root@localhost ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm [root@localhost ~]# yum clean all
Install Zabbix server and agent
[root@localhost ~]# yum install zabbix-server-mysql zabbix-agent
Install Zabbix frontend
[root@localhost ~]# yum install centos-release-scl
Edit the file /etc/yum.repos.d/zabbix.repo and enable the zabbix-frontend repository
[root@localhost ~]# ls /etc/yum.repos.d/zabbix.repo [root@localhost ~]# vim /etc/yum.repos.d/zabbix.repo ...... [zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend enabled=1 #Modified to 1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 ......
Install Zabbix frontend package
[root@localhost ~]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
Install mariadb-server database
[root@localhost ~]# yum -y install mariadb-server
Start the database and start it permanently
[root@localhost ~]# systemctl start mariadb.service [root@localhost ~]# systemctl enable mariadb.service
enter the database
[root@localhost ~]# mysql
Create zabbix library
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Create a zabbix user and set the password to 123456
MariaDB [(none)]> create user zabbix@localhost identified by '123456';
The zabbix user is authorized to access all tables in the zabbix library
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
View Database Libraries
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | | zabbix | +--------------------+
switch user
MariaDB [(none)]> use zabbix;
View the table in the zabbix library, (there is no table here)
MariaDB [zabbix]> show tables; Empty set (0.00 sec)
Import the initial schema and data on the Zabbix server host. You will be prompted to enter the newly created password
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix Enter password: enter mariadb set password
Enter the database to view the tables in the zabbix library
[root@localhost ~]# mysql MariaDB [(none)]> use zabbix MariaDB [zabbix]> show tables; +----------------------------+ | Tables_in_zabbix | +----------------------------+ | acknowledges | | actions | | alerts | | application_discovery | | application_prototype | | application_template | | applications | | auditlog | ...... | widget | | widget_field | +----------------------------+ 166 rows in set (0.00 sec)
Configure database for Zabbix server
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf SocketDir=/var/run/zabbix ### Option: DBHost # Database host name. # If set to localhost, socket is used for MySQL. # If set to empty string, socket is used for PostgreSQL. # # Mandatory: no # Default: # DBHost=localhost ### Option: DBName # Database name. # # Mandatory: yes # Default: # DBName= DBName=zabbix `database name` ### Option: DBSchema # Schema name. Used for PostgreSQL. # # Mandatory: no # Default: # DBSchema= ### Option: DBUser # Database user. # # Mandatory: no # Default: # DBUser= DBUser=zabbix `database username` ### Option: DBPassword # Database password. # Comment this line if no password is used. # # Mandatory: no # Default: DBPassword=123456 `database password`
Configure PHP for Zabbix Frontend
[root@localhost ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf php_value[date.timezone] = Asia/Shanghai
Start Zabbix server and agent processes
Start Zabbix server and agent processes and have them start at system boot.
[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm [root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
zabbix log
[root@localhost ~]# ls /var/log/zabbix/ zabbix_agentd.log zabbix_server.log
Browser access local ip192.168.70.10
All items are OK before continuing to configure
Password Enter the password of the zabbix user in the database
Login with initial account and password
Enter
Chinese zabbix interface
user
Create a normal user
1-7 means Monday to Sunday 00:00-24:00 means 24 hours
normal user login
Amin logs in after changing the password