In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how Zabbix Web monitoring can still receive data after Zabbix agent is hung up". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how Zabbix Web monitoring can still receive data after Zabbix agent is hung up".
Description of a problem:
Web monitoring is added to a host. When the host is removed from the shelf, it is not deleted in the Zabbix page, and the Web monitoring data on the host can still be received on the Zabbix page. In theory, the Zabbix page should no longer see any monitoring data on the host after the host is unreachable, but only the built-in Web monitoring can see the data. This is a problem.
Analysis of the second problem
It has always been thought that the Web monitoring that comes with Zabbix is performed on the server, so add the corresponding Web monitoring for each host, then the monitoring data seen in the front end of the Zabbix should reflect the access of the corresponding url on this host. But when this host is unreachable, the Web monitoring on this host relies on data updates. Therefore, it is speculated that the Web monitoring that comes with Zabbix is not performed on the Agent side, but on the server side or the proxy side.
Let's start with the Zabbix server source code to understand step by step how Zabbix performs Web monitoring.
Call the main () function in the src/zabbix_server/server.c code to execute the entry program of the Zabbix server process
Call the zbx_load_config () function to load the configuration file
Call the daemon_start () function in the libs/zbxnix/daemon.c code to allow the process to run from the background
Call the MAIN_ZABBIX_ENTRY () function in the src/zabbix_server/server.c code
Call zbx_free_config () to free configuration memory
Call the init_database_cache () function in the libs/zbxdbcache/dbcache.c code to allocate shared memory for the database cache
Call the init_configuration_cache () function in libs/zbxdbcache/dbconfig.c to allocate shared memory for configuration cache
Initialize the zabbix self-monitoring by calling the init_selfmon_collector () function in the libs/zbxself/selfmon.c code
Call the zbx_db_get_database_type () function in the libs/zbxdbhigh/db.c code to determine whether the current database is server or proxy database
The criterion for judging is select userid from users. If there is at least one piece of data in the users table, return ZBX_DB_SERVER. If not, return ZBX_DB_PROXY.
Call the
Call the DBconnect () function in the libs/zbxdbcache/dbconfig.c code to connect to the Zabbix database
Call the DCload_config () function in the libs/zbxdbcache/dbconfig.c code to load the config table into the cache
Call the DCsync_configuration () function to synchronize configuration data from the database
The total number of threads started by Zabbix server is as follows
Threads_num = CONFIG_CONFSYNCER_FORKS + CONFIG_WATCHDOG_FORKS + CONFIG_POLLER_FORKS + CONFIG_UNREACHABLE_POLLER_FORKS + CONFIG_TRAPPER_FORKS + CONFIG_PINGER_FORKS + CONFIG_ALERTER_FORKS + CONFIG_HOUSEKEEPER_FORKS + CONFIG_TIMER_FORKS + CONFIG_HTTPPOLLER_FORKS + CONFIG_DISCOVERER_FORKS + CONFIG_HISTSYNCER_FORKS + CONFIG_ESCALATOR_FORKS + CONFIG_IPMIPOLLER_FORKS + CONFIG_JAVAPOLLER_FORKS + CONFIG_SNMPTRAPPER_FORKS + CONFIG_PROXYPOLLER_FORKS + CONFIG_SELFMON_FORKS + CONFIG_VMWARE_FORKS
Then initialize each thread
Call the get_process_info_by_thread () function in a loop to get process information based on thread information
If thread_args.process_type is ZBX_PROCESS_TYPE_HTTPPOLLER, each httppoller thread calls the zbx_thread_start (httppoller_thread, & thread_args) function in the libs/zbxsys/threads.c code to start the thread
Then call the ZBX_THREAD_ENTRY (httppoller_thread, args) function in the zabbix_server/httppoller/httppoller.c code to loop through the httptests
Then call the process_httptest () function in the zabbix_server/httppoller/httptest.c code to handle each httptest
The process_httptest () function calls several functions provided by libcurl to complete access to the url defined in each httptest.
Curl_easy_setopt () sets various parameters when libcurl accesses url
Curl_easy_perform () executes the access url operation
Curl_slist_free_all (headers_slist); curl_easy_perform () must call this function after execution
Curl_easy_getinfo () gets the result information of accessing url
Call process_step_data () to process httpstep
Call process_httptests () to process httptests
From the point of view of the whole process of Zabbix server processing Web monitoring, Zabbix server iterates the url access defined by httpstep in each httptest through the httppoller thread. Each time it is executed, it has to look for information from the corresponding table, filter processing and then write the executed results to the corresponding table, which has nothing to do with Zabbix agent. Adding Web monitoring on some hosts only reads the Web monitoring steps on this host when httppoller performs a curl operation and then executes on the server side.
You need to know that if a host is managed through Zabbix proxy, the Web monitoring added on that host will be executed by the httppoller thread on its proxy
Summary of three problems
From the above analysis, we can know that when performing Web monitoring, Zabbix server or proxy only reads the Web monitoring projects related to the host to obtain url from the database, then accesses the url through libcurl, and then writes the results to the database. Therefore, if you want to use the Web monitoring provided by Zabbix to check the quality of access to url in the area where each agent is located, because all url is accessed on proxy or server, and the public network access permission of server or proxy is removed, then all web monitoring will be invalid.
These are all the contents of this article entitled "how can Zabbix Web Monitoring still receive data after Zabbix agent hangs up?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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.