CN115766428A - Automatic monitoring method, storage medium and electronic device - Google Patents
Automatic monitoring method, storage medium and electronic device Download PDFInfo
- Publication number
- CN115766428A CN115766428A CN202211346299.7A CN202211346299A CN115766428A CN 115766428 A CN115766428 A CN 115766428A CN 202211346299 A CN202211346299 A CN 202211346299A CN 115766428 A CN115766428 A CN 115766428A
- Authority
- CN
- China
- Prior art keywords
- zabbix
- server
- monitored server
- zabbixagent
- deploying
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
本发明公开了一种自动化监控方法、电子装置及存储介质,涉及自动化技术领域,旨在解决现有的Linux系统配置Zabbix监控时,繁琐的人工部署导致效率低、易出错的问题。本发明应用于被监控服务器,基于被监控服务器的系统运行信息和预设的Zabbix Server配置信息获取当前部署ZabbixAgent的被监控服务器所需的配置信息,并写入被监控服务器的配置文件中,基于该文件部署ZabbixAgent,被监控服务器成功部署ZabbixAgent后,向Zabbix Server发送通知。这样无需人工介入,就能简单、快速的完成在Linux操作系统上自动化部署Zabbix,提高工作效率,节约人力成本。
The invention discloses an automatic monitoring method, an electronic device and a storage medium, relates to the field of automation technology, and aims to solve the problems of low efficiency and error-prone problems caused by cumbersome manual deployment when Zabbix monitoring is configured in the existing Linux system. The present invention is applied to the monitored server, based on the system operation information of the monitored server and the preset Zabbix Server configuration information to obtain the configuration information required by the monitored server currently deploying ZabbixAgent, and write it into the configuration file of the monitored server, based on This file deploys ZabbixAgent, and after the monitored server successfully deploys ZabbixAgent, it sends a notification to Zabbix Server. In this way, the automatic deployment of Zabbix on the Linux operating system can be completed simply and quickly without manual intervention, improving work efficiency and saving labor costs.
Description
技术领域technical field
本发明涉及自动化技术领域,具体而言,涉及一种自动化监控方法、存储介质及电子装置。The present invention relates to the technical field of automation, in particular to an automatic monitoring method, a storage medium and an electronic device.
背景技术Background technique
现行的Linux系统上部署Zabbix Agent,需要首先配置软件安装包yum的来源、安装依赖的红帽软件包管理器rpm包,并且要修改配置文件zabbix_agentd.conf。配置文件zabbix_agentd.conf中包含服务器ip地址等配置信息,由于每台服务器的信息不一样,需要登录每台服务器进行手动修改,这样不仅效率低,而且也容易出错。To deploy Zabbix Agent on the current Linux system, you need to first configure the source of the software installation package yum, install the dependent Red Hat Package Manager rpm package, and modify the configuration file zabbix_agentd.conf. The configuration file zabbix_agentd.conf contains configuration information such as the server ip address. Since the information of each server is different, it is necessary to log in to each server for manual modification, which is not only inefficient, but also prone to errors.
相应的,本领域需要一种新的自动化监控方法来解决上述问题。Correspondingly, a new automatic monitoring method is needed in the art to solve the above problems.
发明内容Contents of the invention
本发明旨在解决上述技术问题,即,解决对现有的Linux系统配置Zabbix监控时,繁琐的人工部署导致效率低、易出错的问题。The present invention aims to solve the above technical problems, that is, to solve the problem of low efficiency and error-prone problems caused by cumbersome manual deployment when Zabbix monitoring is configured on the existing Linux system.
为了实现上述目的,在第一方面,本发明提供一种自动化监控方法,应用于被监控服务器,所述方法包含以下步骤:In order to achieve the above object, in a first aspect, the present invention provides an automatic monitoring method, which is applied to a monitored server, and the method includes the following steps:
基于所述被监控服务器的系统运行信息和预设的Zabbix Server的配置信息获取当前部署Zabbix Agent的被监控服务器部署所述Zabbix Agent所需的配置信息;Based on the system operation information of the monitored server and the configuration information of the preset Zabbix Server, the configuration information required for deploying the Zabbix Agent on the monitored server currently deploying the Zabbix Agent is obtained;
将获取的部署所述Zabbix Agent所需的所述配置信息写入所述被监控服务器的zabbix_agentd.conf文件中,基于所述zabbix_agentd.conf文件在所述被监控服务器上部署所述Zabbix Agent;The configuration information required for deploying the Zabbix Agent obtained is written into the zabbix_agentd.conf file of the monitored server, and the Zabbix Agent is deployed on the monitored server based on the zabbix_agentd.conf file;
所述被监控服务器成功部署所述Zabbix Agent后,向Zabbix Server发送通知。After the Zabbix Agent is successfully deployed on the monitored server, a notification is sent to the Zabbix Server.
在上述自动化监控方法的可选技术方案中,所述方法还包括:In the optional technical solution of the above-mentioned automatic monitoring method, the method also includes:
监测记录所述被监控服务器上部署所述Zabbix Agent的过程,或,Monitoring and recording the process of deploying the Zabbix Agent on the monitored server, or,
监测记录所述被监控服务器上部署所述Zabbix Agent的过程,并将部署过程记录和/或部署结果记录展示到屏幕上。Monitoring and recording the process of deploying the Zabbix Agent on the monitored server, and displaying the deployment process record and/or deployment result record on the screen.
在上述自动化监控方法的可选技术方案中,所述监测记录所述被监控服务器上部署所述Zabbix Agent的过程,或,监测记录所述被监控服务器上部署所述Zabbix Agent的过程,并将部署过程记录和/或部署结果记录展示到屏幕上包括:In the optional technical solution of the above-mentioned automated monitoring method, the monitoring records the process of deploying the Zabbix Agent on the monitored server, or monitors and records the process of deploying the Zabbix Agent on the monitored server, and Deployment process records and/or deployment result records displayed on the screen include:
若所述部署过程记录和/或所述部署结果记录存在异常,则展示出相应的异常部署步骤以及对应的异常原因;If there is an exception in the deployment process record and/or the deployment result record, display the corresponding abnormal deployment steps and the corresponding abnormal reason;
若所述部署过程记录和所述部署结果记录均不存在异常,则在所述Zabbix Agent部署完成后展示出部署结果。If there is no abnormality in the deployment process record and the deployment result record, the deployment result will be displayed after the deployment of the Zabbix Agent is completed.
在上述自动化监控方法的可选技术方案中,所述基于所述被监控服务器的系统运行信息和预设的Zabbix Server的配置信息获取当前部署Zabbix Agent的被监控服务器部署所述Zabbix Agent所需的配置信息的方法包括:In the optional technical solution of the above-mentioned automatic monitoring method, the configuration information based on the system operation information of the monitored server and the preset Zabbix Server is obtained to deploy the Zabbix Agent required by the monitored server currently deploying the Zabbix Agent. Methods for configuring information include:
获取所述被监控服务器的所述系统运行信息,包括获取所述被监控服务器的主机名、主机ip地址、路径和端口;Obtaining the system operation information of the monitored server includes obtaining the host name, host ip address, path and port of the monitored server;
获取所述预设的Zabbix Server的所述配置信息,包括获取所述Zabbix Server的ip地址、端口。Obtaining the configuration information of the preset Zabbix Server includes obtaining the ip address and port of the Zabbix Server.
在上述自动化监控方法的可选技术方案中,所述获取当前部署Zabbix Agent的被监控服务器部署所述Zabbix Agent所需的配置信息之后还包括:In the optional technical solution of the above-mentioned automatic monitoring method, after the configuration information required for deploying the Zabbix Agent on the monitored server that currently deploys the Zabbix Agent is obtained, it also includes:
利用sed命令将所述部署所述Zabbix Agent所需的所述配置信息写入所述被监控服务器的所述zabbix_agentd.conf文件中。Using the sed command to write the configuration information required for deploying the Zabbix Agent into the zabbix_agentd.conf file of the monitored server.
在上述自动化监控方法的可选技术方案中,所述所述被监控服务器成功部署所述Zabbix Agent后,向Zabbix Server发送通知包括:In the optional technical solution of the above-mentioned automated monitoring method, after the Zabbix Agent is successfully deployed by the monitored server, sending a notification to the Zabbix Server includes:
所述被监控服务器利用ZabbixAPI向所述Zabbix Server发送所述Zabbix Agent部署完成的信息。The monitored server uses ZabbixAPI to send the Zabbix Agent deployment completion information to the Zabbix Server.
在上述自动化监控方法的可选技术方案中,所述被监控服务器部署了Linux操作系统,所述获取所述被监控服务器的主机名、主机ip地址、路径和端口包括:In the optional technical solution of the above-mentioned automated monitoring method, the monitored server is deployed with a Linux operating system, and the acquisition of the host name, host ip address, path and port of the monitored server includes:
获取所述Linux操作系统的主机名、主机ip地址、路径和端口。Obtain the host name, host ip address, path and port of the Linux operating system.
在第二方面,本发明提供了一种自动化监控装置,所述装置包括:In a second aspect, the present invention provides an automated monitoring device, said device comprising:
获取模块,被配置为基于所述被监控服务器的系统运行信息和预设的ZabbixServer的配置信息获取当前部署Zabbix Agent的被监控服务器部署所述Zabbix Agent所需的配置信息;The acquisition module is configured to obtain the configuration information required for deploying the Zabbix Agent on the monitored server currently deploying the Zabbix Agent based on the system operation information of the monitored server and the configuration information of the preset ZabbixServer;
写入模块,被配置为将获取的部署所述Zabbix Agent所需的所述配置信息写入所述被监控服务器的zabbix_agentd.conf文件中;A write module configured to write the obtained configuration information required for deploying the Zabbix Agent into the zabbix_agentd.conf file of the monitored server;
部署模块,被配置为基于所述zabbix_agentd.conf文件在所述被监控服务器上部署所述Zabbix Agent;A deployment module configured to deploy the Zabbix Agent on the monitored server based on the zabbix_agentd.conf file;
发送模块,被配置为所述被监控服务器成功部署所述Zabbix Agent后,向ZabbixServer发送通知。The sending module is configured to send a notification to ZabbixServer after the monitored server successfully deploys the Zabbix Agent.
在第三方面,本发明提供了一种电子装置,所述电子装置包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述中任一项所述的自动化监控方法。In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, the processor executing the The computer program realizes the automatic monitoring method as described in any one of the above.
在第四方面,本发明提供了一种可读存储介质,所述可读存储介质中存储有多条程序代码,所述程序代码适于由处理器加载并运行以执行上述中任一项所述的自动化监控方法。In a fourth aspect, the present invention provides a readable storage medium, wherein a plurality of program codes are stored in the readable storage medium, and the program codes are adapted to be loaded and run by a processor to execute any one of the above-mentioned The automated monitoring method described above.
在实施本发明的技术方案中,可以根据被监控服务器的系统运行信息和预设的Zabbix Server的配置信息获取部署Zabbix Agent所需的配置信息,将Zabbix Agent所需的配置信息写入所述被监控服务器的zabbix_agentd.conf文件中,基于此文件部署ZabbixAgent,并在部署完成后向Zabbix Server发送通知。通过上述实施方式,无需人工介入,就能简单、灵活、快速的完成在Linux操作系统上自动化部署Zabbix的过程,大大提高了工作效率,节约了人力成本,保证了零出错率。In implementing the technical solution of the present invention, the configuration information required for deploying the Zabbix Agent can be obtained according to the system operation information of the monitored server and the configuration information of the preset Zabbix Server, and the configuration information required for the Zabbix Agent can be written into the monitored server. In the zabbix_agentd.conf file of the monitoring server, ZabbixAgent is deployed based on this file, and a notification is sent to Zabbix Server after the deployment is completed. Through the above implementation mode, the process of automatically deploying Zabbix on the Linux operating system can be completed simply, flexibly and quickly without manual intervention, which greatly improves work efficiency, saves labor costs, and ensures zero error rate.
附图说明Description of drawings
参照附图,本发明的公开内容将变得更易理解。本领域技术人员容易理解的是:这些附图仅仅用于说明的目的,而并非意在对本发明的保护范围组成限制。其中:The disclosure of the present invention will become more comprehensible with reference to the accompanying drawings. Those skilled in the art can easily understand that: these drawings are only for the purpose of illustration, and are not intended to limit the protection scope of the present invention. in:
图1是根据本发明实施例的一种智能设备的交互方法的硬件环境示意图;FIG. 1 is a schematic diagram of a hardware environment of an interaction method for a smart device according to an embodiment of the present invention;
图2是根据本发明实施例的自动化监控方法的主要步骤流程图;Fig. 2 is the flow chart of main steps of the automatic monitoring method according to the embodiment of the present invention;
图3是根据本发明实施例的自动化监控装置的主要结构框图;Fig. 3 is a main structural block diagram of an automatic monitoring device according to an embodiment of the present invention;
图4是用于执行本发明实施例的自动化监控方法的电子装置的主要结构框图;Fig. 4 is a main structural block diagram of an electronic device for implementing the automatic monitoring method of the embodiment of the present invention;
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is an embodiment of a part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first" and "second" in the description and claims of the present invention and the above drawings are used to distinguish similar objects, but not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
在本发明的描述中,“模块”、“处理器”可以包括硬件、软件或者两者的组合。一个模块可以包括硬件电路,各种合适的感应器,通信端口,存储器,也可以包括软件部分,比如程序代码,也可以是软件和硬件的组合。处理器可以是中央处理器、微处理器、数字信号处理器或者其他任何合适的处理器。处理器具有数据和/或信号处理功能。处理器可以以软件方式实现、硬件方式实现或者二者结合方式实现。非暂时性的计算机可读存储介质包括任何合适的可存储程序代码的介质,比如磁碟、硬盘、光碟、闪存、只读存储器、随机存取存储器等等。术语“A和/或B”表示所有可能的A与B的组合,比如只是A、只是B或者A和B。单数形式的术语“一个”、“这个”也可以包含复数形式。In the description of the present invention, "module" and "processor" may include hardware, software or a combination of both. A module may include hardware circuits, various suitable sensors, communication ports, memory, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, a digital signal processor or any other suitable processor. The processor has data and/or signal processing functions. The processor can be implemented in software, hardware or a combination of both. The non-transitory computer readable storage medium includes any suitable medium that can store program code, such as magnetic disks, hard disks, optical disks, flash memory, read only memory, random access memory, and the like. The term "A and/or B" means all possible combinations of A and B, such as only A, only B or A and B. The terms "a" and "the" in the singular may also include plural forms.
根据本发明实施例的一个方面,提供了一种自动化监控方法。该自动化监控方法广泛应用于智慧家庭(Smart Home)、智能家居、智能家用设备生态、智慧住宅(Intelligence House)生态等全屋智能数字化控制应用场景。可选地,在本实施例中,上述自动化监控方法可以应用于如图1所示的由被监控服务器102和监控服务器104所构成的硬件环境中。如图1所示,监控服务器104通过网络与被监控服务器102进行连接,可用于为被监控服务器102或设置被监控服务器102的终端设备提供服务(如应用服务等),可在监控服务器104上或独立于监控服务器104设置数据库,用于为监控服务器104提供数据存储服务,可在监控服务器104上或独立于监控服务器104配置云计算和/或边缘计算服务,用于为监控服务器104提供数据运算服务。According to an aspect of the embodiments of the present invention, an automatic monitoring method is provided. The automatic monitoring method is widely used in smart home (Smart Home), smart home, smart home equipment ecology, smart house (Intelligence House) ecology and other intelligent digital control application scenarios in the whole house. Optionally, in this embodiment, the above automatic monitoring method may be applied to a hardware environment composed of the monitored
上述网络可以包括但不限于以下至少之一:有线网络,无线网络。上述有线网络可以包括但不限于以下至少之一:广域网,城域网,局域网,上述无线网络可以包括但不限于以下至少之一:WIFI(Wireless Fidelity,无线保真),蓝牙。被监控服务器102可以为监控服务器104或与监控服务器104信息交互的PC、手机、平板电脑等。The foregoing network may include but not limited to at least one of the following: a wired network and a wireless network. The above-mentioned wired network may include but not limited to at least one of the following: wide area network, metropolitan area network, and local area network, and the above-mentioned wireless network may include but not limited to at least one of the following: WIFI (Wireless Fidelity, Wireless Fidelity), Bluetooth. The monitored
下面对本发明中一些技术术语进行解释:Some technical terms in the present invention are explained below:
Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。Zabbix能监视各种网络参数,以保证服务器系统的安全运营,并且提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。Zabbix is an enterprise-level open source solution based on a WEB interface that provides distributed system monitoring and network monitoring functions. Zabbix can monitor various network parameters to ensure the safe operation of the server system, and provides a flexible notification mechanism to allow system administrators to quickly locate/solve various problems.
Zabbix由2部分构成,Zabbix Server与可选组件Zabbix Agent。Zabbix Server可以通过SNMP、Zabbix Agent、ping、端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能。Zabbix Agent需要安装在被监视的目标服务器上,它主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集,并传输给Server端。Zabbix consists of 2 parts, Zabbix Server and optional Zabbix Agent. Zabbix Server can provide remote server/network status monitoring, data collection and other functions through SNMP, Zabbix Agent, ping, port monitoring and other methods. Zabbix Agent needs to be installed on the monitored target server. It mainly completes the collection of hardware information or operating system-related memory, CPU and other information, and transmits it to the Server.
如背景技术部分所述,现行的Linux系统上部署Zabbix Agent,需要配置yum源、安装依赖的rpm包,并且要修改配置文件zabbix_agentd.conf。配置文件zabbix_agentd.conf中包含服务器ip地址等配置信息,由于每台服务器的信息不一样,需要登录每台服务器进行手动修改,这样不仅效率低,而且也容易出错。IT运维工程师长期配置监控,操作重复机械,且服务器数据较大,部署起来少则需要半天时间,多则要花费整天时间,遇特殊情况可能会更长,需要牢记的命令和参数繁多,本发明可以自动安装Zabbix Agent并配置好配置文件,自动部署省时省力。As mentioned in the background technology section, to deploy Zabbix Agent on the current Linux system, it is necessary to configure the yum source, install the dependent rpm package, and modify the configuration file zabbix_agentd.conf. The configuration file zabbix_agentd.conf contains configuration information such as the server ip address. Since the information of each server is different, it is necessary to log in to each server for manual modification, which is not only inefficient, but also prone to errors. IT operation and maintenance engineers configure and monitor for a long time, operate repetitive machines, and the server data is large. It takes half a day to deploy, and it takes a whole day to deploy. In special cases, it may be longer. There are many commands and parameters to keep in mind. The invention can automatically install the Zabbix Agent and configure configuration files, and the automatic deployment saves time and effort.
参阅附图2,图2是根据本发明实施例的自动化监控方法的主要步骤流程图。如图2所示,本发明应用于被监控服务器,其中,被监控服务器部署了Linux操作系统,所述方法包含以下步骤:Referring to accompanying drawing 2, Fig. 2 is a flow chart of main steps of an automatic monitoring method according to an embodiment of the present invention. As shown in Figure 2, the present invention is applied to a monitored server, wherein the monitored server is deployed with a Linux operating system, and the method includes the following steps:
步骤S201:基于被监控服务器的系统运行信息和预设的Zabbix Server的配置信息获取当前部署Zabbix Agent的被监控服务器部署Zabbix Agent所需的配置信息。Step S201: Based on the system operation information of the monitored server and the preset configuration information of the Zabbix Server, the configuration information required for deploying the Zabbix Agent on the monitored server where the Zabbix Agent is currently deployed is obtained.
步骤S202:将获取的部署Zabbix Agent所需的配置信息写入被监控服务器的zabbix_agentd.conf文件中,基于zabbix_agentd.conf文件在被监控服务器上部署ZabbixAgent。Step S202: Write the acquired configuration information required for deploying the Zabbix Agent into the zabbix_agentd.conf file of the monitored server, and deploy the ZabbixAgent on the monitored server based on the zabbix_agentd.conf file.
步骤S203:被监控服务器成功部署Zabbix Agent后,向Zabbix Server发送通知。Step S203: After the Zabbix Agent is successfully deployed on the monitored server, a notification is sent to the Zabbix Server.
在本实施方式中,上述步骤S201至步骤S203中的部署指令可通过构建shell脚本工具执行。In this embodiment, the deployment instructions in the above steps S201 to S203 can be executed by building a shell script tool.
需要说明的是,在一些实施方式中,可以在被监控服务器的Linux操作系统开机时就自动执行shell脚本部署Zabbix Agent。It should be noted that, in some embodiments, the Zabbix Agent can be deployed by automatically executing a shell script when the Linux operating system of the monitored server is started.
在另一些实施方式中,也可以在被监控服务器的Linux操作系统开机后的使用过程中,手动上传脚本执行shell脚本部署Zabbix Agent。In some other embodiments, it is also possible to manually upload a script to execute a shell script to deploy the Zabbix Agent during the use process after the Linux operating system of the monitored server is powered on.
基于上述步骤S201至S203所述的方法,根据被监控服务器的系统运行信息和预设的Zabbix Server的配置信息获取部署Zabbix Agent所需的配置信息,将Zabbix Agent所需的配置信息写入所述被监控服务器的zabbix_agentd.conf文件中,基于此文件部署Zabbix Agent,并在部署完成后向Zabbix Server发送通知,使Zabbix Server对被监控服务器进行监控。这样的方法适合应用于开发、测试及线上生产各环境,能够实现在Linux操作系统中Zabbix Agent监控软件的自动化部署。Based on the method described in the above steps S201 to S203, according to the system operation information of the monitored server and the configuration information of the preset Zabbix Server, the configuration information required for deploying the Zabbix Agent is obtained, and the configuration information required for the Zabbix Agent is written into the In the zabbix_agentd.conf file of the monitored server, deploy Zabbix Agent based on this file, and send a notification to Zabbix Server after the deployment is completed, so that Zabbix Server can monitor the monitored server. This method is suitable for development, testing and online production environments, and can realize the automatic deployment of Zabbix Agent monitoring software in the Linux operating system.
进一步地,上述步骤S201至S203所述的方法可以应用于CentOS操作系统,CentOS6和CentOS7操作系统中默认已配置了Zabbix的最新yum源,可以直接使用默认的yum源来进行安装,在上述部署过程中无需人们手动在CentOS操作系统上操作或执行命令,部署指令通过shell脚本工具执行,只需静待部署完成,由此,本发明提升了在CentOS操作系统中部署监控的效率。Further, the method described in the above steps S201 to S203 can be applied to the CentOS operating system. The latest yum source of Zabbix has been configured by default in the CentOS6 and CentOS7 operating systems, and the default yum source can be used directly for installation. In the above deployment process There is no need for people to manually operate or execute commands on the CentOS operating system, and the deployment instructions are executed through the shell script tool, and only need to wait for the deployment to complete. Thus, the present invention improves the efficiency of deploying monitoring in the CentOS operating system.
下面对上述步骤S201至步骤S203作进一步说明。The above step S201 to step S203 will be further described below.
在步骤S201中,部署Zabbix Agent所需的配置信息可以是基于被监控服务器的系统运行信息和预设的Zabbix Server的配置信息获取的。In step S201, the configuration information required for deploying the Zabbix Agent may be obtained based on the system operation information of the monitored server and the preset configuration information of the Zabbix Server.
在一些实施方式中,被监控服务器的系统运行信息可以是根据被监控服务器的Linux操作系统生成的。In some implementations, the system operation information of the monitored server may be generated according to the Linux operating system of the monitored server.
进一步地,被监控服务器的系统运行信息包括但不限于Linux操作系统的主机名、主机ip地址、路径和端口信息等。Further, the system operation information of the monitored server includes, but is not limited to, the host name, host ip address, path and port information of the Linux operating system.
在一些实施方式中,预设的Zabbix Server的配置信息是固定的,为了提高自动化部署快捷性,Zabbix Server的信息都做了默认配置。In some embodiments, the preset configuration information of Zabbix Server is fixed, and in order to improve the quickness of automatic deployment, the information of Zabbix Server is configured by default.
进一步地,Zabbix Server的配置信息包括但不限于Zabbix Server的ip地址、端口信息等。Further, the configuration information of Zabbix Server includes but not limited to the ip address and port information of Zabbix Server.
通过步骤S201获取到部署Zabbix Agent所需的配置信息后,继续执行步骤S202。After obtaining the configuration information required for deploying the Zabbix Agent through step S201, continue to execute step S202.
在一些实施方式中,步骤S202可以利用流编辑器sed命令将部署Zabbix Agent所需的配置信息写入被监控服务器的zabbix_agentd.conf文件中,以便Zabbix的监控服务器端和被监控服务器端能建立通信,并根据zabbix_agentd.conf文件在被监控服务器上部署Zabbix Agent。In some embodiments, step S202 can use the flow editor sed command to write the configuration information required for deploying Zabbix Agent into the zabbix_agentd.conf file of the monitored server, so that the monitoring server and the monitored server of Zabbix can establish communication , and deploy Zabbix Agent on the monitored server according to the zabbix_agentd.conf file.
成功部署Zabbix Agent后,继续执行步骤S203,被监控服务器向Zabbix Server发送通知。After the Zabbix Agent is successfully deployed, proceed to step S203, and the monitored server sends a notification to the Zabbix Server.
在一些实施方式中,被监控服务器利用Zabbix API向Zabbix Server发送ZabbixAgent部署完成的信息,Zabbix Server在收到信息后,对Agent端进行监控,以此达成对Linux系统自动化监控目的。In some implementations, the monitored server uses the Zabbix API to send the ZabbixAgent deployment completion information to the Zabbix Server, and the Zabbix Server monitors the Agent after receiving the information, so as to achieve the purpose of automatic monitoring of the Linux system.
在一些实施方式中,执行上述步骤S201至步骤S203时,为了避免在部署ZabbixAgent过程中由于某些子步骤出现异常而导致整个部署进程前功尽弃,可以监测记录被监控服务器上部署Zabbix Agent的过程。In some implementations, when performing the above steps S201 to S203, in order to avoid the failure of the entire deployment process due to abnormalities in some sub-steps during the deployment of ZabbixAgent, the process of deploying Zabbix Agent on the monitored server can be monitored and recorded.
在另一些实施方式中,还可以监测记录被监控服务器上部署Zabbix Agent的过程,并将部署过程记录和/或部署结果记录展示到屏幕上。In other embodiments, the process of deploying Zabbix Agent on the monitored server can also be monitored and recorded, and the deployment process record and/or deployment result record can be displayed on the screen.
进一步地,如果部署过程记录和/或部署结果记录存在异常,则及时发出报警并展示出相应的异常部署步骤以及对应的异常原因,供使用者排查错误并解决。Furthermore, if there is an exception in the deployment process record and/or the deployment result record, an alarm will be issued in time and the corresponding abnormal deployment steps and corresponding abnormal reasons will be displayed for users to troubleshoot and solve.
比如,在一些实施方式中,执行脚本安装过程显示安装失败,并显示网络故障,此时,发出报警,并且在人工介入解决网络问题后再次执行安装脚本。For example, in some implementations, the execution of the script installation process shows that the installation fails and a network failure is displayed. At this time, an alarm is issued, and the installation script is executed again after manual intervention to solve the network problem.
在另一些实施方式中,执行脚本安装过程显示安装失败,并显示内存不足,此时,发出报警,并且在人工介入清理内存后再次执行安装脚本。In some other implementations, the execution of the script installation process shows that the installation fails and that the memory is insufficient. At this time, an alarm is issued, and the installation script is executed again after manual intervention to clean up the memory.
进一步地,发出报警可以通过报警提示音、灯光闪烁等方式执行,也可以向与该服务器信息交互的终端发送报警信息以提示相关人员处理,本领域技术人员可以在实际操作中选择合适的报警方式,此处不做限定。Further, issuing an alarm can be performed by means of alarm sound, light flashing, etc., or an alarm message can be sent to a terminal interacting with the server information to prompt relevant personnel to deal with it. Those skilled in the art can choose an appropriate alarm method in actual operation. , is not limited here.
需要说明的是,如果完成监控的自动部署的过程中存在异常,无论从哪个步骤退出的均需要重新执行部署工具。It should be noted that if there is an exception in the process of completing the automatic deployment of monitoring, no matter which step you exit from, you need to re-execute the deployment tool.
以上时部署过程记录和/或部署结果记录存在异常的解决方法,如果部署过程记录和部署结果记录均不存在异常,则在Zabbix Agent部署完成后展示出部署结果,供使用者查验。The solution to the abnormalities in the deployment process records and/or deployment result records above is that if there are no abnormalities in the deployment process records and deployment result records, the deployment results will be displayed for users to check after the deployment of Zabbix Agent is completed.
在本实施例中,执行上述自动化监控方法的shell脚本,是经过多次实践验证后整理的模板,模板中对执行部署过程进行了统一编排,实现了更全面、更详细的Zabbix Agent自动化部署,无需人为操作,并且能够在Zabbix Agent自动化部署时全程记录,保证发生异常时及时发出报警通知相关人员介入解决,能够简单快速的完成整个过程的部署。In this embodiment, the shell script that executes the above-mentioned automated monitoring method is a template that has been verified after many times of practice. The execution and deployment process is uniformly arranged in the template, and a more comprehensive and detailed Zabbix Agent automated deployment is realized. No manual operation is required, and it can record the whole process during the automatic deployment of Zabbix Agent, so as to ensure that when an abnormality occurs, an alarm will be sent in time to notify relevant personnel to intervene in the solution, and the deployment of the entire process can be completed simply and quickly.
上述所有可选技术方案,可以采用任意结合形成本发明的可选实施例,在此不再一一赘述。All the above optional technical solutions can be combined in any way to form an optional embodiment of the present invention, which will not be repeated here.
本发明还提供了一种自动化监控装置,如图3所示,该自动化监控装置包括:The present invention also provides an automatic monitoring device, as shown in Figure 3, the automatic monitoring device includes:
获取模块301,被配置为基于被监控服务器的系统运行信息和预设的ZabbixServer的配置信息获取当前部署Zabbix Agent的被监控服务器部署Zabbix Agent所需的配置信息;The obtaining
写入模块302,被配置为将获取的部署Zabbix Agent所需的配置信息写入被监控服务器的zabbix_agentd.conf文件中;
部署模块303,被配置为基于zabbix_agentd.conf文件在被监控服务器上部署Zabbix Agent。The
发送模块304,被配置为被监控服务器成功部署Zabbix Agent后,向ZabbixServer发送通知。The sending
在一些实施例中,获取模块301获取被监控服务器的系统运行信息,包括获取被监控服务器的主机名、主机ip地址、路径和端口。In some embodiments, the obtaining
在一些实施例中,获取模块301获取预设的Zabbix Server的配置信息,包括获取Zabbix Server的ip地址、端口。In some embodiments, the acquiring
在一些实施例中,写入模块302利用sed命令将部署Zabbix Agent所需的配置信息写入被监控服务器的zabbix_agentd.conf文件中。In some embodiments, the
在一些实施例中,发送模块304用于被监控服务器利用Zabbix API向ZabbixServer发送Zabbix Agent部署完成的信息。In some embodiments, the sending
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units, Completion of modules means that the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit, and the above-mentioned integrated units may adopt hardware It can also be implemented in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present invention. For the specific working process of the units and modules in the above system, reference may be made to the corresponding process in the foregoing method embodiments, and details will not be repeated here.
参阅附图4,图4是用于执行本发明实施例的自动化监控方法的电子装置的主要结构框图。如图4所示,本发明还提供了一种用于执行本发明的自动化监控方法的电子装置,所述电子装置400包括:处理器401、存储器402以及存储在该存储器402中并且可以在处理器401上运行的计算机程序403。处理器401执行计算机程序403时实现上述各个方法实施例中的步骤。或者,处理器401执行计算机程序403时实现上述装置实施例中各模块/单元的功能。Referring to accompanying drawing 4, Fig. 4 is a main structural block diagram of an electronic device for implementing the automatic monitoring method of the embodiment of the present invention. As shown in Fig. 4, the present invention also provides an electronic device for performing the automatic monitoring method of the present invention, the
处理器401可以是中央处理单元(Central Processing Unit,CPU),也可以是其它通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The
存储器402可以分别是电子装置400的内部存储单元,例如,是电子装置400的硬盘或内存。存储器402也可以是电子装置400的外部存储设备,例如,在电子装置400上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器402还可以既包括电子装置400的内部存储单元也包括外部存储设备。存储器402用于存储计算机程序以及电子装置400所需的其它程序和数据。存储器402还可以用于暂时地存储已经输出或者将要输出的数据。The
示例性地,计算机程序403可以被分割成一个或多个模块/单元,一个或多个模块/单元被存储在存储器402中,并由处理器401执行,以完成本发明。一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述计算机程序403在电子装置400中的执行过程。Exemplarily, the
电子装置400可以是桌上型计算机、笔记本、掌上电脑及云端服务器等电子装置。电子装置400可以包括但不仅限于处理器401和存储器402。本领域技术人员可以理解,图4仅仅是电子装置400的示例,并不构成对电子装置400的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如,电子装置还可以包括输入输出装置、网络接入装置、总线等。The
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases, and for parts that are not detailed or recorded in a certain embodiment, refer to the relevant descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所申请的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in connection with the embodiments of the application herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
在本发明所提供的实施例中,应该理解到,所揭露的装置/电子装置和方法,可以通过其它的方式实现。例如,以上所描述的装置/电子装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in the present invention, it should be understood that the disclosed device/electronic device and method can be implemented in other ways. For example, the device/electronic device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. Multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。A unit described as a separate component may or may not be physically separated, and a component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,计算机程序可以存储在计算机可读存储介质中,该计算机程序在被处理器执行时,可以实现上述各个方法实施例的步骤。计算机程序可以包括计算机程序代码,计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。计算机可读介质可以包括:能够携带计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、电载波信号、电信信号以及软件分发介质等。需要说明的是,计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如,在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。If an integrated module/unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention realizes all or part of the processes in the methods of the above-mentioned embodiments, and it can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can be processed When executed by the controller, the steps in the above-mentioned method embodiments can be realized. A computer program may include computer program code, which may be in source code form, object code form, executable file, or some intermediate form or the like. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (Read-Only Memory, ROM), random access Memory (Random Access Memory, RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in computer readable media may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, computer readable media may not Including electrical carrier signals and telecommunication signals.
至此,已经结合附图所示的优选实施方式描述了本发明的技术方案,但是,本领域技术人员容易理解的是,本发明的保护范围显然不局限于这些具体实施方式。在不偏离本发明的原理的前提下,本领域技术人员可以对相关技术特征作出等同的更改或替换,这些更改或替换之后的技术方案都将落入本发明的保护范围之内。So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings, but those skilled in the art will easily understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211346299.7A CN115766428B (en) | 2022-10-31 | 2022-10-31 | Automatic monitoring method, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211346299.7A CN115766428B (en) | 2022-10-31 | 2022-10-31 | Automatic monitoring method, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115766428A true CN115766428A (en) | 2023-03-07 |
CN115766428B CN115766428B (en) | 2025-06-03 |
Family
ID=85354495
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211346299.7A Active CN115766428B (en) | 2022-10-31 | 2022-10-31 | Automatic monitoring method, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115766428B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107659453A (en) * | 2017-10-13 | 2018-02-02 | 千寻位置网络有限公司 | The method that a large amount of TCP serve ports are monitored by zabbix |
CN110445694A (en) * | 2019-09-23 | 2019-11-12 | 成都长虹网络科技有限责任公司 | A method of trigger notice is monitored based on Zabbix |
CN111209012A (en) * | 2019-12-31 | 2020-05-29 | 中国电力科学研究院有限公司 | Linux system-oriented software agent end automatic deployment method |
CN113434156A (en) * | 2021-06-29 | 2021-09-24 | 青岛海尔科技有限公司 | Automatic database deployment method and device, storage medium and electronic device |
-
2022
- 2022-10-31 CN CN202211346299.7A patent/CN115766428B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107659453A (en) * | 2017-10-13 | 2018-02-02 | 千寻位置网络有限公司 | The method that a large amount of TCP serve ports are monitored by zabbix |
CN110445694A (en) * | 2019-09-23 | 2019-11-12 | 成都长虹网络科技有限责任公司 | A method of trigger notice is monitored based on Zabbix |
CN111209012A (en) * | 2019-12-31 | 2020-05-29 | 中国电力科学研究院有限公司 | Linux system-oriented software agent end automatic deployment method |
CN113434156A (en) * | 2021-06-29 | 2021-09-24 | 青岛海尔科技有限公司 | Automatic database deployment method and device, storage medium and electronic device |
Non-Patent Citations (1)
Title |
---|
草莓甜甜圈: "部署Zabbix-agent脚本", 《CSDN》, 13 September 2022 (2022-09-13) * |
Also Published As
Publication number | Publication date |
---|---|
CN115766428B (en) | 2025-06-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110908859B (en) | Application service processing method, device, terminal and storage medium | |
CN105938450A (en) | Method and system for automatic debugging information collection | |
CN114237676B (en) | FPGA logic updating method, device, equipment and readable storage medium | |
CN115543746A (en) | Graphics processor monitoring method, system and device and electronic equipment | |
CN115113890A (en) | A method, system, device and medium for automatic deployment of terminal software | |
CN113138886A (en) | Method and device for testing embedded equipment and testing equipment | |
CN104935451A (en) | A fault detection method and device | |
CN108984216B (en) | A method and device for automatically entering and configuring BIOS | |
US10922305B2 (en) | Maintaining storage profile consistency in a cluster having local and shared storage | |
CN115766428A (en) | Automatic monitoring method, storage medium and electronic device | |
WO2025039408A1 (en) | Component management method and apparatus, and non-volatile storage medium and electronic device | |
CN117221281A (en) | Visual modification method, system, equipment and medium for IP address of camera | |
CN115599617B (en) | Bus detection method, device, server and electronic equipment | |
CN112416385A (en) | Acquisition component management method and system | |
US20190149622A1 (en) | Application Resilience System and Method Thereof for Applications Deployed on Platform | |
US10628583B2 (en) | Detecting a spoofed image in an information handling system | |
CN113608750B (en) | Deployment method and device of monitoring component, computer equipment and storage medium | |
CN114860494A (en) | SAS expander configuration self-adaptive system | |
CN110597519B (en) | Upgrading failure processing method, device and system | |
CN116938711A (en) | Firmware upgrading method and device, electronic equipment and storage medium | |
CN107577546B (en) | Information processing method and device and electronic equipment | |
CN110766374A (en) | Asset automation control method, device, system, equipment and storage medium | |
CN115129517B (en) | A BIOS option failure recovery method, device, equipment and storage medium | |
CN114615646B (en) | Network element switching method, device, electronic equipment and computer readable storage medium | |
CN111352811B (en) | User behavior data acquisition method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |