In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to understand Zabbix active, passive and web monitoring in distributed monitoring system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to understand Zabbix active, passive and web monitoring in distributed monitoring systems.
1. What is active monitoring? What is passive surveillance?
We know that there are two ways to obtain data, one is get, the other is that push; describes in zabbix that both active monitoring and passive monitoring are described by standing on the side of agent; we actively send data to zabbix server by agent to collect data, which is called active monitoring. The way zabbix server acquires data from zabbix agent is called passive monitoring. In this way, only zabbix server periodically requests that zabbix agent,zabbix agent will respond to the corresponding data to zabbix server. If zabbix server does not request, zabbix agent will not send data to zabbix server. Active monitoring will push data to server at a specified time frequency regardless of whether zabbix server requests agent,agent or not. The default zabbix is passive monitoring, which means that zabbix server has to constantly request each zabbix agent to collect data, otherwise there will be no data.
2. Active monitoring of the working process
To achieve active monitoring, agent first needs to know which data it collects and then sends it to the server. Secondly, how does zabbix server distinguish the data sent by different agent? in zabbix monitoring system, the working process of active monitoring is that after the monitoring configuration is configured on zabbix web, it is first saved to zabbix database, and then the corresponding configuration is applied from zabbix server to database. In active mode, zabbix server actively links zabbix agent to push the monitoring configuration to zabbix agent,zabbix agent for the first time, and after it gets the monitoring configuration, it collects the specified data at a specified time and frequency and sends it to the server. In order to identify itself, when zabbix agent sends data to the server, it takes the hostname specified in the configuration file with it and uses hostname to identify which agent it is.
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, nor does it rely on zabbix agent;. Its working process is to use zabbix sender tools on the monitored host to send data irregularly, while the zabbix server side will run a traper process waiting for the data sent by each monitored terminal; then record the data to the database to complete a data collection process. This mode is mainly used to collect temporary information when the monitored side encounters an emergency.
Configure zabbix agent to work in passive mode
Tip: zabbix agent is monitored in passive mode by default, but we need to configure which zabbix server is allowed to send instructions to zabbix agent to collect data. The Server instruction in the red box above is configured to allow that zabbix server to send instructions to this agent to collect data. It can configure multiple ip addresses of zabbix server. After configuring the above Server, save the configuration, start zabbix agent, and use zabbix agent to select zabbix agent in the zabbix web interface to complete the configuration of the corresponding item, as shown in the following figure.
Configure zabbix agent to work in active mode
Tip: to configure zabbix agent to work in active mode, in addition to configuring Server, you should also configure ServerActive and the corresponding hostname, and the ServerActive instruction is used to specify who to send data to; while the way to configure hostname can use Hostname to specify a fixed hostname directly, or use HostnameItem to use the built-in zabbix key system.hostname to obtain hostname. You can choose one of these two ways.
Active Mode zabbix agent profile
[root@node05 ~] # grep-Ei ^ [Amurz] / 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 ~] # View Code
The type that uses the corresponding zabbix agent in zabbix web gui configuration is zabbix agent (active).
Check to see if the item we just defined can collect data.
Hint: the ability to collect data shows that it is normal for us to configure zabbix agent as active mode.
Configure item with zabbix trapper type on zabbix web
Tip: the above configuration allows the host node05.test.org to send data to zabbix server using zabbix sender, and the key for sending 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 zabbix server to receive data from node05.test.org using zabbix_sender to send test_trap this key.
Install zabbix-sender tools on node05
[root@node05 ~] # yum install-y zabbix-sender
Use zabbix_sender to send test_trap this key data to zabbix server on node05
[root@node05 ~] # zabbix_sender-z 192.168.0.43-s node05.test.org-k test_trap-o "$(free | awk'/ ^ Mem/ {print $4}')" info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000360" sent: 1; skipped: 0; total: 1 [root@node05 ~] #
Tip:-z user specifies the address of the zabbix server,-s user specifies the local host name;-k is used to specify the key,-o that receives the data to send the data corresponding to the key.-o can be given a value directly or replaced by the command.
Check whether the corresponding key receives the data on zabbix web.
Tip: you can see that the corresponding key has received data; this kind of trap can usually be used when the monitored host wants to send specific data to the zabbix server at a specific frequency without zabbix agent. We can configure the zabbix sender command executed on the monitored side as a scheduled task, so that periodic data collection can also be completed.
These are the two configurations of active monitoring commonly used in zabbix. Next, let's take a look at zabbix's web monitoring.
What is web monitoring? Literally, it means monitoring web pages, yes, monitoring web pages; we know that a web site is usually not a page, except the home page, 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 the home page only. On zabbix, it provides an interface for monitoring web pages. We only need to configure the access url corresponding to the monitored page. In zabbix's web monitoring, by default, it monitors the three metrics data of our specified page, namely, the resource download speed, page response time and response code of the specified page.
Configure web service monitoring on node05
Install the web service nginx on node05 for testing
[root@node05 ~] # yum install-y nginx
The simulation provides multiple access pages and starts nginx
[root@node05 ~] # cp / var/log/messages / usr/share/nginx/html/message.html [root@node05 ~] # cp / var/log/lastlog / usr/share/nginx/html/lastlog.html [root@node05 ~] # systemctl start nginx.service [root@node05 ~] # ss-tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *: 80 *: * LISTEN 0 128 *: 22 *: * LISTEN 0 100 127 .0.0.1: 25 *: * LISTEN 0 128 *: 10050 *: * LISTEN 0 128: 80 : * LISTEN 0 128: 22:: * LISTEN 0 100:: 1:25 : * LISTEN 0 128: 10050: * [root@node05 ~] #
Configure the web service on the 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 go to the create web scene page
Tip: fill in the name and application, select the update interval, and the number of attempts and agent (client browser, here you choose to simulate Google's browser). After filling in the basic information of web scenari, click step to fill in the relevant information of the page to be monitored.
Tip: click add to add web url related information to be monitored
Tip: if you have any other information, click add to add it at the corresponding location; add other web pages url according to the above logic
Tip: if the monitored web page needs to verify the login user name and password, you can select the Authentication menu to fill in the corresponding user name and password; as follows
Tip: if there is no verification requirement, you can choose not to fill in the final authentication. After adding the web url, click Add to add the corresponding web page to the zabbix monitoring.
Check to see what data items it collects when added to web monitoring. Do you have any data?
Tip: from the information on the above page, you can see that we added to web monitoring, which monitors the download rate, status code and response time on each url. In the data collected by the above monitoring, we can see that for the url specified by work1, the monitoring response code is 403. The reason is that we do not authorize nginx users to read it, so it responds to 403; modify permissions.
[root@node05 ~] # chmod astatr / usr/share/nginx/html/message.html [root@node05 ~] # ll / usr/share/nginx/html/message.html-rw-r--r-- 1 root root 264214 Nov 23 19:01 / usr/share/nginx/html/message.html [root@node05 ~] #
Check nginx's access log to see if it is visiting the corresponding page periodically.
[root@node05 ~] # tail / var/log/nginx/access.log 192.168.0.43-[23/Nov/2020:19:51:23 + 0800] "GET / lastlog.html HTTP/1.1" 292000 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:52:23 + 0800] "GET / index.html HTTP/1.1" 4833 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:52:23 + 0800] "GET / message.html HTTP/1.1" 403 555 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:52:23 + 0800] "GET / lastlog.html HTTP/1.1" 292000 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:53:23 + 0800] "GET / index.html HTTP/1.1" 4833 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:53:23 + 0800] "GET / message.html HTTP/1.1" 403 555 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:53:23 + 0800] "GET / lastlog.html HTTP/1.1" 292000 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:54:23 + 0800] "GET / index.html HTTP/1.1" 4833 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:54:23 + 0800] "GET / message.html HTTP/1.1" 403 555 "-" Mozilla/5.0 (X11) Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36 "-" 192.168.0.43-- [23/Nov/2020:19:54:23 + 0800] "GET / lastlog.html HTTP/1.1" 292000 "-"Mozilla/5.0 (X11; Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36"-"[root@node05 ~] #
Tip: from the log above, we can see that zabbix server simulates Google browser visiting the corresponding monitored page at a frequency of every minute.
At this point, I believe you have a deeper understanding of "how to understand Zabbix active, passive and web monitoring in distributed monitoring systems". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.