Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Building Zabbix 4.0Monitoring system with Centos 7

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

If you want to know the running status of the server in real time and solve problems in time, it is a good way to use monitoring software. At present, there must be a monitoring system where there is a server. There are many existing monitoring software, but Zabbix can flexibly monitor server resources, and integrates the advantages of both Cacti and Nagio and has more powerful functions, so it is more widely used in the market because of the enterprise-level distributed monitoring.

I. Overview of Zabbix

Zabbix is an enterprise-class open source monitoring suite based on Web interface, which provides distributed system monitoring and network monitoring functions. It has the functions of host performance monitoring, network equipment performance monitoring, database performance monitoring, a variety of alarm methods, detailed reports, chart drawing and other functions. The monitoring object can be Linux or Windows server, router, switch and other network equipment. Through SNMP (simple Network Management Protocol), Zabbix, Agent, PING, port monitoring and other methods to provide remote network server monitoring, data collection and other functions, and provide notification mechanism to enable system administrators to quickly locate and solve various problems in the system. At present, the latest version of Zabbix is Zabbix 3.4. The official website is http://www.zabbix.com.

Zabbix is free. Zabbix follows GPL (General Public license) version 2, which means that its source code can be freely distributed. The commercial version of Zabbix is supported by Zabbix. Many organizations of different sizes in the world are lazy to use Zabbix as one of their main monitoring platforms. Especially now many Internet companies are using it.

Zabbix is a highly integrated network monitoring solution, as shown in the figure:

1. Important components of Zabbix

Zabbix is mainly composed of the following important components, and the specific functions are as follows:

Zabbix Server: the core component responsible for receiving report information sent by Agent. It organizes all configuration, data statistics and data operations.

Database strongage: responsible for storing all configuration information and collected data

Web interface: it is the GUI interface of zabbix. It usually runs on the same host as Zabbix Server when forced on.

Proxy: it is an optional component and is often used in distributed monitoring environments. The agent Server collects part of the data and then forwards it to Server, which can reduce the pressure on Server.

* Agent: deployed on the monitored host (client), responsible for collecting data from the monitored host, such as CPU, memory, database, etc., and then sending it to the server or proxy

2. Zabbix process

By default, Zabbix contains five programs: zabbix_agentd, zabbix_get, zabbix_sender, zabbix_server, zabbix_proxy, and an optional zabbix_java_gateway that needs to be installed separately. Let's introduce their respective roles:

Zabbix_agentd: client daemon, which is used to collect data from the monitored side, such as CPU load, memory, hard disk usage, etc.

The zabbix_get:zabbix tool is a separate command. Zabbix_get is a command to get remote client information on the server or proxy side. It is mainly used for troubleshooting. For example, when the client's memory data is not available on the server side, we can use zabbix_get to obtain the client's content for troubleshooting.

Zabbix_sender: used to send data to server or Proxy, usually for time-consuming checks. Many checks are time-consuming, causing zabbix to time out. So after the script is executed, we can use sender to actively submit the data.

Zabbix_server:zabbix server-side daemon. Zabbix_agentd 、 zabbix_get 、 zabbix_sender 、 zabbix_proxy 、

Zabbix_java_gateway 's data is ultimately submitted to server. Not all data is submitted to zabbix_server actively, some passively submit data, and server takes the initiative to obtain data.

Zabbix_proxy:zabbix proxy daemon. The function is similar to server, except that it is only a transit station, which needs to submit the collected data to server actively (or passively).

Zabbix_java_gateway: a feature introduced after zabbix2.0. As the name implies: Java gateway, similar to agentd, but currently only used in Java, need to pay special attention to, it can only take the initiative to obtain data, not passive access to data. Its data will eventually be submitted to server or proxy;3 or Zabbix monitoring architecture.

In the actual production environment, Zabbix is divided into three architectures according to external factors such as network environment and monitoring scale: server-client (direct connection), master-node-client (Node architecture) and server-proxy-client (Proxy architecture), as shown in the following figure:

1) server-client architecture (direct connection)

Server-client architecture is the simplest architecture of Zabbix. The monitoring computer and the monitored computer exchange data directly between zabbix server and zabbix agentd without any agent. It is suitable for the monitoring environment where the network is relatively simple and there are few devices.

2) master-node-client architecture (node architecture)

Master-node-client architecture is the most complex monitoring architecture of Zabbix, which is suitable for large-scale environments with more devices and across networks and computer rooms. Each node is also a server. You can connect to proxy or client directly under node. Node has its own configuration file and database. What it needs to do is to synchronize the configuration information with the monitoring data item master. When master fails or is damaged, node can guarantee the integrity of the architecture.

3) server-proxy-client architecture (proxy architecture)

Proxy is a bridge between server and client, proxy itself does not have a front end, and it does not store data itself, but temporarily stores the data sent by agentd, and then submits it to server. This architecture is often compared with the master-node-client architecture, and is generally suitable for the monitoring of medium-sized network architecture across computer rooms and networks.

4. YUM install Zabbix

Zabbix provides two installation methods: YUM installation and compilation installation. It should be noted that since the Zabbix package and related dependency packages are not available in the Centos official Yum source, if you want to install Zabbix with YUM, you need to do so through the Zabbix official source or a third-party YUM source. Zabbix server needs LAMP environment or LNMP environment. The following experimental deployment environment uses the LAMP environment installed by YUM as an example to introduce the deployment method of Zabbix monitoring server in detail.

1) install MariaDB

The default database provided on the Centos 7 system CD is not MySQL but MariaDB, so MariaDB is used in the LAMP architecture to play the role of "M", and the rest of the components remain the original Apache and PHP. MariaDB is a branch of the source code of the MySQL database and is compatible with MySQL in most respects.

2) install Zabbix

Because many dependency packages are installed when you install Zabbix, including httpd and PHP-related dependency packages, you can install Zabbix directly. There is no need to install httpd and PHP separately.

Second, set up Zabbix monitoring server

All yum sources for this installation are configured by connecting to the public network and using the network source

Centos 7 source: wget http://mirrors.aliyun.com/repo/Centos-7.repo

Zabbix 4.0Source: rpm-Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm

Zabbix dependent program: yum-y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent

Zabbix official website: Zabbix official website

Zabbix 4.0official configuration document: Zabbix 4.0official configuration document

1. Install Centos 7 source [root@centos02 ~] # cd / etc/yum.repos.d/ [root@centos02 yum.repos.d] # ls local.repo [root@centos02 yum.repos.d] # wget http://mirrors.aliyun.com/repo/Centos-7.repo 2, Install zabbix 4.0[ root@centos02 yum.repos.d] # rpm-Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm3, Install mariadb database [root@centos02 ~] # yum-y install mariadb mariadb-server [root@centos02 ~] # systemctl start mariadb.service [root@centos02 ~] # systemctl enable mariadb.service [root@centos02 ~] # mysqladmin-uroot password [root@centos02 ~] # mysql-uroot-ppwd@123 MariaDB [(none)] > create database zabbix character set utf8 collate utf8_bin MariaDB [(none)] > grant all privileges on zabbix.* to zabbix@localhost identified by 'pwd@123' 4 、 Install and configure zabbix service [root@centos02] # yum-y install zabbix-server-mysql zabbix-web-mysql zabbix-agent [root@centos02 ~] # zcat / usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql-uzabbix-ppwd@123 zabbix [root@centos02 ~] # cp / etc/zabbix/zabbix_server.conf / etc/zabbix/zabbix_server.conf. Bak [root@centos02 ~] # vim / etc/zabbix/zabbix_server.conf 91 DBHost=localhost 100 DBName=zabbix 116 DBUser=zabbix 124 DBPassword=pwd@123 [root@centos02 ~] # cp / etc/zabbix/zabbix_agentd.conf / etc/zabbix/zabbix_agentd.conf.bak [root@centos02 ~] # vim / etc/zabbix/zabbix_agentd.conf 98 Server=127.0.0.1 139 ServerActive=127.0.0.1 150 Hostname=Zabbix server [root@centos02 ~] # vim / etc/httpd/conf.d/zabbix.conf 21 php_value date.timezone Asia/Shanghai

Now the basic configuration on the server side is complete, but due to the display of fonts, some of the text may be displayed in garbled when accessing the browser, so you need to download standard Chinese fonts. Can be downloaded from the network disk: https://pan.baidu.com/s/1iFpLZ4_5Snxry2jUmV8fCw

Extraction code: ao89

[root@centos02 ~] # lsanaconda-ks.cfg initial-setup-ks.cfg simkai.ttf [root@centos02 ~] # find /-name graphfont.ttf / usr/share/zabbix/assets/fonts/graphfont.ttf [root@centos02 ~] # mv simkai.ttf / usr/share/zabbix/assets/fonts/ [root@centos02 ~] # cd / usr/share/zabbix/assets/fonts/ [root@centos02 fonts] # lsgraphfont.ttf simkai.ttf [ Root@centos02 ~] # vim / usr/share/zabbix/include/defines.inc.php 70 define ('ZBX_GRAPH_FONT_NAME' 'simkai') [root@centos02 ~] # systemctl start zabbix-server zabbix-agent httpd [root@centos02 ~] # systemctl enable zabbix-server zabbix-agent httpd 5. Configure the Zabbix server through the client using a browser

My client here uses Firefox browser. If not, you can extract it through the above connection.

1) http://192.168.100.20/zabbix visits the zabbix front-end installation wizard and click the Next step key

2) Environmental testing interface to ensure that all software is OK before you can continue

3) Database connection configuration interface, fill in the authorization information according to the zabbix database you just created

4) complete the database connection configuration and fill in the zabbix service information

5) return configuration summary information. Default is the next step.

6) installation completed

7) enter the default user name Admin in the login interface, and then log in to the zabbix server with the password zabbix

8) modify the user and password to log in to the zabbix server, and set the interface language to Chinese

9) after setting up, exit and log in again

10) create bob users, add users to Guests groups, and set passwords, languages and topics

11) check the memory and there will be no Chinese garbled.

6 、 Configure zabbix monitoring Linux client 1) install zabbix client dependency program [root@centos03 yum.repos.d] # rpm-Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm [root@centos03 ~] # yum-y install zabbix-agent [root@centos03 ~] # cp / etc/zabbix/zabbix_agentd.conf / Etc/zabbix/zabbix_agentd.conf.bak [root@centos03 ~] # vim / etc/zabbix/zabbix_agentd.confPidFile=/var/run/zabbix/zabbix_agentd.pidLogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0Server=192.168.100.20 ServerActive=192.168.100.20 Hostname=192.168.100.30 Include=/etc/zabbix/zabbix_agentd.d/*.conf # UnsafeUserParameters=0 [root@centos03 ~] # systemctl start zabbix-agent.service [root@centos03 ~] # systemctl enable zabbix-agent.service [root@centos03 ~] # netstat-anptu | grep zabbix tcp 00 0.0.0.0 root@centos03 10050 0.0.0.0 anptu * LISTEN 2244/zabbix_agentd tcp6 00:: 10050:: * LISTEN 2244/zabbix_agentd 2) pass The client uses the browser to configure the Zabbix server to monitor Linux ① to create the host

② edit details, click submit

③ adds Linux host application set

④ add Monitoring item

⑤ creates a graphic

⑥ create trigger

⑦ View graphic Monitoring Chart

-this is the end of this article. Thank you for reading-

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report