In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article gives you an introduction to the operating framework and installation and deployment of Zabbix. This article not only introduces the running framework and running components of Zabbix, but also introduces the installation and deployment of Zabbix monitoring in detail. I hope you can get something through this article.
1. Zabbix operating architecture
Zabbix is an enterprise-class distributed open source monitoring solution. It can monitor the health of various servers, the stability of the network and the reliability of various application systems. When an exception occurs in monitoring, Zabbix can configure an alarm mechanism based on email, SMS, Wechat and other alarm mechanisms for any event through a flexible I alarm policy. All of this can be configured and operated through the Web interface provided by Zabbix, and the Web-based front-end page also provides excellent reporting and data visualization capabilities. These functions and features make it very easy for operation and maintenance personnel to build a powerful operation and maintenance monitoring and management platform.
The operational architecture of Zabbix is as follows:
You can see from the figure that Zabbix has several main components, which are:
1) zabbix application components 1) Zabbix Server
Zabbix Server is the core component of Zabbix and the core memory of all configuration information, statistics and operation data. It is mainly responsible for receiving the report information sent by the client, and at the same time, all configuration, statistics and configuration operation data are organized by it.
2) Zabbix Database Storage
It is mainly used to store data, and all configuration information and data collected by Zabbix are stored in the database. Commonly used databases are Oracle, Mysql, etc.
3) Zabbix Web interface
This is the GUI interface provided by Zabbix and usually runs on the same physical server as Zabbix Server
4) Zabbix Proxy proxy server
This is an optional component and is often used in distributed monitoring environments. The agent Server can collect performance and availability data instead of Zabbix server, and send it to the Zabbix Server side after summary.
5) Zabbix Agent monitoring agent
Zabbix Agent is deployed on the monitored host, can actively monitor local resources and applications, and is responsible for collecting data and sending it to Zabbix Server or Zabbix Proxy.
2) Zabbix service process
By default, zabbix contains five processes, depending on function and purpose, as follows:
1) zabbix_agentd
Zabbix_agentd is the Zabbix Agent monitoring agent daemon, which is mainly used to collect client data, such as CPU, memory, hard disk, network usage, etc.
2) Zabbix_get
A tool provided by Zabbix, which is usually executed on the Zabbix server or Zabbix Proxy side to obtain remote client information, is actually the process of Zabbix Server going to Zabbix Agent to pull data. This tool is often used to troubleshoot
3) Zabbix_sender
A tool provided by Zabbix to send data to Zabbix server or Zabbix Proxy. It is actually a process by which Zabbix Agent actively sends data to Zabbix Server. It is usually used for time-consuming checks or scenarios with a large number of hosts to monitor.
4) Zabbix_proxy
Zabbix Proxy's proxy daemon, which functions similar to Zabbix server, except that it is only a transit station, which needs to submit the collected data to Zabbix Server or wait for Zabbix server to actively collect it.
5) Zabbix_java_gateway
A feature introduced after Zabbix 2.0 is mainly used to monitor the JAVA application environment, similar to the Zabbix_agentd process. It is important to note that it can only actively push data, not wait for zabbix server or zabbix proxy to pull data. Its data will eventually be given to zabbix server or zabbix proxy.
6) Zabbix_server
Zabbix server is the core process of the whole Zabbix system. The data collected by other processes will eventually be submitted to the Zabbix Server for unified processing.
3) Zabbix monitoring terminology
There are some common terms in the Zabbix monitoring provision system. Here is a brief introduction to the following:
1) Host (host)
Represents a server or network device to be monitored, which can be specified by IP or hostname
2) Host group (host group)
Logical group of hosts: contains hosts and templates, but there is no direct relationship between hosts and templates within the same host group; host groups are usually used when assigning monitoring permissions to users or user groups
3) Monitoring items (item)
Represents a specific object for monitoring, such as monitoring server CPU load, disk space, and so on. Item is the core of Zabbix process data collection. Relative to a monitoring object, each item is identified by "key".
4) trigger (trigger)
It is used to evaluate whether the data received by a monitoring object is within a reasonable range; if the received data is greater than the threshold, the state of the trigger will change from "OK" to "Problem"; when the data received is below the threshold, the state will be changed to "OK"
5) Application set (Applications)
A logical set of monitors
6) Action (action)
Refers to a pre-defined method of handling problems that occur in monitoring. For example, send a notification, when to perform an action, the frequency of execution, etc.
7) alarm medium type (media)
Indicates the means of sending notification and the way of alarm notification. For example, Email, email, etc.
8) template (template)
A set of entities that can be applied to one or more hosts. A template usually contains application sets, monitoring items, triggers, graphics, aggregation graphics, auto-discovery mechanisms, Web scenarios, etc. The template can be directly connected to a host.
In order to realize batch and automatic monitoring, the monitoring items with the same characteristics are usually summarized into the template and then directly referenced in the host to achieve rapid monitoring and deployment.
Installation and deployment of Zabbix monitoring platform
The installation and deployment of Zabbix is very simple. Officially, there are four ways to install it: binary RPM package installation, source code installation, container installation, and virtual machine image installation. According to the learning style and operation and maintenance experience. It is recommended to install zabbix server with source code and install Zabbix_agent through the RPM package.
Zabbix web is built on Apache or Nginx services and PHP scripting language. It requires Apache version 1.3.12 or above, PHP version 5.4.0 or above, as well as PHP expansion package, such as GD version 2.0 or above, libXML version 2.6.15 or above.
Zabbix data storage supports a variety of databases, such as Mysql, Oracle, PostgreSQL and so on, this time using Mysql database. Zabbix's requirements for Mysql must be above version 5.0.3, as well as the InnoDB engine.
1) deploy LNMP environment 1) deploy Nginx
The latest stable version of nginx 1.14.1 is used this time.
[root@zabbix ~] # yum-y install zlib pcre pcre-devel openssl openssl-devel [root@zabbix ~] # wget http://nginx.org/download/nginx-1.14.1.tar.gz[root@zabbix ~] # useradd-s / sbin/nologin www [root@zabbix ~] # tar zxf nginx-1.14.1.tar.gz-C / usr/src [root@zabbix ~] # cd / usr/src/nginx-1.14.1/ [root@zabbix nginx-1.14 .1] #. / configure-- prefix=/usr/local/nginx-- user=www-- group=www\-- with-http_stub_status_module-- with-http_ssl_module-- with-pcre\-- with-http_gzip_static_module & & make & & make install [root@zabbix nginx-1.14.1] # ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin2) deploy Mysql [root@zabbix ~] # wget https://repo. Mysql.com/mysql57-community-release-el7.rpm [root@zabbix ~] # rpm-ivh mysql57-community-release-el7.rpm [root@zabbix ~] # yum-y install mysql mysql-server mysql-devel [root@zabbix ~] # systemctl start mysqld [root@zabbix etc] # ss-lnt | grep 3306LISTEN 0 80: 3306:: *
After yum installs the mysql database, a temporary password is randomly generated, which can be viewed with the following command:
[root@zabbix ~] # grep password / var/log/mysqld.log 2020-01-24T14:35:59.600458Z 1 [Note] A temporary password is generated for root@localhost: Gambirbsu9rZ6y [root @ zabbix ~] # mysql-u root-pG#rbsu9r_Z6ymysql > set global validate_password_policy=0;mysql > set global validate_password_length=6;mysql > set password=password ('123456') / / change password to 1234563) install PHP and optimize [root@zabbix ~] # yum-y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel curl curl-devel openssl openssl-devel openldap openldap-devel [root@zabbix ~] # wget https://www.php.net/distributions/php-7.2.3.tar.gz[root@zabbix ~] # tar zxf php-7.2.3.tar.gz-C / usr/src [root@zabbix ~ ] # cd / usr/src/php-7.2.3/ [root@zabbix php-7.2.3] #. / configure-- prefix=/usr/local/php7-- enable-fpm\-- with-fpm-user=www-- with-fpm-group=www-- with-pdo-mysql=mysqlnd\-- with-mysqli=mysqlnd-- with-zlib-- with-curl-- with-gd-- with-gettext\-- enable-bcmath-- enable-sockets-- with-jpeg-dir\- -with-png-dir-- with-freetype-dir-- with-openssl-- enable-mbstring\-- enable-xml-- enable-session-- enable-ftp-- enable-pdo-- enable-tokenizer\-- enable-zip & & make & & make install [root@zabbix php-7.2.3] # cp php.ini-production / usr/local/php7/lib/php.ini [root@zabbix php-7.2.3] # cp sapi/fpm/php-fpm.service / usr / lib/systemd/system/ [root@zabbix php-7.2.3] # vim / usr/local/php7/lib/php.ini post_max_size = 16Mmax_execution_time = 300memory_limit = 128Mmax_input_time = 300date.timezone = Asia/Shanghai [root@zabbix php-7.2.3] # vim / usr/local/nginx/conf/nginx.conf location ~\ .php$ {root html Fastcgi_pass 127.0.0.1 fastcgi_pass 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / usr/local/nginx/html$fastcgi_script_name; include fastcgi_params } [root@zabbix etc] # cp php-fpm.conf.default php-fpm.conf [root@zabbix etc] # cp php-fpm.d/www.conf.default php-fpm.d/www.conf [root@zabbix etc] # systemctl daemon-reload [root@zabbix etc] # systemctl start php-fpm [root@zabbix etc] # nginx [root@zabbix etc] # ss-lnt | grep 9000LISTEN 0 128 127.0.0.1 cp php-fpm.d/www.conf.default php-fpm.d/www.conf 9000 *: * [root@zabbix etc] # ss-lnt | grep 80LISTEN 0 128 *: 80 *: * LISTEN 0 80: 3306: * 2) compile and install zabbix1) install Zabix [root @ zabbix ~] # yum-y Install net-snmp net-snmp-devel curl curl-devel libevent libevent-devel [root@zabbix ~] # groupadd zabbix [root@zabbix ~] # useradd-g zabbix zabbix [root@zabbix ~] # wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.0/zabbix-4.0.0.tar.gz[root@zabbix ~] # tar zxf zabbix-4.0.0.tar.gz-C / usr/src [root@zabbix ~] # cd / Usr/src/zabbix-4.0.0/ [root@zabbix zabbix-4.0.0] #. / configure-- prefix=/usr/local/zabbix-- with-mysql\-- with-net-snmp-- with-libcurl-- enable-server-- enable-agent-- enable-proxy\-- enable-java-- with-libxml2 & & make & & make install [root@zabbix zabbix-4.0.0] # ln-s / usr/local/zabbix/sbin/* / usr / local/sbin/ [root@zabbix zabbix-4.0.0] # ln-s / usr/local/zabbix/bin/* / usr/local/bin/2) create the database and initialize the table
Zabbix serve needs the support of mysql database!
[root@zabbix ~] # mysql-u root-p123456mysql > create database zabbix character set utf8 collate utf8_bin;mysql > grant all privileges on zabbix.* to zabbix@'192.168.1.%' identified by 'zabbix';mysql > flush privileges; [root@zabbix ~] # cd / usr/src/zabbix-4.0.0/database/mysql/ [root@zabbix mysql] # mysql-u root-p123456mysql > source schema.sql;mysql > source images.sql;mysql > source data.sql / / Import the sql statement of the corresponding MySQL under the zabbix source package 3) configure the zabbix server side [root@zabbix ~] # vim / usr/local/zabbix/etc/zabbix_server.confListenPort=10051LogFile=/tmp/zabbix_server.logDBHost=192.168.1.10DBName=zabbixDBUser=zabbixDBPassword=zabbixListenIP=0.0.0.0StartPollers=5StartTrappers=10StartDiscoverers=10AlertScriptsPath=usr/local/zabbix/share/zabbix/alertscripts [root@zabbix ~] # cp / usr/src/zabbix-4.0.0/misc/init.d/fedora/core/zabbix_server / etc/init.d/zabbix_server [root@zabbix ~] # cp / usr/src/zabbix-4.0.0/misc/init.d/fedora/core/zabbix_agentd / etc/init.d/zabbix_ agentd [root @ zabbix ~] # chmod + x / etc/init.d/zabbix_server [root@zabbix ~] # chmod + x / etc/init.d/zabbix_agentd [root@zabbix ~] # chkconfig zabbix_server on [root@zabbix ~] # chkconfig zabbix_agentd on [root@zabbix ~] # / etc/init.d / zabbix_server start// during startup If an error is reported in the libmysqlclient.so file, it cannot be started You need to do the following [root@zabbix ~] # find /-name libmysqlclient.so/usr/lib64/mysql/libmysqlclient.so [root@zabbix ~] # echo "/ usr/lib64/mysql" > > / etc/ld.so.conf [root@zabbix ~] # ldconfig [root@zabbix ~] # / etc/init.d/zabbix_server start [root@zabbix ~] # ss-lnt | grep 10051LISTEN 0128 *: 10051 *: * 4) deploy zabbix agent
Open another server to deploy zabbix agent,zabbix agent and install it in the way of RPM package!
[root@agent ~] # wget http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.0-2.el7.x86_64.rpm[root@agent ~] # rpm-ivh zabbix-agent-4.0.0-2.el7.x86_64.rpm [root@agent ~] # vim / etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pidLogFile=/var/log/zabbix/zabbix_ Agentd.logServer=192.168.1.10StartAgents=3ServerActive=192.168.1.10Hostname=192.168.1.8Include=/etc/zabbix/zabbix_agentd.d/*.confUnsafeUserParameters=1 / / enable the custom item feature on the agent side Set the parameter to 1, which means enabled! You can use the UserParameter directive [root@agent ~] # systemctl start zabbix-agent5) to install zabbix gui
You need to operate on the zabbix server side!
[root@zabbix] # cp-r / usr/src/zabbix-4.0.0/frontends/php/ / usr/local/nginx/html/zabbix
Client access test:
The solution is as follows:
[root@zabbix ~] # ps-ef | grep php [root@zabbix ~] # chown-R www:www / usr/local/nginx/html/zabbix/
After the modification is completed, refresh the web page, as shown below:
[root@zabbix ~] # zabbix_get-s 192.168.1.8-p 10050-k "system.uptime" / /-s: specify the IP address of the zabbix agent side; / /-p: specify the listening port of the zabbix agent side; / /-k: specify the monitoring item; / / if there is an output result, it means that zabbix server can obtain the data of the zabbix agent, and the configuration is successful!
Local use of the windows system, it is recommended to do the following: control panel → font → italics. Download and upload fonts to zabbix server.
[root@zabbix ~] # ls | grep simhei.ttfsimhei.ttf [root@zabbix ~] # sed-I's usr/local/nginx/html/zabbix/include/defines.inc.php//, where simhei is the font name without the ttf suffix. [root@zabbix] # mv simhei.ttf / usr/local/nginx/html/zabbix/fonts/// so that you can avoid the problem of garbled codes in Chinese
If you can read this, congratulations, you have the most profound practical experience of Zabbix monitoring. If you want to read more related articles, you are welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.