Disclosure of Invention
In view of the above, the application provides a distributed resource monitoring method and system, which solve the problems in the prior art, realize the effective monitoring of airborne resources, and ensure that the scheduled airborne resources are in an available state when the tasks of an upper layer decision module are distributed and deployed while meeting the real-time performance and the safety of an airborne embedded environment.
In one aspect, the distributed resource monitoring method provided by the application adopts the following technical scheme:
a distributed resource monitoring method, the method being applied to a distributed system, the resource monitoring method comprising:
establishing a software environment, and deploying middleware on each node, wherein all the middleware covers a monitoring center and each node, a global data space is formed between the monitoring center and each node, each node transmits data to the global data space through the middleware, and the monitoring center subscribes monitoring data needed in the global data space through the middleware;
The resource monitor node registers the related information of the node into a database of the monitoring center by calling a theme binding interface of the monitoring center, so as to realize the one-to-one mapping relation between the theme and the monitoring node;
After the monitoring center theme binding interface is called by the monitoring node, subscribing the monitoring data of the node according to the theme Topic provided by the monitoring node, setting the pulling rate of the monitoring data by a user, and acquiring the monitoring data of the corresponding node from the global data space.
Optionally, the specific steps of each node include:
Step 1, each computing node and terminal node in the cluster call a theme binding interface of a monitoring center to register the node, wherein parameters contained in interface call comprise node names, node IP addresses, node MAC physical addresses, monitoring data themes Topic and monitoring periods;
Step 2, after the node receives the successful binding mark, starting multithreading to perform concurrent monitoring on various resources of the node;
step 3, the node stores the monitoring data in a local storage medium;
step 4, the node packages the collected monitoring data into a JSON data format;
and 5, the node issues the packaged monitoring data to the global data space through the DDS middleware according to the monitoring data subject Topic bound in the step 1, and the step 2 is executed.
Optionally, the specific steps of the monitoring center include:
step 1, a monitoring center starts a theme binding interface service;
step 2, the monitoring center receives the Topic binding request of the node and analyzes the request, subscribes to the Topic of the node monitoring data according to the Topic field, starts a monitoring thread for acquiring the monitoring data, and returns a binding success mark;
And step 3, obtaining the monitoring data of the corresponding node from the global data space according to the node monitoring data pulling rate set by the user.
Optionally, the MAC physical address of the Topic or splice node is generated by a string random method.
Optionally, the monitoring item of the monitored node and the processing mode of the monitored data include:
for a computing node, monitoring items comprise node CPU occupancy rate, memory occupancy rate, disk occupancy rate, network bandwidth occupancy rate, node survival state, node working state, task running state and monitoring time stamp;
For the terminal node, the monitoring item comprises a monitoring item of the computing node, data collected by a sensor and a terminal working state;
The resource monitor of the monitored node receives the binding success mark returned by the monitoring center, monitors the monitoring item of the node according to the preset monitoring period, locally stores the monitoring result data, and distributes the monitoring result data to the global data space according to the binding monitoring data subject Topic through the DDS middleware;
The node encapsulates the collected monitoring data into a data format that can be identified.
On the other hand, the distributed resource monitoring system provided by the application adopts the following technical scheme:
A distributed resource monitoring system comprises a monitoring center and a plurality of nodes, wherein the monitoring center is provided with a cluster monitor and a DDS middleware, and all the nodes are provided with the resource monitor and the DDS middleware, wherein:
The monitoring center is provided with a cluster monitor and a DDS middleware for monitoring all bound computing nodes and terminal nodes of the cluster;
The resource monitor is used for monitoring the resource state of the node;
the DDS middleware is used for publishing the monitored resource state data to the global data space;
and the monitoring center subscribes and acquires the monitoring data published by the computing node and the terminal node in the global data space through the DDS middleware.
Optionally, the system includes N computing nodes, N terminal nodes, and a monitoring center, where:
the computing node provides computing resources for running computing tasks;
The terminal node provides sensing resources and functional resources for realizing calculation, storage and communication of the terminal equipment.
Optionally, the terminal node includes a terminal device and a computing device, where the terminal device includes a sensing device and a functional device, and the computing device includes a general purpose computing device with computing, storing and communication capabilities, where a resource agent is deployed in the computing device and used for performing control interaction and data interaction with the terminal device, where the resource agent is running in a container of the computing device, where a driver of the terminal device is encapsulated in the container, and the container provides an interface method for controlling the terminal device.
Optionally, the interface method comprises one or more of Socket call, web Service, JSON-RPC and Restful API.
Optionally, all nodes in the system include a processor and a computer readable storage medium having stored therein a computer program for enabling distributed monitoring.
In summary, the application has the following beneficial technical effects:
1. According to the application, middleware is deployed on each node to realize the resource and state monitoring of each distributed node in the cluster, the nodes agree on Topic of monitoring data transmission communication by calling a theme binding interface of a monitoring center, and the monitoring center and the monitored node issue and acquire monitoring data through the same theme Topic;
2. the application realizes distributed monitoring by a DDS publishing and subscribing mechanism, the monitoring center can dynamically adjust the pulling rate of monitoring data according to self load, meanwhile, because the monitoring center and the monitored node carry out data interaction through a DDS theme Topic, cluster communication is more flexible, a new node is added into a cluster and only needs to call a theme binding interface of the monitoring center to register, so that the system is easier to expand, the volume is lighter, and the application is more suitable for an embedded environment.
Detailed Description
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Other advantages and effects of the present application will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present application with reference to specific examples. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. The application may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present application. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It is noted that various aspects of the embodiments are described below within the scope of the following claims. It should be apparent that the aspects described herein may be embodied in a wide variety of forms and that any specific structure and/or function described herein is merely illustrative. Based on the present disclosure, one skilled in the art will appreciate that one aspect described herein may be implemented independently of any other aspect, and that two or more of these aspects may be combined in various ways. For example, an apparatus may be implemented and/or a method practiced using any number of the aspects set forth herein. In addition, such apparatus may be implemented and/or such methods practiced using other structure and/or functionality in addition to one or more of the aspects set forth herein.
It should also be noted that the illustrations provided in the following embodiments merely illustrate the basic concept of the present application by way of illustration, and only the components related to the present application are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complicated.
In addition, in the following description, specific details are provided in order to provide a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects may be practiced without these specific details.
The embodiment of the application provides a distributed resource monitoring method.
As shown in fig. 1, a distributed resource monitoring method is applied to a distributed system, and the resource monitoring method includes:
Establishing a software environment, deploying middleware on each node, covering a monitoring center and each node by all the middleware, forming a global data space between the monitoring center and each node, transmitting data to the global data space by each node through the middleware, subscribing monitoring data needed in the global data space by the monitoring center through the middleware,
The resource monitor node registers the related information of the node into a database of the monitoring center by calling a theme binding interface of the monitoring center, so as to realize the one-to-one mapping relation between the theme and the monitoring node;
After the monitoring center theme binding interface is called by the monitoring node, subscribing the monitoring data of the node according to the theme Topic provided by the monitoring node, setting the pulling rate of the monitoring data by a user, and acquiring the monitoring data of the corresponding node from the global data space.
The specific steps of each node include:
Step 1, each computing node and terminal node in the cluster call a theme binding interface of a monitoring center to register the node, wherein parameters contained in interface call comprise node names, node IP addresses, node MAC physical addresses, monitoring data themes Topic and monitoring periods;
Step 2, after the node receives the successful binding mark, starting multithreading to perform concurrent monitoring on various resources of the node;
step 3, the node stores the monitoring data in a local storage medium;
step 4, the node packages the collected monitoring data into a JSON data format;
and 5, the node issues the packaged monitoring data to the global data space through the DDS middleware according to the monitoring data subject Topic bound in the step 1, and the step 2 is executed.
The specific steps of the monitoring center include:
step 1, a monitoring center starts a theme binding interface service;
step 2, the monitoring center receives the Topic binding request of the node and analyzes the request, subscribes to the Topic of the node monitoring data according to the Topic field, starts a monitoring thread for acquiring the monitoring data, and returns a binding success mark;
And step 3, obtaining the monitoring data of the corresponding node from the global data space according to the node monitoring data pulling rate set by the user.
In order to ensure that the monitoring data Topic Topic is unique in the global data space, the MAC physical address of the Topic or the splicing node is generated by a character string random method. By setting the same domain, the logic isolation between the monitoring data interaction and other application communication networks in the system is ensured, and the communication between the monitoring center and the monitored node is not affected.
The monitoring item of the monitored node and the processing mode of the monitored data comprise:
for a computing node, monitoring items comprise node CPU occupancy rate, memory occupancy rate, disk occupancy rate, network bandwidth occupancy rate, node survival state, node working state, task running state and monitoring time stamp;
For the terminal node, the monitoring item comprises a monitoring item of the computing node, data collected by a sensor and a terminal working state;
The resource monitor of the monitored node receives the binding success mark returned by the monitoring center, monitors the monitoring item of the node according to the preset monitoring period, locally stores the monitoring result data, and distributes the monitoring result data to the global data space according to the binding monitoring data subject Topic through the DDS middleware;
The node encapsulates the collected monitoring data into a data format that can be identified.
The application also discloses a distributed resource monitoring system
As shown in fig. 2, a distributed resource monitoring system includes a monitoring center and a plurality of nodes, the monitoring center deploys a cluster monitor and a DDS middleware, and all the nodes deploy the resource monitor and the DDS middleware, wherein:
The monitoring center is provided with a cluster monitor and a DDS middleware for monitoring all bound computing nodes and terminal nodes of the cluster;
The resource monitor is used for monitoring the resource state of the node;
the DDS middleware is used for publishing the monitored resource state data to the global data space;
through DDS middleware, the monitoring center can subscribe and acquire monitoring data published by the computing nodes and the terminal nodes in the global data space.
The monitoring center can subscribe and acquire monitoring data issued by the computing nodes and the terminal nodes in the global data space through the DDS middleware. The monitoring center can dynamically adjust the pulling rate of the monitoring data according to the self-load condition, including the data receiving and processing capacity and the communication bandwidth capacity.
The application realizes the resource and state monitoring of each distributed node in the cluster through the DDS publishing/subscribing mechanism, the nodes agree on the Topic of monitoring data transmission communication by calling the Topic binding interface of the monitoring center, and the monitoring center and the monitored nodes publish and acquire monitoring data through the same Topic. The application realizes the active data acquisition of the monitoring center in a publish/subscribe mode, can dynamically adjust the quantity and the frequency of the monitoring data acquisition according to the load of the monitoring center, and effectively solves the problem of data congestion of a receiving end. Meanwhile, the flexibility and the expandability of the system are improved.
The system comprises N computing nodes, N terminal nodes and a monitoring center, wherein:
The computing node provides computing resources for running computing tasks;
the terminal nodes provide sensing resources and functional resources for realizing computation, storage and communication of the terminal equipment.
The terminal node is a combination of terminal equipment and computing equipment, the terminal equipment comprises sensing equipment and functional equipment, the computing equipment comprises general computing equipment, a resource agent is deployed in the computing equipment with computing, storing and communication capabilities and used for controlling interaction and data interaction with the terminal equipment, the resource agent is operated in a container of the computing equipment, a driving program of the terminal equipment is packaged in the container, and an interface method is provided outside the container and used for controlling the terminal equipment.
The interface method of (1) comprises one or more of Socket call, web Service, JSON-RPC and Restful API.
All nodes in the system include a processor and a computer readable storage medium having stored therein a computer program for enabling distributed monitoring.
As shown in fig. 1, the distributed resource monitoring process is divided into two processes of a monitored node and a monitoring center.
For the monitored node:
Step a1, each computing node and terminal node in the cluster call a theme binding interface of a monitoring center to register the node, wherein parameters included in interface call comprise node names, node IP addresses, node MAC physical addresses, monitoring data themes Topic and monitoring periods;
step a2, after the node receives the successful binding mark, starting multithreading to perform concurrent monitoring on various resources of the node;
step a3, the node stores the monitoring data in a local storage medium;
Step a4, the node packages the collected monitoring data into a JSON data format;
and a step a5, the node issues the encapsulated monitoring data to the global data space through the DDS middleware according to the monitoring data subject Topic bound in the step 1, and the step a4 is executed.
For a monitoring center:
step b2, the monitoring center starts a theme binding interface service;
Step b2, the monitoring center receives the Topic binding request of the node and analyzes the request, subscribes to the Topic of the node monitoring data according to the Topic field, starts a monitoring thread for acquiring the monitoring data, and returns a binding success mark;
Step b3, according to the node monitoring data pulling rate set by the user, monitoring data of the corresponding node is obtained from the global data space;
and b4, if the latest acquired monitoring data is abnormal and exceeds a set threshold value, carrying out event warning.
After the computing node and the terminal node call the Topic binding interface successfully, the monitored node and the monitoring center are stated to achieve Topic agreement, data communication between the monitored node and the monitoring center is achieved by publishing and subscribing data to the same Topic, the monitored node circularly carries out the resource state monitoring and the process of monitoring data publishing in step b1 to step b3, and the monitoring center responds to abnormal node resources or states in step b 4.
After the monitoring center receives the topic binding request of the node, analyzing and processing the interface data, and circularly reading the monitoring data of the node according to the preset pulling rate through the step c 2.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present application should be included in the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.