introduction:
Zabbix is an enterprise-level solution that supports real-time monitoring of thousands of servers, virtual machines and network equipment to collect millions of monitoring indicators. CentOS 7, a one-time success, collection!
The main features of Zabbix are
- 1. Indicator collection: collect indicators from any device, system, or application;
- 2. Problem monitoring: locate the intelligent threshold;
- 3. Visualization: a single interface management platform;
- 4. Warning and repair: to ensure timely and effective warning
- 5. Security and authentication: protect your data at all levels
- 6. Easily build and deploy: a large number of templates, ready to use out of the box, save your precious time
- 7. Automatic discovery: automatic monitoring of large-scale dynamic environments
- 8. Distributed monitoring: unlimited expansion
Noun term
The Zabbix system has some professional terms defined by itself. In order to be better familiar with the system terms, the following mainly introduces this article and the terms commonly used in zabbix.
Host
A server, workstation, switch and other network equipment you want to monitor, represented by IP or domain name.
Host group
A collection of multiple units with the same role and attributes. For example, all Windows servers are placed in a host group called "Windows server".
Monitoring item (item)
What data do you want to monitor and obtain for a host or host group. For example: if I want to monitor the CPU usage of all machines, I need to build a monitoring item to get the CPU usage of all servers.
Trigger
It is composed of logical expressions to evaluate the data collected by monitoring items according to preset thresholds. The trigger has two states, namely "problem" and "resolved". For example: In the above, I obtained the CPU usage through monitoring. For example, if I want to warn if the CPU usage exceeds 80%, I can create a trigger to alarm according to the preset situation when the value obtained by the monitoring item exceeds 80%. , The status is "problem", when it is lower than 80%, the alarm is considered to be released, and the status is restored to "resolved".
Event
A single thing that needs attention, such as the above-mentioned trigger status changing from a problem to a normal or from a normal to a problem, can be called an event. The event includes four parts: trigger event, automatic occurrence event, automatic registration event and internal event.
Action
A predefined operation that reacts to an event: For example, when the CPU usage exceeds 80%, the trigger state becomes a problem, that is, an event is generated, and we can preset an action for this event (such as executing the reboot command), Then the system automatically executes the reboot command for the preset of this event.
Zabbix server
Zabbix system realizes the core program of monitoring, the main function is to interact with the monitored host, agent machine, etc., trigger calculation, send alarm notification, collect data and store, etc.
Zabbix agent
A program that is deployed on the monitored object and can actively monitor local resources and applications; generally speaking, we need to install this program on all monitored servers.
Deployment practice
1. Turn off the firewall and selinux
Run the following command to close selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
Run the following command to turn off the firewall
systemctl disable --now firewalld
Restart to take effect
reboot
2. Install zabbix rpm source
Run the following command to install zabbix rpm source
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
3. Install zabbix server and agent
Run the following commands to install zabbix server and agent
yum install zabbix-server-mysql zabbix-agent -y
4. Install zabbix front end
Run the following command to install Software Collections
yum install centos-release-scl -y
Run the following command, change enabled under [zabbix-frontend] to 1
vi /etc/yum.repos.d/zabbix.repo
:wq 保存
Run the following command to install zabbix front-end and related environment
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
5. Install mariadb database
Run the following command to install the database
yum install mariadb-server -y
Run the following commands to start the database and configure the startup
systemctl enable --now mariadb
Run the following command to initialize the database
mysql_secure_installation
6 .zabbix database configuration
Run the following command to create zabbix database and database user
mysql -u root -p (输入数据库root密码进入数据库)
Run the following command to create the zabbix database
create database zabbix default character set utf8 COLLATE utf8_ bin ;
Run the following command to create a zabbix database user
grant all privileges on zabbix.* to zabbix@localhost identified by " zabbix_pwd " ;
quit 退出
Run the following command to import zabbix database
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
7 .zabbix configuration and front-end page installation
Run the following command to modify the database information in the zabbix server configuration file
vi /etc/zabbix/zabbix_server.conf
找到 DBPassword=password ,将数据库密码改为zabbix数据库的密码
:wq 保存
Run the following command to modify the time zone in the zabbix php configuration file
vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
找到php_value[date.timezone],去掉注释及前面的标点符号,改成
php_value[date.timezone] = Asia/Shanghai
:wq 保存
Run the following commands to start related services and configure automatic startup
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
Use the browser to access the zabbix web page to continue the installation
Click Next step to start the installation
Automatically check the environment, if all options are OK, click Next step to proceed to the next step
Configure the database connection, fill in port 0 as the default port 3306, configure the correct host, name, and password and click Next step to proceed to the next step
Zabbix serber configuration does not need to be modified by default, just click Next step to proceed to the next step
Check all parameters, and then click Next step to proceed to the next step
The following interface is zabbix installation is complete, click Finish to complete the installation
Log in to zabbix, the default user name is Admin, and the password is zabbix
Configure Chinese language
Click User settings in the lower left corner, select Language as Chinese (zh\_CN)
Source: jianshu.com/p/9fadc3341873
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。