[go: up one dir, main page]

CN104991821B - method and device for processing monitoring tasks in batches - Google Patents

method and device for processing monitoring tasks in batches Download PDF

Info

Publication number
CN104991821B
CN104991821B CN201510370053.7A CN201510370053A CN104991821B CN 104991821 B CN104991821 B CN 104991821B CN 201510370053 A CN201510370053 A CN 201510370053A CN 104991821 B CN104991821 B CN 104991821B
Authority
CN
China
Prior art keywords
task
monitoring
software
tasks
processing
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.)
Active
Application number
CN201510370053.7A
Other languages
Chinese (zh)
Other versions
CN104991821A (en
Inventor
王浩宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing 360 Zhiling Technology Co ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510370053.7A priority Critical patent/CN104991821B/en
Publication of CN104991821A publication Critical patent/CN104991821A/en
Application granted granted Critical
Publication of CN104991821B publication Critical patent/CN104991821B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

本发明公开了一种批量处理监控任务的方法及装置。该方法包括:接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;根据预设的任务处理模板,调用监控软件处理任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理。通过本发明中的方法及装置能够处理包含批量任务的任务请求,并将其中的任务划分为多个并行处理的子任务组,从而显著提高了任务处理效率,降低了人工操作的繁琐性、进而杜绝了在繁琐操作中可能出现的疏忽性错误。

The invention discloses a method and a device for batch processing monitoring tasks. The method includes: receiving a task request including at least one batch task, and dividing the batch task into a plurality of sub-task groups; calling monitoring software to process the tasks included in the task request according to a preset task processing template, wherein each sub-task The tasks in the task group are processed in parallel by corresponding sub-processes. The method and device in the present invention can process task requests including batch tasks, and divide the tasks into multiple sub-task groups for parallel processing, thereby significantly improving the task processing efficiency, reducing the tediousness of manual operations, and further Eliminate inadvertent errors that may occur in tedious operations.

Description

批量处理监控任务的方法及装置Method and device for batch processing monitoring tasks

技术领域technical field

本发明涉及网络通信技术领域,具体涉及一种批量处理监控任务的方法及装置。The present invention relates to the technical field of network communication, in particular to a method and device for batch processing monitoring tasks.

背景技术Background technique

目前,网络服务的种类和数量越来越多。在实际情况中,往往会将很多台服务器组成一个服务器集群,由该服务器集群共同为用户提供某项服务。因此,服务器的数量日益庞大,网络管理者经常需要同时对成百甚至上千台服务器进行监控,以便及时发现问题,确保服务的可靠性。At present, there are more and more types and quantities of network services. In actual situations, many servers are often formed into a server cluster, and the server cluster jointly provides a certain service to the user. Therefore, the number of servers is increasing day by day, and network managers often need to monitor hundreds or even thousands of servers at the same time in order to detect problems in time and ensure service reliability.

Zabbix软件是一款常用的监控软件,能够同时监控多台服务器。该软件为用户提供了友好直观的web界面,用户可以在web界面上通过鼠标点击的方式完成添加服务器、删除服务器、修改监控项等多项操作。因此,该软件以其直观性、易操作性的特点赢得了大量的用户。但是,实际情况中往往会涉及大量服务器以及诸多监控项,而zabbix软件在同时处理大量需求时的效率非常低下。例如,如果将某机房新添加的一千台服务器增加到监控列表里,用户通过zabbix软件需要点击“添加”按钮来逐一添加服务器,因而需要点击数千次鼠标才能完成所有服务器的添加工作。如果要从监控列表中删除一千台服务器,又要通过鼠标逐一点击“删除”按钮数千次才能实现。假设每添加/删除一台服务器耗时一秒钟,添加/删除一千台服务器则需耗时一千秒钟,这势必会影响监控软件的监控效率。而且,用户点击数千次鼠标的操作方式不仅容易因操作疏忽而发生错误,还容易导致“鼠标手”等健康问题。Zabbix software is a commonly used monitoring software that can monitor multiple servers at the same time. The software provides users with a friendly and intuitive web interface, and users can complete multiple operations such as adding servers, deleting servers, and modifying monitoring items through mouse clicks on the web interface. Therefore, the software has won a large number of users with its intuitive and easy-to-operate features. However, in practice, a large number of servers and many monitoring items are often involved, and zabbix software is very inefficient when dealing with a large number of demands at the same time. For example, if a thousand newly added servers in a computer room are added to the monitoring list, the user needs to click the "Add" button to add servers one by one through the zabbix software, so it takes thousands of mouse clicks to complete the addition of all servers. If you want to delete a thousand servers from the monitoring list, you need to click the "Delete" button one by one thousands of times to achieve this. Assuming that it takes one second to add/delete one server, it takes one thousand seconds to add/delete one thousand servers, which will inevitably affect the monitoring efficiency of the monitoring software. Moreover, the operation method of the user clicking the mouse thousands of times is not only prone to errors due to negligent operation, but also easily leads to health problems such as "mouse hand".

由此可见,现有的监控软件在处理批量任务时存在着效率低下、操作繁琐且易出错的缺陷。It can be seen that the existing monitoring software has the defects of low efficiency, cumbersome operation and error-prone when dealing with batch tasks.

发明内容SUMMARY OF THE INVENTION

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的批量处理监控任务的方法及装置。In view of the above problems, the present invention is proposed to provide a method and apparatus for batch processing monitoring tasks that overcome the above problems or at least partially solve the above problems.

依据本发明的一个方面,提供了一种批量处理监控任务的方法,包括:According to one aspect of the present invention, a method for batch processing monitoring tasks is provided, comprising:

接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;Receive a task request containing at least one type of batch task, and divide the batch task into multiple sub-task groups;

根据预设的任务处理模板,调用监控软件处理任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理。According to the preset task processing template, the monitoring software is called to process the tasks included in the task request, wherein the tasks in each sub-task group are processed in parallel by the corresponding sub-processes.

依据本发明的另一方面,提供了一种批量处理监控任务的装置,包括:According to another aspect of the present invention, a device for batch processing monitoring tasks is provided, comprising:

接收模块,适于接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;a receiving module, adapted to receive a task request including at least one batch task, and divide the batch task into a plurality of sub-task groups;

处理模块,适于根据预设的任务处理模板,调用监控软件处理任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理。The processing module is adapted to call the monitoring software to process the tasks included in the task request according to a preset task processing template, wherein the tasks in each sub-task group are processed in parallel by corresponding sub-processes.

在本发明提供的批量处理监控任务的方法及装置中,能够直接接收包含批量任务的任务请求,并将其中的批量任务划分为多个子任务组;然后,根据预设的任务处理模板,调用监控软件来处理该任务请求中包含的任务,每个子任务组中的任务通过对应的子进程并行处理。由此可见,本发明中的方法及装置能够处理包含批量任务的任务请求,并将其中的任务划分为多个并行处理的子任务组,从而显著提高了任务处理效率,降低了人工操作的繁琐性、进而杜绝了在繁琐操作中可能出现的疏忽性错误。In the method and device for batch processing monitoring tasks provided by the present invention, a task request including batch tasks can be directly received, and the batch tasks are divided into multiple sub-task groups; then, according to a preset task processing template, the monitoring task is invoked The software processes the tasks included in the task request, and the tasks in each sub-task group are processed in parallel through the corresponding sub-processes. It can be seen that the method and device of the present invention can process task requests including batch tasks, and divide the tasks into multiple sub-task groups for parallel processing, thereby significantly improving the task processing efficiency and reducing the tedious manual operation. Therefore, inadvertent errors that may occur in tedious operations are eliminated.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, in order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are for the purpose of illustrating preferred embodiments only and are not to be considered limiting of the invention. Also, the same components are denoted by the same reference numerals throughout the drawings. In the attached image:

图1示出了本发明实施例提供的批量处理监控任务的方法的流程图;1 shows a flowchart of a method for batch processing monitoring tasks provided by an embodiment of the present invention;

图2示出了本发明一个具体实施例提供的批量处理监控任务的方法的流程图;以及,FIG. 2 shows a flowchart of a method for batch processing monitoring tasks provided by a specific embodiment of the present invention; and,

图3示出了本发明实施例提供的批量处理监控任务的装置的结构图。FIG. 3 shows a structural diagram of an apparatus for batch processing monitoring tasks provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.

本发明实施例提供了一种批量处理监控任务的方法及装置,能够解决现有技术中监控软件处理批量任务时效率低下、操作繁琐且易出错的问题。The embodiments of the present invention provide a method and device for batch processing monitoring tasks, which can solve the problems of low efficiency, complicated operation and error-prone problems in the prior art when monitoring software processes batch tasks.

图1示出了本发明实施例提供的批量处理监控任务的方法的流程图。如图1所示,该方法包括如下步骤:FIG. 1 shows a flowchart of a method for batch processing monitoring tasks provided by an embodiment of the present invention. As shown in Figure 1, the method includes the following steps:

步骤S110:接收至少包含一种批量任务的任务请求。Step S110: Receive a task request including at least one batch task.

其中,任务请求通过命令行形式实现,并且,任务请求中包含用于指示任务类型以及任务处理对象的参数信息。具体地,任务请求中包含的任务类型可以是以下类型中的一种或多种:添加监控对象、删除监控对象、修改监控对象所对应的监控模板、以及为监控对象设置分组。另外,当任务处理对象的数量较少时,用于指示任务处理对象的参数信息可以是各个任务处理对象的标识信息;或者,当任务处理对象的数量较多时,该用于指示任务处理对象的参数信息也可以是存储有全部任务处理对象的标识信息的数据文件的文件信息。The task request is implemented in the form of a command line, and the task request includes parameter information for indicating the task type and the task processing object. Specifically, the task types included in the task request may be one or more of the following types: adding monitoring objects, deleting monitoring objects, modifying monitoring templates corresponding to monitoring objects, and setting groups for monitoring objects. In addition, when the number of task processing objects is small, the parameter information used to indicate the task processing objects may be the identification information of each task processing object; or, when the number of task processing objects is large, the parameter information used to indicate the task processing objects The parameter information may be file information of a data file storing identification information of all task processing objects.

步骤S120:将上述任务请求中的批量任务划分为多个子任务组。Step S120: Divide the batch tasks in the above task request into multiple sub-task groups.

其中,子任务组的个数可以根据需要灵活设定,例如,可以根据任务处理对象的数量以及CPU内核数来确定子任务组的个数。The number of sub-task groups may be flexibly set as required, for example, the number of sub-task groups may be determined according to the number of task processing objects and the number of CPU cores.

步骤S130:根据预设的任务处理模板,调用监控软件处理任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理。Step S130: According to the preset task processing template, the monitoring software is called to process the tasks included in the task request, wherein the tasks in each sub-task group are processed in parallel by corresponding sub-processes.

其中,在任务处理模板中设定了各个任务类型所对应的任务处理流程,根据任务请求中包含的任务类型,选择对应的任务处理流程进行处理。在处理过程中,首先,根据子任务组的数量派生出相应数量的子进程,然后,由各个子进程并行地调用监控软件进行处理。其中,该监控软件可以是zabbix软件,该zabbix软件通过其提供的应用程序接口API函数进行调用。The task processing flow corresponding to each task type is set in the task processing template, and the corresponding task processing flow is selected for processing according to the task type included in the task request. In the processing process, first, a corresponding number of sub-processes are derived according to the number of sub-task groups, and then the monitoring software is called by each sub-process in parallel for processing. Wherein, the monitoring software may be zabbix software, and the zabbix software is invoked through an application programming interface API function provided by the zabbix software.

可选地,调用监控软件处理任务请求中包含的任务的步骤之后进一步包括:如果在预设时间内接收到监控软件返回的任务处理状态,则显示该任务处理状态;如果在预设时间内未接收到监控软件返回的任务处理状态,则重新调用监控软件处理任务请求中包含的任务。由此降低因网络故障所导致的任务处理失败等情况。Optionally, the step of calling the monitoring software to process the tasks included in the task request further includes: if the task processing status returned by the monitoring software is received within a preset time, then displaying the task processing status; After receiving the task processing status returned by the monitoring software, the monitoring software is called again to process the tasks included in the task request. This reduces tasks such as failures in task processing caused by network failures.

通过本发明中的方法能够处理包含批量任务的任务请求,并将其中的任务划分为多个并行处理的子任务组,从而显著提高了任务处理效率,降低了人工操作的繁琐性、进而杜绝了在繁琐操作中可能出现的疏忽性错误。The method in the present invention can process task requests including batch tasks, and divide the tasks into multiple sub-task groups for parallel processing, thereby significantly improving the task processing efficiency, reducing the tediousness of manual operations, and eliminating the need for Inadvertent errors that may occur in tedious operations.

图2示出了本发明一个具体实施例提供的批量处理监控任务的方法的流程图。该方法的执行主体为本发明中用于批量处理监控任务的装置,该装置可通过软件编程或硬件芯片等方式实现。在该实施例中,以调用zabbix软件实现批量添加服务器为例进行说明。如图2所示,该方法包括如下步骤:Fig. 2 shows a flowchart of a method for batch processing monitoring tasks provided by a specific embodiment of the present invention. The execution body of the method is the apparatus for batch processing monitoring tasks in the present invention, and the apparatus can be implemented by means of software programming or hardware chips. In this embodiment, the description is given by using the zabbix software to implement batch addition of servers as an example. As shown in Figure 2, the method includes the following steps:

步骤S210:接收命令行形式的任务请求,获取该任务请求中包含的任务类型。Step S210: Receive a task request in the form of a command line, and acquire the task type included in the task request.

例如,该命令行形式的任务请求可以是:For example, a task request in this command line form could be:

[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py hostcreate[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py hostcreate

其中,“[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/”为用于批量处理监控任务的装置(该装置在本实施例中通过软件实现)的安装路径,“zbxtool.py”为该装置所对应的可执行程序。另外,“host create”为该装置中用于实现批量添加服务器的函数,在该函数中预先定义了批量添加服务器的处理流程。因此,通过命令行中的“hostcreate”字段即可确定该任务请求中包含的任务类型为批量添加服务器。Among them, "[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/" is the installation path of the device for batch processing monitoring tasks (the device is implemented by software in this embodiment), "zbxtool .py” is the executable program corresponding to the device. In addition, "host create" is a function in the device for implementing batch addition of servers, and a processing flow of batch addition of servers is predefined in this function. Therefore, through the "hostcreate" field in the command line, it can be determined that the task type contained in the task request is adding servers in batches.

步骤S220:获取上述任务请求中包含的任务处理对象。Step S220: Obtain the task processing object included in the above task request.

其中,任务请求中包含的任务处理对象可以直接通过命令行中的特定字段来获取。例如,当命令行形式的任务请求为“[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create-h 10.10,10.11”时,其中的字段“-h 10.10,10.11”为指示任务处理对象的参数,在该参数中包含了各个任务处理对象的标识信息,因此,该命令行中的任务处理对象为标识号为10.10和10.11的两台服务器。Among them, the task processing object included in the task request can be obtained directly through a specific field in the command line. For example, when the command line form of the task request is "[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create -h 10.10,10.11", the field "-h 10.10 ,10.11" is a parameter indicating the task processing object, and the parameter contains the identification information of each task processing object. Therefore, the task processing object in the command line is the two servers with identification numbers 10.10 and 10.11.

当命令行形式的任务请求为“[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create-f data.json”时,其中的字段“-f data.json”为指示任务处理对象的参数,在该参数中包含了存储有全部任务处理对象的标识信息的数据文件data.json的文件名,因此,该命令行中的任务处理对象为data.json这一数据文件中记录的全部服务器。在实际情况中,要添加的服务器常常来源于同一个系统,这时,直接将该系统中的服务器列表复制到数据文件中即可,由此能够简化命令行、提高输入效率。When the command-line task request is "[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create -f data.json", the field "-f data.json" ” is a parameter indicating the task processing object, and this parameter contains the file name of the data file data.json that stores the identification information of all the task processing objects. Therefore, the task processing object in the command line is data.json. All servers recorded in the data file. In actual situations, the servers to be added often come from the same system. In this case, the server list in the system can be directly copied to the data file, which can simplify the command line and improve the input efficiency.

另外,为了进一步简化命令行,当任务请求中用于指示任务处理对象的参数为缺省状态时,则默认从指定文件路径下读取数据文件,并将其中记录的服务器作为任务处理对象。例如,可以预先在与该装置相同的安装路径“[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/”下设置数据文件data.json,这时,当命令行中省略“-fdata.json”这一字段时,则默认从上述路径下读取data.json中的数据作为任务处理对象。In addition, in order to further simplify the command line, when the parameter used to indicate the task processing object in the task request is in the default state, the data file is read from the specified file path by default, and the server recorded therein is used as the task processing object. For example, the data file data.json can be set in advance in the same installation path as the device "[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/", in this case, when the command line omits " -fdata.json" field, the data in data.json is read from the above path as the task processing object by default.

步骤S230:分析任务处理对象的个数,将其划分为多个子任务组。Step S230: Analyze the number of task processing objects, and divide them into multiple sub-task groups.

例如,在数据文件data.json中记录了如下数据:For example, the following data is recorded in the data file data.json:

“gwd01v.add.zwt.qihoo.net”,"gwd01v.add.zwt.qihoo.net",

“gwd02v.add.zwt.qihoo.net”,"gwd02v.add.zwt.qihoo.net",

“gwd03v.add.zwt.qihoo.net”,"gwd03v.add.zwt.qihoo.net",

“gwd04v.add.zwt.qihoo.net”,"gwd04v.add.zwt.qihoo.net",

“gwd05v.add.zwt.qihoo.net”,"gwd05v.add.zwt.qihoo.net",

“gwd06v.add.zwt.qihoo.net”,"gwd06v.add.zwt.qihoo.net",

“gwd07v.add.zwt.qihoo.net”,"gwd07v.add.zwt.qihoo.net",

“gwd08v.add.zwt.qihoo.net”,"gwd08v.add.zwt.qihoo.net",

“gwd09v.add.zwt.qihoo.net”,"gwd09v.add.zwt.qihoo.net",

“gwd10v.add.zwt.qihoo.net”,"gwd10v.add.zwt.qihoo.net",

……...

依次读取上述各条数据,并将总数据的条数记录为任务处理对象的个数。在读取过程中,还可以进一步检查数据参数的格式是否正确,例如,检查每条数据的字段数是否符合预定格式,由此能够筛查出明显的字段错误,从而避免在后续的处理过程中报错。Read the above pieces of data in sequence, and record the total number of pieces of data as the number of task processing objects. During the reading process, it is also possible to further check whether the format of the data parameters is correct, for example, to check whether the number of fields of each piece of data conforms to the predetermined format, so that obvious field errors can be screened out, so as to avoid the subsequent processing. report an error.

根据任务处理对象的个数,并结合其他的参考指标来确定子任务组的个数。其中,其他的参考指标可以是内存大小、CPU内核数、以及API接收速度等。在本实施例中,假设任务处理对象为1000,CPU内核数为8,设定的子任务组个数为100,则每个子任务组中的任务处理对象为10。The number of sub-task groups is determined according to the number of task processing objects and in combination with other reference indicators. Among them, other reference indicators can be memory size, number of CPU cores, and API receiving speed. In this embodiment, assuming that the number of task processing objects is 1000, the number of CPU cores is 8, and the set number of subtask groups is 100, the number of task processing objects in each subtask group is 10.

步骤S240:根据预设的任务处理模板,调用zabbix软件处理上述任务请求中包含的批量添加服务器的任务。其中,各个子任务组中的任务通过对应的子进程并行处理。Step S240: According to the preset task processing template, call the zabbix software to process the task of adding servers in batches included in the above task request. The tasks in each sub-task group are processed in parallel by corresponding sub-processes.

其中,任务处理模板可通过预先定义的函数来实现。例如,在“host create”函数中预先定义了批量添加服务器的处理流程。在该处理流程中,会与zabbix软件建立通信连接,并根据子任务组的个数派生出相应数量的子进程,由各个子进程并行地处理对应的任务。每个子进程在处理过程中,需要调用zabbix软件提供的应用程序接口API函数来实现对应的任务处理。例如,在本实施例中,每添加一台服务器时,都需要调用zabbix软件提供的用于添加服务器的API函数host.creat来实现。另外,每个子进程还会将处理结果返回给主进程。Among them, the task processing template can be implemented by a predefined function. For example, the process of adding servers in batches is predefined in the "host create" function. In this processing flow, a communication connection is established with the zabbix software, and a corresponding number of sub-processes are derived according to the number of sub-task groups, and the corresponding tasks are processed by each sub-process in parallel. In the processing process of each sub-process, it needs to call the application program interface API function provided by the zabbix software to realize the corresponding task processing. For example, in this embodiment, each time a server is added, the API function host.creat provided by the zabbix software for adding a server needs to be called to achieve this. In addition, each child process will return the processing result to the main process.

其中,由于派生了100个子进程,每个子进程只处理10台服务器,因此,仅需十几秒钟就能够完成1000台服务器的添加工作,显著降低了操作时间。Among them, because 100 subprocesses are derived, each subprocess only handles 10 servers, so the addition of 1000 servers can be completed in only ten seconds, which significantly reduces the operation time.

另外,可选地,本发明实施例中的方法还可以进一步包括步骤S250。在步骤S250中,如果在预设时间内接收到zabbix软件返回的任务处理状态,则显示该任务处理状态;如果在预设时间内未接收到zabbix软件返回的任务处理状态,则重新调用zabbix软件处理任务请求中包含的任务。In addition, optionally, the method in this embodiment of the present invention may further include step S250. In step S250, if the task processing status returned by the zabbix software is received within the preset time, the task processing status is displayed; if the task processing status returned by the zabbix software is not received within the preset time, the zabbix software is called again. Process the tasks contained in the task request.

具体地,假设在预设时间内收到zabbix软件返回的任务处理状态为“1000台服务器全部添加成功”,则向用户显示该状态;或者,zabbix软件返回的任务处理状态也可以为“999台服务器添加成功,1台服务器添加失败”,这时,针对添加失败的服务器,用户可以通过zabbix软件提供的点击鼠标的方式进行添加。Specifically, if the task processing status returned by the zabbix software is "successfully added for all 1000 servers" within the preset time, the status will be displayed to the user; or, the task processing status returned by the zabbix software can also be "999 servers". The server is successfully added, but one server fails to be added." At this time, for the server that fails to be added, the user can add it by clicking the mouse provided by the zabbix software.

假设在预设时间内未收到zabbix软件返回的任务处理状态,则重新调用zabbix软件处理任务请求中包含的任务,以防止由于网络故障或网络包丢失等原因所导致的zabbix软件没有收到任务的情况发生。也就是说,本发明中的方法在超时情况下会进行重试,当重试次数达到设定次数(如3次)后,则不再重试,直接提示错误信息。另外,除了超时重试的机制之外,本发明中的方法还可以将一批任务当中未成功的部分任务进行重试,以便尽可能减少失败任务数。Assuming that the task processing status returned by the zabbix software is not received within the preset time, the zabbix software will be called again to process the tasks contained in the task request to prevent the zabbix software from not receiving the task due to network failure or network packet loss. situation occurs. That is to say, the method of the present invention will retry in the case of timeout. When the number of retries reaches the set number of times (eg, 3 times), the method will not retry and directly prompt an error message. In addition, in addition to the timeout retry mechanism, the method of the present invention can also retry some unsuccessful tasks in a batch of tasks, so as to reduce the number of failed tasks as much as possible.

在上述实施例中,任务类型为批量添加监控对象,在本发明其他的实施例中,任务类型还可以是删除监控对象、修改监控对象所对应的监控模板、以及为监控对象设置分组等。具体处理方式与上述实施例类似。例如,删除监控对象时,可以在命令行中通过hostdelete实现,在host delete函数中调用zabbix软件提供的host.delete接口函数来实现删除监控对象的操作。修改监控对象所对应的监控模板时,可以在命令行中通过templates实现,在templates函数中调用zabbix软件提供的template.create、template.delete和/或template.update接口函数来实现创建监控模板、删除监控模板和/或更新监控模板的操作。为监控对象设置分组时,可以在命令行中通过host group实现,在host group函数中能够调用zabbix软件提供的hostgroup.create接口函数来实现创建分组的操作。In the above embodiment, the task type is adding monitoring objects in batches. In other embodiments of the present invention, the task type may also be deleting monitoring objects, modifying monitoring templates corresponding to monitoring objects, and setting groups for monitoring objects. The specific processing method is similar to the above-mentioned embodiment. For example, when deleting a monitoring object, it can be implemented through hostdelete on the command line, and the host.delete interface function provided by the zabbix software can be called in the host delete function to realize the operation of deleting the monitoring object. When modifying the monitoring template corresponding to the monitoring object, it can be implemented through templates on the command line, and the template.create, template.delete and/or template.update interface functions provided by the zabbix software can be called in the templates function to create monitoring templates and delete them. Actions to monitor templates and/or update monitor templates. When setting a group for a monitoring object, it can be implemented through the host group on the command line. In the host group function, the hostgroup.create interface function provided by the zabbix software can be called to realize the operation of creating a group.

其中,上述的几种任务类型可以分别由不同的任务请求来实现,也可以将多种任务类型包含在同一个任务请求中。例如,当一个任务请求为“[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create-f data.json,hostgroup:[MySQL]”时,该任务请求中同时包含两种任务类型:一种任务类型为批量添加服务器(对应于host create函数),另一种任务类型为设置分组(对应于hostgroup函数)。前一种任务为批量任务,需由多个子进程并行处理;后一种任务为非批量任务,可由单一进程处理。通过上述命令行,能够将数据文件data.json中包含的服务器全部添加到监控列表里,并将这些服务器加入“MySQL”分组中。另外,当一个任务请求为[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create-f data.json,templates:[“addops-diskio”,“addops-linux”,“addops-ping”]时,该任务请求中同时包含批量添加服务器和设置监控模板这两种任务。通过上述命令行,能够将数据文件data.json中包含的服务器全部添加到监控列表里,并使这些服务器使用“diskio”,“linux”,“ping”这三个监控模板。其中,在每个监控模板中能够设定不同的监控项,例如监控内存、CPU或某一软件等。Among them, the above several task types may be implemented by different task requests respectively, or multiple task types may be included in the same task request. For example, when a task request is "[root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create-f data.json,hostgroup:[MySQL]", in the task request It also contains two types of tasks: one is adding servers in batches (corresponding to the host create function), and the other is setting groups (corresponding to the hostgroup function). The former task is a batch task and needs to be processed by multiple sub-processes in parallel; the latter task is a non-batch task and can be processed by a single process. Through the above command line, all the servers contained in the data file data.json can be added to the monitoring list, and these servers can be added to the "MySQL" group. Also, when a task request is [root@zabbix02v/usr/local/zbxtool]#/usr/local/zbxtool/zbxtool.py host create -f data.json,templates:["addops-diskio","addops-linux ”, “addops-ping”], the task request includes the tasks of adding servers in batches and setting monitoring templates. Through the above command line, you can add all the servers contained in the data file data.json to the monitoring list, and make these servers use the three monitoring templates of "diskio", "linux", and "ping". Among them, different monitoring items can be set in each monitoring template, such as monitoring memory, CPU, or a certain software.

由此可见,通过本发明实施例提供的批量处理监控任务的方法,能够用自动运行的脚本程序来代替zabbix等监控软件中通过点击鼠标来执行的操作,因而简化了操作方式,并通过并行处理的方式提高了效率,且避免了人工操作时的疏忽性错误。除了提高效率之外,本发明实施例中的方法还能够实现自动化的需求,比如,当某一个系统需要将其中的服务器添加到监控软件的监控列表里,或者需要修改某一监控模板时,该系统无法实现点击鼠标等人工操作,从而无法完成与监控软件之间的交互,而采用本发明提供的方法则可以很好地解决上述问题。该系统只需运行一段命令行就可以自动地实现添加/删除服务器、修改监控模板或创建分组等操作,从而满足了自动化的需求。It can be seen from this that the method for batch processing monitoring tasks provided by the embodiment of the present invention can replace the operation performed by clicking the mouse in monitoring software such as zabbix with an automatically running script program, thus simplifying the operation mode, and through parallel processing The method improves efficiency and avoids inadvertent errors during manual operation. In addition to improving efficiency, the method in this embodiment of the present invention can also achieve automation requirements. For example, when a certain system needs to add a server in it to the monitoring list of monitoring software, or needs to modify a certain monitoring template, the The system cannot realize manual operations such as clicking the mouse, so that the interaction with the monitoring software cannot be completed, but the above problems can be well solved by using the method provided by the present invention. The system can automatically add/delete servers, modify monitoring templates or create groups by simply running a command line, thus meeting the needs of automation.

图3示出了本发明实施例提供的批量处理监控任务的装置300的结构图。如图3所示,该装置300包括:FIG. 3 shows a structural diagram of an apparatus 300 for batch processing monitoring tasks provided by an embodiment of the present invention. As shown in FIG. 3, the apparatus 300 includes:

接收模块31,适于接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;以及,The receiving module 31 is adapted to receive a task request including at least one batch task, and divide the batch task into a plurality of sub-task groups; and,

处理模块32,适于根据预设的任务处理模板,调用监控软件处理任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理。The processing module 32 is adapted to call the monitoring software to process the tasks included in the task request according to a preset task processing template, wherein the tasks in each sub-task group are processed in parallel by corresponding sub-processes.

其中,任务请求通过命令行形式实现,并且,任务请求中包含用于指示任务类型以及任务处理对象的参数信息。其中,用于指示任务处理对象的参数信息为各个任务处理对象的标识信息;或者,用于指示任务处理对象的参数信息为存储有全部任务处理对象的标识信息的数据文件的文件信息。The task request is implemented in the form of a command line, and the task request includes parameter information for indicating the task type and the task processing object. The parameter information used to indicate the task processing objects is the identification information of each task processing object; or the parameter information used to indicate the task processing objects is the file information of the data file storing the identification information of all the task processing objects.

可选地,子任务组的个数根据任务处理对象的数量以及CPU内核数来确定。并且,任务请求中包含以下任务类型中的一种或多种:添加监控对象、删除监控对象、修改监控对象所对应的监控模板、以及为监控对象设置分组。并且,任务处理模板中设定了各个任务类型所对应的任务处理流程。Optionally, the number of subtask groups is determined according to the number of task processing objects and the number of CPU cores. Moreover, the task request includes one or more of the following task types: adding a monitoring object, deleting a monitoring object, modifying a monitoring template corresponding to the monitoring object, and setting a group for the monitoring object. Furthermore, the task processing flow corresponding to each task type is set in the task processing template.

可选地,监控软件为zabbix软件,处理模块通过该zabbix软件提供的应用程序接口API函数来调用该zabbix软件。Optionally, the monitoring software is zabbix software, and the processing module calls the zabbix software through an application program interface API function provided by the zabbix software.

可选地,处理模块32进一步包括:Optionally, the processing module 32 further includes:

显示子模块,适于在预设时间内接收到监控软件返回的任务处理状态时,显示该任务处理状态;以及,a display sub-module, adapted to display the task processing status when receiving the task processing status returned by the monitoring software within a preset time; and,

重试子模块,适于在预设时间内未接收到监控软件返回的任务处理状态时,重新调用监控软件处理任务请求中包含的任务。The retry submodule is suitable for re-calling the monitoring software to process the tasks included in the task request when the task processing status returned by the monitoring software is not received within the preset time.

上述各个模块的具体实现细节可参照方法实施例中相应步骤的描述,此处不再赘述。For the specific implementation details of the above-mentioned modules, reference may be made to the descriptions of the corresponding steps in the method embodiments, which will not be repeated here.

在本发明提供的批量处理监控任务的方法及装置中,能够直接接收包含批量任务的任务请求,并将其中的批量任务划分为多个子任务组;然后,根据预设的任务处理模板,调用监控软件来处理该任务请求中包含的任务,每个子任务组中的任务通过对应的子进程并行处理。由此可见,本发明中的方法及装置能够处理包含批量任务的任务请求,并将其中的任务划分为多个并行处理的子任务组,从而显著提高了任务处理效率,降低了人工操作的繁琐性、进而杜绝了在繁琐操作中可能出现的疏忽性错误。In the method and device for batch processing monitoring tasks provided by the present invention, a task request including batch tasks can be directly received, and the batch tasks are divided into multiple sub-task groups; then, according to a preset task processing template, the monitoring task is invoked The software processes the tasks included in the task request, and the tasks in each sub-task group are processed in parallel through the corresponding sub-processes. It can be seen that the method and device of the present invention can process task requests including batch tasks, and divide the tasks into multiple sub-task groups for parallel processing, thereby significantly improving the task processing efficiency and reducing the tedious manual operation. Therefore, inadvertent errors that may occur in tedious operations are eliminated.

在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with teaching based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not directed to any particular programming language. It is to be understood that various programming languages may be used to implement the inventions described herein, and that the descriptions of specific languages above are intended to disclose the best mode for carrying out the invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. It will be understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it is to be understood that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or its description. This disclosure, however, should not be construed as reflecting an intention that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. The modules or units or components in the embodiments may be combined into one module or unit or component, and further they may be divided into multiple sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method so disclosed may be employed in any combination, unless at least some of such features and/or procedures or elements are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will appreciate that although some of the embodiments described herein include certain features, but not others, included in other embodiments, that combinations of features of different embodiments are intended to be within the scope of the invention within and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the apparatus according to the embodiments of the present invention. The present invention can also be implemented as apparatus or apparatus programs (eg, computer programs and computer program products) for performing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-described embodiments illustrate rather than limit the invention, and that alternative embodiments may be devised by those skilled in the art without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.

本发明公开了:The present invention discloses:

A1、一种批量处理监控任务的方法,包括:A1. A method for batch processing monitoring tasks, comprising:

接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;Receive a task request containing at least one type of batch task, and divide the batch task into multiple sub-task groups;

根据预设的任务处理模板,调用监控软件处理所述任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理。According to a preset task processing template, the monitoring software is called to process the tasks included in the task request, wherein the tasks in each sub-task group are processed in parallel by corresponding sub-processes.

A2、根据A1所述的方法,其中,所述任务请求通过命令行形式实现,并且,所述任务请求中包含用于指示任务类型以及任务处理对象的参数信息。A2. The method according to A1, wherein the task request is implemented in the form of a command line, and the task request includes parameter information for indicating a task type and a task processing object.

A3、根据A1或A2所述的方法,其中,用于指示任务处理对象的参数信息为各个任务处理对象的标识信息;或者,用于指示任务处理对象的参数信息为存储有全部任务处理对象的标识信息的数据文件的文件信息。A3. The method according to A1 or A2, wherein the parameter information used to indicate the task processing objects is the identification information of each task processing object; The file information of the data file that identifies the information.

A4、根据A3所述的方法,其中,所述子任务组的个数根据所述任务处理对象的数量以及CPU内核数来确定。A4. The method according to A3, wherein the number of the subtask groups is determined according to the number of the task processing objects and the number of CPU cores.

A5、根据A1-A4任一项所述的方法,其中,所述任务请求中包含以下任务类型中的一种或多种:A5. The method according to any one of A1-A4, wherein the task request includes one or more of the following task types:

添加监控对象、删除监控对象、修改监控对象所对应的监控模板、以及为监控对象设置分组。Add monitoring objects, delete monitoring objects, modify monitoring templates corresponding to monitoring objects, and set groups for monitoring objects.

A6、根据A1-A5任一项所述的方法,其中,所述任务处理模板中设定了各个任务类型所对应的任务处理流程。A6. The method according to any one of A1-A5, wherein a task processing flow corresponding to each task type is set in the task processing template.

A7、根据A1-A6任一项所述的方法,其中,所述监控软件为zabbix软件,通过该zabbix软件提供的应用程序接口API函数来调用该zabbix软件。A7. The method according to any one of A1-A6, wherein the monitoring software is zabbix software, and the zabbix software is called through an application program interface API function provided by the zabbix software.

A8、根据A1-A7任一项所述的方法,其中,所述调用监控软件处理所述任务请求中包含的任务的步骤之后进一步包括:A8. The method according to any one of A1-A7, wherein after the step of invoking the monitoring software to process the task included in the task request, it further includes:

如果在预设时间内接收到所述监控软件返回的任务处理状态,则显示所述任务处理状态;If the task processing status returned by the monitoring software is received within a preset time, the task processing status is displayed;

如果在预设时间内未接收到所述监控软件返回的任务处理状态,则重新调用所述监控软件处理所述任务请求中包含的任务。If the task processing status returned by the monitoring software is not received within a preset time, the monitoring software is called again to process the tasks included in the task request.

本发明还公开了:The present invention also discloses:

B9、一种批量处理监控任务的装置,包括:B9. A device for batch processing monitoring tasks, comprising:

接收模块,适于接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;a receiving module, adapted to receive a task request including at least one batch task, and divide the batch task into a plurality of sub-task groups;

处理模块,适于根据预设的任务处理模板,调用监控软件处理所述任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理。The processing module is adapted to call monitoring software to process the tasks included in the task request according to a preset task processing template, wherein the tasks in each sub-task group are processed in parallel by corresponding sub-processes.

B10、根据B9所述的装置,其中,所述任务请求通过命令行形式实现,并且,所述任务请求中包含用于指示任务类型以及任务处理对象的参数信息。B10. The apparatus according to B9, wherein the task request is implemented in the form of a command line, and the task request includes parameter information for indicating the task type and the task processing object.

B11、根据B10所述的装置,其中,用于指示任务处理对象的参数信息为各个任务处理对象的标识信息;或者,用于指示任务处理对象的参数信息为存储有全部任务处理对象的标识信息的数据文件的文件信息。B11. The device according to B10, wherein the parameter information used to indicate the task processing objects is the identification information of each task processing object; or, the parameter information used to indicate the task processing objects is the identification information that stores all the task processing objects The file information of the data file.

B12、根据B11所述的装置,其中,所述子任务组的个数根据所述任务处理对象的数量以及CPU内核数来确定。B12. The apparatus according to B11, wherein the number of the subtask groups is determined according to the number of the task processing objects and the number of CPU cores.

B13、根据B9-B12任一项所述的装置,其中,所述任务请求中包含以下任务类型中的一种或多种:添加监控对象、删除监控对象、修改监控对象所对应的监控模板、以及为监控对象设置分组。B13. The device according to any one of B9-B12, wherein the task request includes one or more of the following task types: adding a monitoring object, deleting a monitoring object, modifying a monitoring template corresponding to a monitoring object, And set grouping for monitoring objects.

B14、根据B9-B13任一项所述的装置,其中,所述任务处理模板中设定了各个任务类型所对应的任务处理流程。B14. The apparatus according to any one of B9-B13, wherein a task processing flow corresponding to each task type is set in the task processing template.

B15、根据B9-B14任一项所述的装置,其中,所述监控软件为zabbix软件,所述处理模块通过该zabbix软件提供的应用程序接口API函数来调用该zabbix软件。B15. The device according to any one of B9-B14, wherein the monitoring software is zabbix software, and the processing module calls the zabbix software through an application program interface API function provided by the zabbix software.

B16、根据B9-B15任一项所述的装置,其中,所述处理模块进一步包括:B16. The device according to any one of B9-B15, wherein the processing module further comprises:

显示子模块,适于在预设时间内接收到所述监控软件返回的任务处理状态时,显示所述任务处理状态;a display submodule, adapted to display the task processing status when receiving the task processing status returned by the monitoring software within a preset time;

重试子模块,适于在预设时间内未接收到所述监控软件返回的任务处理状态时,重新调用所述监控软件处理所述任务请求中包含的任务。The retry submodule is adapted to re-call the monitoring software to process the tasks included in the task request when the task processing status returned by the monitoring software is not received within a preset time.

Claims (12)

1.一种批量处理监控任务的方法,包括:1. A method for batch processing monitoring tasks, comprising: 接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;其中,所述子任务组的个数根据任务处理对象的数量以及CPU内核数来确定;Receive a task request containing at least one batch of tasks, and divide the batch tasks into multiple sub-task groups; wherein, the number of the sub-task groups is determined according to the number of task processing objects and the number of CPU cores; 根据预设的任务处理模板,调用监控软件处理所述任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理;According to the preset task processing template, the monitoring software is called to process the tasks included in the task request, wherein the tasks in each sub-task group are processed in parallel by the corresponding sub-processes; 其中,所述任务请求通过命令行形式实现,并且,所述任务请求中包含用于指示任务类型以及任务处理对象的参数信息,且用于指示任务处理对象的参数信息包括存储有全部任务处理对象的标识信息的数据文件的文件信息。The task request is implemented in the form of a command line, and the task request includes parameter information used to indicate the task type and the task processing object, and the parameter information used to indicate the task processing object includes all the task processing objects stored The file information of the data file for the identification information. 2.根据权利要求1所述的方法,其中,用于指示任务处理对象的参数信息包括各个任务处理对象的标识信息。2. The method according to claim 1, wherein the parameter information for indicating the task processing objects includes identification information of each task processing object. 3.根据权利要求1-2任一项所述的方法,其中,所述任务请求中包含以下任务类型中的一种或多种:3. The method according to any one of claims 1-2, wherein the task request includes one or more of the following task types: 添加监控对象、删除监控对象、修改监控对象所对应的监控模板、以及为监控对象设置分组。Add monitoring objects, delete monitoring objects, modify monitoring templates corresponding to monitoring objects, and set groups for monitoring objects. 4.根据权利要求1-2任一项所述的方法,其中,所述任务处理模板中设定了各个任务类型所对应的任务处理流程。4. The method according to any one of claims 1-2, wherein a task processing flow corresponding to each task type is set in the task processing template. 5.根据权利要求1-2任一项所述的方法,其中,所述监控软件为zabbix软件,通过该zabbix软件提供的应用程序接口API函数来调用该zabbix软件。5. The method according to any one of claims 1-2, wherein the monitoring software is zabbix software, and the zabbix software is called through an application program interface API function provided by the zabbix software. 6.根据权利要求1-2任一项所述的方法,其中,所述调用监控软件处理所述任务请求中包含的任务的步骤之后进一步包括:6. The method according to any one of claims 1-2, wherein after the step of invoking the monitoring software to process the tasks included in the task request, it further comprises: 如果在预设时间内接收到所述监控软件返回的任务处理状态,则显示所述任务处理状态;If the task processing status returned by the monitoring software is received within a preset time, the task processing status is displayed; 如果在预设时间内未接收到所述监控软件返回的任务处理状态,则重新调用所述监控软件处理所述任务请求中包含的任务。If the task processing status returned by the monitoring software is not received within a preset time, the monitoring software is called again to process the tasks included in the task request. 7.一种批量处理监控任务的装置,包括:7. A device for batch processing monitoring tasks, comprising: 接收模块,适于接收至少包含一种批量任务的任务请求,将其中的批量任务划分为多个子任务组;其中,所述子任务组的个数根据任务处理对象的数量以及CPU内核数来确定;A receiving module, adapted to receive a task request including at least one batch task, and divide the batch task into a plurality of subtask groups; wherein, the number of the subtask groups is determined according to the number of task processing objects and the number of CPU cores ; 处理模块,适于根据预设的任务处理模板,调用监控软件处理所述任务请求中包含的任务,其中,各个子任务组中的任务通过对应的子进程并行处理;a processing module, adapted to call monitoring software to process the tasks included in the task request according to a preset task processing template, wherein the tasks in each sub-task group are processed in parallel by corresponding sub-processes; 其中,所述任务请求通过命令行形式实现,并且,所述任务请求中包含用于指示任务类型以及任务处理对象的参数信息,且用于指示任务处理对象的参数信息包括存储有全部任务处理对象的标识信息的数据文件的文件信息。The task request is implemented in the form of a command line, and the task request includes parameter information used to indicate the task type and the task processing object, and the parameter information used to indicate the task processing object includes all the task processing objects stored The file information of the data file for the identification information. 8.根据权利要求7所述的装置,其中,用于指示任务处理对象的参数信息包括各个任务处理对象的标识信息。8. The apparatus according to claim 7, wherein the parameter information for indicating the task processing objects includes identification information of each task processing object. 9.根据权利要求7-8任一项所述的装置,其中,所述任务请求中包含以下任务类型中的一种或多种:添加监控对象、删除监控对象、修改监控对象所对应的监控模板、以及为监控对象设置分组。9. The device according to any one of claims 7-8, wherein the task request includes one or more of the following task types: adding a monitoring object, deleting a monitoring object, and modifying the monitoring corresponding to the monitoring object templates, and set up groups for monitoring objects. 10.根据权利要求7-8任一项所述的装置,其中,所述任务处理模板中设定了各个任务类型所对应的任务处理流程。10. The apparatus according to any one of claims 7-8, wherein a task processing flow corresponding to each task type is set in the task processing template. 11.根据权利要求7-8任一项所述的装置,其中,所述监控软件为zabbix软件,所述处理模块通过该zabbix软件提供的应用程序接口API函数来调用该zabbix软件。11. The device according to any one of claims 7-8, wherein the monitoring software is zabbix software, and the processing module calls the zabbix software through an application program interface API function provided by the zabbix software. 12.根据权利要求7-8任一项所述的装置,其中,所述处理模块进一步包括:12. The apparatus of any one of claims 7-8, wherein the processing module further comprises: 显示子模块,适于在预设时间内接收到所述监控软件返回的任务处理状态时,显示所述任务处理状态;A display submodule, adapted to display the task processing status when receiving the task processing status returned by the monitoring software within a preset time; 重试子模块,适于在预设时间内未接收到所述监控软件返回的任务处理状态时,重新调用所述监控软件处理所述任务请求中包含的任务。The retry submodule is adapted to re-call the monitoring software to process the task included in the task request when the task processing status returned by the monitoring software is not received within a preset time.
CN201510370053.7A 2015-06-29 2015-06-29 method and device for processing monitoring tasks in batches Active CN104991821B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510370053.7A CN104991821B (en) 2015-06-29 2015-06-29 method and device for processing monitoring tasks in batches

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510370053.7A CN104991821B (en) 2015-06-29 2015-06-29 method and device for processing monitoring tasks in batches

Publications (2)

Publication Number Publication Date
CN104991821A CN104991821A (en) 2015-10-21
CN104991821B true CN104991821B (en) 2019-12-06

Family

ID=54303637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510370053.7A Active CN104991821B (en) 2015-06-29 2015-06-29 method and device for processing monitoring tasks in batches

Country Status (1)

Country Link
CN (1) CN104991821B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106919451B (en) * 2015-12-24 2020-04-21 北京趣拿科技软件有限公司 Data processing method and device
CN106020959A (en) * 2016-05-24 2016-10-12 郑州悉知信息科技股份有限公司 Data migration method and device
CN106371974B (en) * 2016-08-30 2018-11-09 中国民生银行股份有限公司 The monitoring method and distribution platform of application program in Docker containers
CN106789170B (en) * 2016-11-28 2021-04-23 北京奇虎科技有限公司 A task processing method and device
CN106790204A (en) * 2017-01-03 2017-05-31 北京奇虎科技有限公司 The conversion method and device of a kind of tunneling of flow data
CN107832135A (en) * 2017-11-27 2018-03-23 福建细活信息科技有限公司 A kind of method for allocating tasks and terminal
CN109062504A (en) * 2018-07-13 2018-12-21 郑州云海信息技术有限公司 Storage system dispositions method and device under a kind of virtual platform
CN112732417B (en) * 2019-10-28 2024-09-20 北京京东振世信息技术有限公司 Method and device for processing application request
CN113064661B (en) * 2019-12-31 2025-03-07 深圳云天励飞技术有限公司 Batch task memory processing method, device, electronic device and storage medium
CN111880918B (en) * 2020-07-28 2021-05-18 南京市城市与交通规划设计研究院股份有限公司 Road network front end rendering method and device and electronic equipment
CN115514624B (en) * 2022-09-21 2024-04-30 中国农业银行股份有限公司 Monitoring method, monitoring device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101038559A (en) * 2006-09-11 2007-09-19 中国工商银行股份有限公司 Batch task scheduling engine and dispatching method
CN102012840A (en) * 2010-12-23 2011-04-13 中国农业银行股份有限公司 Batch data scheduling method and system
CN102707993A (en) * 2012-04-11 2012-10-03 招商银行股份有限公司 System and method for centralized processing of service
WO2014068950A1 (en) * 2012-10-31 2014-05-08 日本電気株式会社 Data processing system, data processing method, and program
CN104579840A (en) * 2015-01-08 2015-04-29 浪潮软件集团有限公司 ZABBIX-based network monitoring system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101038559A (en) * 2006-09-11 2007-09-19 中国工商银行股份有限公司 Batch task scheduling engine and dispatching method
CN102012840A (en) * 2010-12-23 2011-04-13 中国农业银行股份有限公司 Batch data scheduling method and system
CN102707993A (en) * 2012-04-11 2012-10-03 招商银行股份有限公司 System and method for centralized processing of service
WO2014068950A1 (en) * 2012-10-31 2014-05-08 日本電気株式会社 Data processing system, data processing method, and program
CN104579840A (en) * 2015-01-08 2015-04-29 浪潮软件集团有限公司 ZABBIX-based network monitoring system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
zabbix api批量添加主机;pincer;《http://blog.51cto.com/pincer/1617364》;20150304;全文 *

Also Published As

Publication number Publication date
CN104991821A (en) 2015-10-21

Similar Documents

Publication Publication Date Title
CN104991821B (en) method and device for processing monitoring tasks in batches
CN108153670B (en) Interface testing method and device and electronic equipment
CN107302475A (en) The method of testing and device of a kind of Based on Distributed storage cluster
CN108804215B (en) Task processing method and device and electronic equipment
JP7693684B2 (en) Techniques for utilizing directed acyclic graphs for deployment instructions
CN109656782A (en) Visual scheduling monitoring method, device and server
CN111290936A (en) Interface testing method and device
CN110659198A (en) Application program test case execution method and device and software test system
CN110888816B (en) Program testing method, program testing device and storage medium
WO2019075845A1 (en) Construction method and device for link call relationship, computer device and storage medium
CN115437933A (en) Automatic testing method and device, computer equipment and storage medium
CN105915657A (en) Data synchronization method and device, and client
CN114218072A (en) Test script generation method and device, storage medium and computer equipment
US11108638B1 (en) Health monitoring of automatically deployed and managed network pipelines
CN112183982A (en) Workflow creating method and device, computer equipment and storage medium
CN114579194A (en) Spring remote call-based exception handling method and system
CN111294250A (en) Stress testing method, apparatus and system
CN118733149A (en) Data interaction method, device, electronic device and storage medium
CN118779232A (en) Test case execution method, device and server
CN107608884A (en) A kind of test device and equipment of distributed memory system core client
US20150378809A1 (en) Methods for implementing error detection and recovery and devices thereof
CN113112217B (en) Business process configuration method, device, electronic equipment and computer readable medium
CN113867778B (en) Image file generation method and device, electronic equipment and storage medium
CN103460231B (en) Test integrated business system
CN114675819A (en) RPA component recommendation method, device, equipment and readable storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220802

Address after: 300450 No. 9-3-401, No. 39, Gaoxin 6th Road, Binhai Science Park, Binhai New Area, Tianjin

Patentee after: 3600 Technology Group Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230627

Address after: 1765, floor 17, floor 15, building 3, No. 10 Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: Beijing Hongxiang Technical Service Co.,Ltd.

Address before: 300450 No. 9-3-401, No. 39, Gaoxin 6th Road, Binhai Science Park, Binhai New Area, Tianjin

Patentee before: 3600 Technology Group Co.,Ltd.

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 1765, floor 17, floor 15, building 3, No. 10 Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: Beijing 360 Zhiling Technology Co.,Ltd.

Country or region after: China

Address before: 1765, floor 17, floor 15, building 3, No. 10 Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee before: Beijing Hongxiang Technical Service Co.,Ltd.

Country or region before: China