Detailed explanation of the process of Zabbix active, passive and web monitoring in distributed monitoring system

Detailed explanation of the process of Zabbix active, passive and web monitoring in distributed monitoring system

In the previous article, we learned about the network discovery function of Zabbix, and combined with action to realize automatic host discovery and add the host to Zabbix hosts, linking to the specified template for monitoring; please refer to https://www.jb51.net/article/200678.htm for review; today we will learn about the active monitoring, passive monitoring and web monitoring related topics of Zabbix;

1. What is active monitoring? What is passive monitoring?

We know that there are two ways to obtain data, one is get and the other is push; in Zabbix, active monitoring and passive monitoring are described from the agent's side; we call the way of collecting data by the agent actively sending data to the Zabbix server active monitoring; the way of Zabbix server obtaining data from the Zabbix agent is called passive monitoring. In this way, only when the Zabbix server periodically requests the Zabbix agent, the Zabbix agent will respond to the corresponding data to the Zabbix server. If the Zabbix server does not request, the Zabbix agent will not send data to the Zabbix server; and in active monitoring, regardless of whether the Zabbix server requests the agent or not, the agent will push data to the server at a specified time frequency; by default, Zabbix uses passive monitoring, which also means that the Zabbix server must constantly request each Zabbix agent to collect data, otherwise there will be no data;

2. Active monitoring work process

To implement active monitoring, first the agent must know what data it collects and then sends it to the server. Secondly, how does the zabbix server distinguish the data sent by different agents? In the zabbix monitoring system, the working process of active monitoring is that after the monitoring configuration is configured on the zabbix web, it is first saved in the zabbix database, and then the zabbix server applies the corresponding configuration to the database. In active mode, the zabbix server will actively connect to the zabbix agent for the first time to push the monitoring configuration to the zabbix agent. After the zabbix agent gets the monitoring configuration, it collects the specified data and sends it to the server at the specified time frequency. In order to identify itself, the zabbix agent will bring the hostname specified in the configuration file when sending data to the server, and use the hostname to identify itself as the agent.

3. Zabbix trap mode

Trap mode is also a kind of active monitoring. Its working process does not depend on the time interval configured by zabbix server or zabbix agent. Its working process is to use zabbix sender tool on the monitored host to send data at irregular intervals, and zabbix server will run a traper process to wait for data sent by each monitored terminal. Then the data is recorded in the database, thus completing a data collection process. This mode is mainly used to collect temporary information when the monitored terminal encounters an emergency.

Configure zabbix agent to work in passive mode

Tip: By default, zabbix agent uses passive mode monitoring, but we need to configure the zabbix server to send instructions to zabbix agent to collect data; the Server command in the red box above is to configure the zabbix server to send instructions to this agent to collect data. It can configure multiple zabbix server IP addresses; after configuring the above Server, save the configuration, start zabbix agent, configure zabbix agent in the zabbix web interface, select zabbix agent to complete the configuration of the corresponding item; as shown below

Configure zabbix agent to work in active mode

Tip: To configure zabbix agent to work in active mode, you need to configure ServerActive and the corresponding host name in addition to Server. The ServerActive instruction is used to specify to whom the data is sent. To configure the host name, you can use Hostname to directly specify a fixed host name, or use HostnameItem to use the built-in zabbix key system.hostname to obtain the host name. You can choose one of these two methods.

Active mode zabbix agent configuration file

[root@node05 ~]# grep -Ei ^[az] /etc/zabbix/zabbix_agentd.conf 
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.0.43
ServerActive=192.168.0.43
HostnameItem=system.hostname
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[root@node05 ~]#

In the zabbix web gui configuration, the type of the corresponding zabbix agent is zabbix agent (active)

Let’s check whether the item we just defined can collect data?

Tip: The ability to collect data indicates that it is normal to configure zabbix agent to active mode;

Configure items of type zabbix trapper on zabbix web

Tip: The above configuration allows the host node05.test.org to use zabbix sender to send data to zabbix server. The key of the sent data is test_trap. This key has no real meaning and is mainly used to identify the corresponding data. After this configuration, a trapper is configured on the zabbix server to receive the data with the key test_trap sent by node05.test.org using zabbix_sender.

Install the zabbix-sender tool on node05

Use zabbix_sender on node05 to send data of the key test_trap to zabbix server

Tips: -z specifies the address of the zabbix server, -s specifies the host name of the local machine; -k specifies the key for receiving data, -o indicates sending the data corresponding to the key, -o can be given a value directly or by command substitution;

Only check on zabbix web whether the corresponding key has received data?

Tip: You can see that the corresponding key has received data; this trap can usually be used when there is no zabbix agent and the corresponding monitored host wants to send specific data to the zabbix server at a specific frequency. We can configure the zabbix sender command executed on the monitored end as a scheduled task, which can also complete periodic data collection;

The above are the two commonly used active monitoring configurations in zabbix. Next, let’s take a look at zabbix’s web monitoring.

What is web monitoring? From the literal meaning, it means monitoring web pages. Yes, it means monitoring web pages. We know that a web site is usually not just one page. In addition to the homepage, there are other system pages, such as payment system, order management system, etc. If we monitor whether a web site is normal, it is obviously not enough to monitor only the homepage. On zabbix, it provides an interface for monitoring web pages. We only need to configure the access URL of the corresponding monitored page. In zabbix's web monitoring, it will monitor three indicator data of our specified page by default, namely, the resource download speed, page response time and response code of the specified page.

Configure web service monitoring on node05

Install web service nginx on node05 for testing

Simulate providing multiple access pages and start nginx

Configure the web service on monitoring node05 on the zabbix web page

Tip: Find the corresponding host in the host list and select web;

Tip: Select create web scenario to enter the create web scenario page;

Tips: Fill in the name and application, select the update interval, the number of attempts and the agent (client browser, here select the simulated Google browser), fill in the basic information of the web scenario, click step, and fill in the relevant information of the page to be monitored;

Tip: Click add to add the relevant information of the web url to be monitored;

Tip: If there is other information, click add in the corresponding position to add it; add other web page URLs according to the above logic;

Tip: If the monitored web page requires verification of the login username and password, you can select the Authentication menu and fill in the corresponding username and password; as follows

Tip: If there is no verification requirement, you can choose not to fill in the final authentication; finally, after adding the web url, click Add to add the corresponding web page to the zabbix monitoring;

Check out what data items are collected when adding to web monitoring? Is there any data?

Tip: From the above page information, we can see that we added web monitoring, which monitors the download rate, status code and response time on each URL; from the data collected by the above monitoring, we can see that for the URL specified by work1, it monitors the response code as 403. The reason is that we did not authorize the nginx user to read message.html, so it responds with 403; just modify the permissions;

Check nginx's access log to see if it is periodically accessing the corresponding page?

Tip: From the above log, we can see that Zabbix server simulates Google Chrome to access the corresponding monitored page every minute;

The above is the configuration and demonstration related to zabbix web monitoring; later we can define triggers, alarms and other operations based on the indicator data collected by web monitoring;

This concludes this article on the detailed process of Zabbix active, passive and web monitoring in the distributed monitoring system. For more relevant Zabbix distributed monitoring system content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Using zabbix to monitor the ogg process (Windows platform)
  • Detailed explanation of monitoring Jenkins process based on zabbix
  • Distributed monitoring system Zabbix uses SNMP and JMX channels to collect data
  • Detailed explanation of Zabbix monitoring SQL Server service status
  • How to monitor mysql using zabbix
  • Detailed tutorial for upgrading zabbix monitoring 4.4 to 5.0
  • Detailed steps for adding hosts you need to monitor in zabbix
  • Example code for configuring monitoring items and aggregated graphics in Zabbix
  • Using zabbix to monitor the ogg process (Linux platform)

<<:  jQuery implements Table paging effect

>>:  Web design tips on form input boxes

Recommend

Introduction to the use of base link tag base

<br />When you click the link, the web page ...

Practice of realizing Echarts chart width and height adaptation in Vue

Table of contents 1. Install and import 2. Define...

Detailed explanation of how to detect and prevent JavaScript infinite loops

Table of contents Preface Fix infinite loop in fo...

Detailed explanation of MySQL database triggers

Table of contents 1 Introduction 2 Trigger Introd...

Sample code for configuring nginx to support https

1. Introduction Are you still leaving your websit...

How to understand the difference between computed and watch in Vue

Table of contents Overview computed watch monitor...

Native js realizes the drag and drop of the nine-square grid

Use native JS to write a nine-square grid to achi...

Use of js optional chaining operator

Preface The optional chaining operator (?.) allow...

CSS writing format, detailed explanation of the basic structure of a mobile page

1. CSS writing format 1. Inline styles You can wr...

Detailed explanation of key uniqueness of v-for in Vue

Table of contents 1. DOM Diff 2. Add key attribut...

Introduction and tips for using the interactive visualization JS library gojs

Table of contents 1. Introduction to gojs 2. Gojs...

MySQL not null constraint case explanation

Table of contents Set a not null constraint when ...

MySQL automatically inserts millions of simulated data operation code

I use Navicat as my database tool. Others are sim...

Two common solutions to html text overflow display ellipsis characters

Method 1: Use CSS overflow omission to solve The ...