Computer resource monitoring method and server

By encapsulating the state changes of computer resources into events and using blocking event monitoring, the complexity of monitoring the dynamic changes of computer resources in the server is solved, efficient and real-time monitoring is achieved, and losses are reduced.

CN119396645APending Publication Date: 2025-02-07XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411288725.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In a server, how to efficiently and with low loss monitoring of dynamic changes in large and diverse computer resources, especially the real-time state changes of network resources.

Method used

By encapsulating the state changes of computer resources into events and using blocking methods to monitor events, the system's monitoring efficiency and real-time performance of computer resources is improved. Design listeners with different working methods for different types of network resources, use preset matching rules to filter events, and ensure that each listener performs event processing mutually exclusively.

Benefits of technology

It realizes efficient and real-time monitoring of computer resources, reduces server monitoring losses, and improves system processing efficiency and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396645A_ABST
    Figure CN119396645A_ABST
Patent Text Reader

Abstract

The invention discloses a computer resource monitoring method and a server, the method is applied to the server, and the method comprises the following steps: acquiring computer resources; encapsulating the state change of the computer resource into one or more events; under the condition that one or more events are monitored, the monitored events are processed, and state change information of the computer resources is obtained; and refreshing the computer resources based on the state change information of the computer resources. According to the method, the state change of the computer resource is packaged into the event, the state change of the computer resource is monitored in an event monitoring mode, and the computer resource is refreshed based on the state change of the computer resource, so that the monitoring efficiency of the system on the computer resource is improved, and the monitoring loss of the server is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer monitoring, and in particular to a computer resource monitoring method and server. Background Art

[0002] Computer resources refer to various hardware and software entities used in computer systems to perform computing tasks and provide services. Network resources are a type of computer resources. Network resources refer to the assets and capabilities available for use in computer networks. With the development of computer network technology, network resources used in servers are becoming more and more abundant, with the following characteristics:

[0003] First, the number tends to be large and diverse: a variety of network devices can be integrated into the server, including physical network cards NIC, InfiniBand cards that support Ethernet and InfiniBand modes, etc. In a virtualized environment, a large number of virtual network interfaces are dynamically generated, such as VLAN, Team, Bond, and Bridge. This increases the complexity of network resource monitoring.

[0004] Secondly, the challenge of dynamic changes: changes in the location of network devices or network interfaces, the creation and destruction of network interfaces such as VLANs and Teams, and key dynamic network attributes such as the link status, rate, and IP attributes of network interfaces are all changing in real time. These changes require the server to be able to respond flexibly while maintaining a high degree of stability and performance.

[0005] Therefore, how to monitor the dynamic changes of a large number of diverse computer resources in a server efficiently and with low loss becomes a complex task. Summary of the invention

[0006] The embodiments of the present application provide a computer resource monitoring method and server, which can monitor the dynamic changes of a large number of diverse computer resources efficiently and with low loss.

[0007] In a first aspect, an embodiment of the present application provides a computer resource monitoring method, which is applied to a server, and the method includes: obtaining computer resources; encapsulating the state change of the computer resources into one or more events, and the state change of the computer resources is used to indicate that the state of the computer resources has changed; when one or more events are monitored, the monitored events are processed to obtain state change information of the computer resources, and the state change information of the computer resources is used to indicate that the state of the computer resources has changed; based on the state change information of the computer resources, the computer resources are refreshed.

[0008] Therefore, the status change information of computer resources is encapsulated into events respectively, and the events are monitored in a blocking manner, which can improve the system's monitoring efficiency and real-time performance of computer resources and reduce the monitoring loss of the server.

[0009] In a possible implementation, encapsulating the state change of computer resources into one or more events includes: when detecting one or more state changes of computer resources, creating one or more events, and encapsulating the state change information of the one or more state changes into one or more events respectively.

[0010] Therefore, by encapsulating each state change into an event, the state of the computer resources after the change can be accurately obtained.

[0011] In one possible implementation, computer resources include network resources, a server uses a Linux operating system, and categories of network resources include network devices, network interfaces of network devices, and network attributes of network interfaces; before one or more events are monitored, the method also includes: starting a first listener, a second listener, and a third listener; wherein the first listener is used to call the Linux user space device UDEV tool, and adopts a blocking method to monitor events encapsulated by state changes of physical network devices and network interfaces of physical network devices; the second listener is used to call the IP monitoring tool, and adopts a blocking method to monitor virtual network devices, network interfaces of virtual network devices, and events encapsulated by state changes of network attributes of network interfaces related to IP addresses; the third listener is used to use a custom implementation method, and adopts a blocking method to monitor events encapsulated by state changes of network attributes of network interfaces that are not related to IP addresses.

[0012] Therefore, by designing listeners with different working modes for different categories of network resources, the status of each network resource after change can be accurately obtained.

[0013] In a possible implementation, the computer resources include network resources. Before processing the monitored events, the method also includes: filtering one or more events according to preset matching rules to obtain a target event; parsing the state change information encapsulated by the target event to extract the target state change information; and updating the state change information encapsulated by the target event to the target state change information; wherein the target event is a non-linked event among one or more events, or an event with the largest scope of the corresponding state change among the linked events; the linked event is an event corresponding to the state change generated by mutual influence and coordination between network resources; the scope includes the entire network device, a specific network interface of the network device, or a specific network attribute of a specific network interface; the target state change information is used to generate a refresh signal for the scope of the state change corresponding to the target event to perform a refresh.

[0014] Therefore, the preset matching rules are used to filter out the events with the largest scope corresponding to the changes in the status of network resources among the linkage events, so that the listeners can process events mutually exclusively (filter out one target event from multiple linkage events for processing), thereby improving the monitoring efficiency and real-time performance of the system and reducing the monitoring loss of the server.

[0015] In a possible implementation, before processing the monitored event, the method further includes: sending the target event to an event queue; processing the event queue in a preset manner, determining a target listener that monitors the target event, and processing the target event using the target listener.

[0016] Therefore, by using the event listening module to send events to the event queue, and using the event management module to monitor the events in the event queue in a blocking manner, determining the target listener corresponding to the event, and returning the target listener information to the event listening module, the structured design can simplify the event listening module's management of events, reduce system losses, and improve the system's processing efficiency.

[0017] In a possible implementation, the monitored event is processed to obtain the state change information of the computer resource, including: parsing the target event with a target listener to obtain the target state change information of the target network resource corresponding to the target event.

[0018] Since the target state change information carried in the target event is simplified state change information, the event transmission efficiency is improved.

[0019] In one possible implementation, if the listener that listens to the event is the first listener, the state change information includes at least the state change action of the network resource corresponding to the event, the bus category connected to the server for communication, and the path in the device tree of the user space device; based on the state change information of the network resource, the network resource is refreshed, including: judging that the state change action is an add or delete operation, and according to the bus category connected to the server and the path in the device tree of the user space device, correspondingly querying from the system device file or database to obtain a unique bus device function identifier of the network resource; the database includes the information of the acquired network resource; identifying the network resource category of the network resource according to the unique bus device function identifier; generating a refresh signal according to the unique bus device function identifier and the network resource category of the network resource; and refreshing the network resource according to the refresh signal.

[0020] In a possible implementation, if the listener that listens to the event is the second listener, the state change information includes at least a unique system identifier of the network resource; refreshing the network resource based on the state change information of the network resource includes: generating a refresh signal according to the unique system identifier of the network resource. Refreshing the network resource according to the refresh signal.

[0021] In one possible implementation, if the listener that listens to the event is a third listener, the state change information includes at least a unique system identifier of the network resource and an identifier of a target network attribute of the network resource; based on the state change information of the network resource, the network resource is refreshed, including: generating a refresh signal based on the unique system identifier of the network resource and the identifier of the target network attribute; and refreshing the network resource according to the refresh signal.

[0022] Therefore, different event processing processes are designed for each listener to generate identifiers with different scopes, and resources are refreshed based on refresh signals to accurately refresh network resources and implement minimized refresh operations on network resources, thereby further improving the system's monitoring efficiency and real-time performance, and reducing server monitoring losses.

[0023] In a second aspect, an embodiment of the present application provides a server, including:

[0024] at least one memory for storing a program;

[0025] At least one processor is used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method described in the first aspect or any possible implementation manner of the first aspect.

[0026] In a third aspect, an embodiment of the present application provides a computer storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the method described in the first aspect or any possible implementation of the first aspect.

[0027] In a fourth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect or any possible implementation of the first aspect.

[0028] It can be understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0030] Figure 1 A computer resource monitoring system architecture diagram provided for an embodiment of the present application;

[0031] Figure 2 A flow chart of a computer resource monitoring method provided in an embodiment of the present application;

[0032] Figure 3 A schematic diagram of an event monitoring and processing process provided in an embodiment of the present application;

[0033] Figure 4 A schematic diagram of a computer resource status acquisition process provided in an embodiment of the present application;

[0034] Figure 5 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0036] In the description of the embodiments of the present application, any embodiment or design scheme of "exemplary", "for example" or "for example" should not be understood as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.

[0037] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized. "At least one" can be one or more, where a plurality is two or more.

[0038] The state of a computer resource refers to the current condition or properties of various hardware and software entities in a computer system. In a computer system, an event is a notification of a change in the state of a computer resource, such as a user clicking a button, a file being modified, or a hardware device being connected or disconnected. Events are often used in conjunction with event listeners (or callback functions), which register interest in a particular event and receive notification when the event occurs.

[0039] Blocking listener is a kind of event listening method, which refers to the use of blocking calls in servers or applications to wait for events to occur, such as network connection requests, file I / 0 operations, etc. When the system or application is waiting for an event, it will not perform other operations until the event occurs. In this mode, the listening operation will be suspended until an event occurs. Compared with the system or application periodically checking the status of a computer resource (timer polling method), the events encapsulated by the status changes of computer resources in blocking listening will not occupy system resources such as CPU, network, I / 0 load for a long time, and have the characteristics of timely response.

[0040] In view of this, the embodiment of the present application encapsulates the state changes of computer resources into events respectively, and monitors the events in a blocking manner, which can improve the system's monitoring efficiency and real-time performance of computer resources and reduce the monitoring loss of the server;

[0041] Furthermore, computer resources include network resources. The embodiment of the present application designs listeners with different working modes for different categories of network resources, and filters the monitored events according to preset matching rules to filter out non-linkage events or events with the largest scope of corresponding state changes in linkage events, where linkage events are events corresponding to state changes caused by mutual influence and coordination between network resources. So that each listener can process events mutually exclusively (filter out one event for linkage events for processing), which can further improve the monitoring efficiency and real-time performance of the system and reduce the monitoring loss of the server;

[0042] Furthermore, computer resources include network resources. The embodiment of the present application sets identifiers of different scopes for the refresh signals generated by each listener for event processing, accurately refreshes the network resources based on the refresh signals, and implements minimized refresh of the network resources, thereby further improving the monitoring efficiency and real-time performance of the system and reducing the monitoring loss of the server.

[0043] The following will take the server using the Linux operating system as an example to explain this solution in detail.

[0044] For example, Figure 1 A computer resource monitoring system architecture diagram provided in an embodiment of the present application is shown in FIG.

[0045] In this embodiment, the computer resource monitoring system monitors the network resources included in the computer resources, and the computer resource monitoring system is a network resource monitoring system. The network resource monitoring system is deployed on a server, and the system uses the central processing unit (CPU) or baseboard management controller (BMC) of the server to execute relevant network resource monitoring strategies.

[0046] The server includes network devices inside, or the server is connected to multiple network devices outside. Network devices are network units that build and maintain the computer network connected to the server. Internal and external network devices are connected to the server's motherboard through PCle bus, USB interface, etc., and external network devices are connected to the server through Ethernet, Fibre Channel, InfiniBand and other interfaces.

[0047] In this solution, network resources refer to the assets and capabilities that a server can use in a computer network. Network resource categories include physical network devices, such as network cards (NICs), virtual network devices, such as virtual routers and virtual switches, network interfaces of network devices, such as VLAN, Team, Bond, and Bridge, and network attributes of network interfaces, such as speed and port status.

[0048] like Figure 1 As shown, the network resource monitoring system includes three important components for executing the event-based network resource monitoring method: event management module 110, event monitoring module 120, and network resource acquisition module 130. The functions of each part can be implemented by one or more processes in the server operating system. Among them, the event management module 110 and the event monitoring module 120 transmit management and control instructions, and also store the transmitted events Msg1 and Msg2 through the message queue Queue. The event monitoring module 120 and the network resource acquisition module 130 transmit refresh signals.

[0049] Specifically, the event management module 110 is used to monitor system events, including starting each listener in the event monitoring module 120, and starting the system services that the event monitoring depends on. The event management module 110 is also used to monitor the event queue using a blocking monitoring method, and monitor the events put into the event queue by each listener in the event monitoring module 120. The event management module 110 also determines the target listener corresponding to the event, and sends the target listener information to the event monitoring module 120, so as to use the target listener in the event monitoring module 120 to process the event. The target listener is the listener that monitors the event in the event management module 110.

[0050] The event monitoring module 120 includes but is not limited to at least one of the three monitors uDevMonitor, IPMonitor, and NicPMonitor. Each monitor is implemented differently, and event filtering is performed by designing preset matching rules, and event processing can be performed mutually exclusive. They use monitoring threads to monitor specific events and process specific events.

[0051] The first monitor uDevMonitor: is used to call the Linux user space device (user-space dev, UDEV) tool, and adopts a blocking method to monitor the physical network device and the events encapsulated by the state changes of the network interface of the physical network device, and processes the monitored events. The state changes of network resources monitored by the first monitor include the addition and removal of network cards, network ports, IB cards, and IB ports.

[0052] The second listener IPMonitor: is used to call the IP monitor tool, monitor virtual network devices, network interfaces of virtual network devices, and events encapsulated by changes in the state of network attributes of network interfaces related to IP addresses in a blocking manner, and process the monitored events. The network attributes of network interfaces related to IP addresses are static network attributes or dynamic network attributes that can be monitored by calling the IP monitor tool. For example, the creation and deletion of Team / VLAN / Bridge / Bond configurations, and some dynamic attributes in IP link attributes (such as address, network port status, etc.).

[0053] In an implementation scenario, the listener is mainly used to monitor the dynamic network attributes of the network interface, and monitor the static network attributes of the network interface during the initial addition phase of the network device.

[0054] The third listener NicPMonitor: uses a custom implementation method to monitor the state changes of network attributes of network interfaces that are not related to IP addresses in a blocking manner, and processes the monitored events. Network attributes of network interfaces that are not related to IP addresses are network attributes that cannot be monitored by calling the IP monitor tool. For example, another part of the dynamic attributes of IP link attributes (such as rate, full-duplex / half-duplex mode).

[0055] The event monitoring module 120 encapsulates the state changes of each network resource into events. Blocking monitoring means that a series of subsequent event filtering, event processing and network resource refresh logic will be called only when a state change occurs. This can ensure real-time performance without sacrificing excessive processing performance.

[0056] After each listener processes the event, it also sets different update signals: uDevRefresh, IPRefresh, and NicRefresh, so as to accurately refresh network resources and further reduce system loss.

[0057] The network resource acquisition module 130 is used to acquire and refresh network resources.

[0058] During the initialization phase, this module is used to obtain and save the full status information of multiple network resources involved in the network devices to be monitored in the database to assist the system in managing various network resources.

[0059] In addition, the network resource acquisition module 130 also accurately refreshes each network resource according to the refresh signal sent by the event monitoring module 120, obtains the changed status of each network resource, and updates the database.

[0060] For example, Figure 2 A flow chart of a computer resource monitoring method provided by an embodiment of the present application is shown in FIG. Figure 3 As shown, the method is applied to the server and mainly includes the following steps:

[0061] Step S201, obtaining computer resources.

[0062] In one embodiment, the server includes a network device, or the server is connected to multiple network devices externally. The network device is a network unit that builds and maintains the computer network to which the server is connected. The network device includes a physical network device and a virtual network device. The computer resources include network resources.

[0063] In this solution, network resources refer to the assets and capabilities available to the server in the computer network. The monitoring object of the network resource monitoring system deployed by the server is the network resources that need to be monitored among multiple network resources. The categories of network resources include network devices, network interfaces of network devices, and network attributes of network interfaces. The network attributes of network interfaces include static network attributes and dynamic network attributes.

[0064] Exemplarily, the network resource acquisition module 130 is used to acquire the initial full state information of each network resource that the system needs to monitor, and the initial full state information is stored in a database to assist the system in managing each network resource.

[0065] Step S202: encapsulate the state change of the computer resource into one or more events, where the state change of the computer resource is used to indicate that the state of the computer resource has changed.

[0066] In one embodiment, the state of the computer resource is a state that needs to be monitored among multiple states of the computer resource. The change of the state of the computer resource is used to indicate that the state of the computer resource has changed.

[0067] Encapsulating the state change of the computer resource into one or more events includes: when detecting one or more state changes of the computer resource, creating one or more events, and encapsulating the state change information of the one or more state changes into one or more events respectively.

[0068] Specifically, when one or more state changes of a computer resource are detected, the state change information of each state change is collected. One or more events are created using a class or structure in a programming language, and attributes are set for the event, such as event type, timestamp, affected network resource identifier, old state, and new state. The state change information of each state change is encapsulated into one or more events, and it is ensured that all necessary state change information is recorded.

[0069] Step S203, when one or more events are monitored, the monitored events are processed to obtain computer resource status change information, where the computer resource status change information is used to indicate information that the computer resource status has changed.

[0070] In one embodiment, the event monitoring used in this solution is a system-level event monitoring, which is used to monitor system-level events.

[0071] Taking the network resources included in the computer resources as an example, before the event monitoring module 120 is used to monitor the occurrence of one or more events in a blocking manner, the event management module 110 is used to start the first listener, the second listener and the third listener included in the event monitoring module 120. Among them, the first listener is used to call the Linux UDEV tool to monitor the events encapsulated by the state changes of the physical network device and the network interface of the physical network device in a blocking manner; the second listener is used to call the IP monitor tool to monitor the virtual network device, the network interface of the virtual network device, and the state changes of the network attributes of the network interface related to the IP address in a blocking manner; the third listener is used to use a custom implementation method to monitor the events encapsulated by the state changes of the network attributes of the network interface that are not related to the IP address in a blocking manner.

[0072] In one implementation, the pre-written scripts or custom tools in each monitor uDevMonitor / IPMonitor / NicPMonitor are used to monitor the status of specific resources or services. After monitoring the status changes of the network resources of the respective monitored categories in a blocking manner, the status changes of the network resources are encapsulated into events.

[0073] Therefore, by designing listeners with different working modes for different categories of network resources, the status of each network resource after change can be accurately obtained.

[0074] In actual applications, due to signal interference or process errors, the events monitored by each listener may have format or content errors; and the implementation method of each listener enables them to monitor the status change events of each network resource that needs to be monitored, as well as the status change events of other network resources. For example, for the uDevMonitor listener implemented by the Linux-based UDEV tool, if a network resource that needs to be monitored is an internal network device connected to the server motherboard through the PCIe bus, in fact, such a uDevMonitor listener will also monitor the invalid events generated by the internal network device connected to the server motherboard through the USB interface when the state changes.

[0075] In addition, in some application scenarios, it is possible that each listener may monitor a linkage event. For example, for the listener IPMonitor, the state change of the network port in the IP link from activated to inactivated can be monitored. Since this network resource state change will cause the following network resource state changes, such as the rate of the network port in the IP link also changes, and the linkage event generated by this state change will be monitored by the listener NicPMonitor. The linkage event is an event corresponding to the state change caused by the mutual influence and coordination between network resources.

[0076] Obviously, if each listener performs subsequent event processing on the above-mentioned erroneous or invalid events and linkage events, it will lead to a decrease in system monitoring efficiency and a waste of monitoring resources.

[0077] In one implementation, before processing the monitored events, each listener filters the monitored one or more events according to a preset matching rule to obtain a target event; and the filtered target event is subsequently processed to improve the utilization of monitoring resources. The target event is a non-linked event among one or more events, or an event with the largest scope of the corresponding state change among the linked events. The scope includes the entire network device, a specific network interface of the network device, or a specific network attribute of a specific network interface.

[0078] Specifically, one or more events monitored by the first listener are filtered according to the UDEV rules in the preset matching rules; one or more events monitored by the second listener are filtered according to the IPmonitor rules in the preset matching rules; one or more events monitored by the third listener are filtered according to the custom rules in the preset matching rules.

[0079] Optionally, the matching rules are written into a system configuration file so that each listener reads the system configuration file in the startup process, and then uses the corresponding matching rules in the subsequent processing process to filter the events monitored by each listener.

[0080] For example, you can set a custom rule as:

[0081]

[0082] Among them, "NicMonitor" represents the listener, "Common" is the system type of the custom network interface, and "Attr" is the network attribute of the network interface that the listener NicMonitor needs to process. For example, a specific dynamic network attribute feature is: "Ful Duplex": {"type":"command", "cmd":"ethtool ens3f0|grep-E′Duplex:′"}, which represents the full-duplex mode attribute of the IP link, and more detailed parameters related to the attribute, including the name of the network interface and specific working parameters "ethtool ens3f0|grep-E′Duplex:′" and so on.

[0083] The preset matching rule file can be a formatted file such as JSON or html. For example, the rules that the above listeners rely on: UDEV rules, IPmonitor rules and custom rules are set as system configuration files, such as EventPattern.json. When setting matching rules, you should try to consider the coordination of the matching rules corresponding to each monitor, so that each category of listeners can process events mutually exclusively, and filter out one target event for processing from multiple linkage events. In this way, mutually exclusive processing of each listener can be achieved for linkage events.

[0084] For example, continuing the example in the previous article: for the monitor IPMonitor, the state change of the network port in the IP link from activated to inactivated can be monitored. Since this network resource state change will cause the following network resource state changes, such as the rate of the network port in the IP link also changes, and the linkage event generated by this state change will be monitored by the monitor NicPMonitor.

[0085] Analyze the scopes involved in the network resource status changes "the network port in the IP link changes from activated to inactivated" and "the rate of the network port in the IP link also changes". In this linkage event, because the former status change is the main cause and the latter status change is caused by the former status change, the scope of the former status change is greater than the latter.

[0086] At this time, because the scope of the network resource status change corresponding to the event monitored by the listener IPMonitor is larger than that of the listener NicPMonitor, the event generated by the network resource status change "the network port in the IP link changes from activated to inactivated" is filtered out as the target event by setting the preset matching rule. The mutually exclusive operation of the listeners IPMonitor and NicPMonitor is implemented, so that the listener IPMonitor performs subsequent event processing on the filtered target event. Even if the linkage event generated by "the rate of the network port in the IP link also changes" is also monitored by the listener NicPMonitor, after filtering through the preset matching rule, the listener NicPMonitor will not perform subsequent processing on this linkage event. Thus, the mutually exclusive operation of the listeners IPMonitor and NicPMonitor is implemented.

[0087] Therefore, by filtering events according to preset matching rules, the above-mentioned erroneous or invalid events can be filtered out, and mutually exclusive operations between listeners can be implemented.

[0088] It is understandable that if there are new matching rules, they can also be added to the configuration file for expansion, so as to improve the convenience and accuracy of the system in monitoring network resources.

[0089] Furthermore, each listener also parses the state change information encapsulated by the monitored target event, extracts the target state change information, and updates the state change information encapsulated by the target event to the target state change information. The target state change information is used to generate a refresh signal of the scope of the state change corresponding to the target event to execute the refresh of subsequent network resources.

[0090] By updating the state change information encapsulated by the target event to the target state change information for subsequent refreshing of necessary information, the size of the data packet encapsulated by the target event can be reduced, thereby improving the monitoring efficiency of the system.

[0091] In one implementation, before processing the monitored event, each listener may also send the target event to the event queue; the event queue is processed in a preset manner to determine the target listener that monitors the target event, so as to process the target event using the target listener. It is understood that the target listener is one of the first, second or third listeners mentioned above.

[0092] Based on the above structured design, the target events in the event queue can be conveniently processed in an extensible manner in the event management module 110, such as further filtering the target events for effectiveness, etc. This type of processing does not require modification of the original listener code of the event listening module 120, and can improve the stability of the original listener code. In addition, the event management module 110 can also manage the events generated by other functional modules in the event queue system, thereby uniformly managing and operating different types of events, so as to further improve the convenience and accuracy of the system's resource management.

[0093] Therefore, by using the event listening module 120 to send the target event to the event queue, and using the event management module 110 to monitor the target event in the event queue in a blocking manner, determining the target listener corresponding to the target event, and returning the target listener information to the event listening module 120, the structured design can simplify the event listening module 120's management of events, reduce system losses, and improve the system's processing efficiency.

[0094] The monitored events are processed to obtain the state change information of the computer resources, including: parsing the target events with the target listener to obtain the target state change information of the target network resources corresponding to the target events.

[0095] Since the target state change information carried in the target event is simplified state change information, the event transmission efficiency is improved.

[0096] For example, Figure 3 FIG. 4 is a schematic diagram of an event monitoring and processing process provided by an embodiment of the present application. Figure 3 As shown, taking the network resources included in the computer resources as an example, in step S301, the system event monitor 1110 of the event management module 110 executes the system event monitoring service, and in step S302, generates the start monitoring instructions of the first listener, the second listener, and the third listener: uDevMonitor starts monitoring, IPMonitor starts monitoring, and NicMonitor starts monitoring. In step S303, they are sent one by one to the first listener uDevMonitor, the second listener IPMonitor, and the third listener NicPMonitor in the event monitoring module 120.

[0097] For each listener in the event listening module 120, after receiving the listening start instruction sent by the event management module 110, the event listening thread processing logic using the event listening thread module 1210 includes: in step S304, the listener is initialized. In step S305, the event is listened in a blocking manner, and the state changes of each network resource listened are respectively encapsulated into events.

[0098] Further, in step S306, when the event monitoring thread module 1210 monitors an event, it uses the matching rule to filter, and if it is determined to be yes, the target event is obtained, the state change information included in the target event is parsed and extracted, and the target state change information is obtained; and after the state change information encapsulated by the target event is updated as the target state change information, the target event is sent to the event queue in step S307. If it is determined to be no, the target event is not obtained, and step S305 is continued.

[0099] For the first listener, the second listener, and the third listener, the corresponding standard formats of the target state change information are uDev: [action, subsystem, path], IP: [nicName], and Nic: [nicName, attr], respectively, which carry the parameter information of the target network resource state change, including:

[0100] action: the action performed by udev, such as adding, removing, or modifying a device node;

[0101] subsystem: bus type for connecting network resources to the server, for example, "pcie", "net";

[0102] path: the path of the network device in the udev device tree, such as / devices / pci0000:00 / 0000:00:01.0 / ;

[0103] nicName: the name of the network interface, such as eth0 or ens33;

[0104] attr: Dynamic network attributes of the network interface, such as rate, duplex mode, etc.

[0105] Furthermore, for the event queue monitoring module 1120 of the event management module 110, in step S308, the listener for event queue monitoring is opened in advance. In step S309, blocking monitoring of events is performed. In step S310, in response to monitoring the events in the event queue in a blocking manner, in step S311, the target listener corresponding to the target event is determined. In step S312, it is determined that the event is handled by the corresponding target listener. And in step S313, the target listener information is returned to the event monitoring module 120.

[0106] Step S204: Refresh the computer resources based on the status change information of the computer resources.

[0107] In one embodiment, taking the network resources included in the computer resources as an example, the target event is processed by the target listener in the event monitoring module 120. A refresh signal of the target network resource corresponding to the target event is obtained and sent to the network resource acquisition module 130. The network resource acquisition module 130 refreshes the target network resource according to the refresh signal.

[0108] Specifically, Figure 3 As shown, if the target listener is the first listener uDevMonitor, the state change information includes at least the state change action of the network resource corresponding to the target event, the bus type connected to the server communication, and the path in the device tree of the user space device.

[0109] The target state change information included in the target event is processed, including: using the event processing module 1221 of the first listener of the event listening module 120, in step S3141, entering event processing. In step S3142, it is determined that the state change action is an add or delete operation (add or remove). And in step S3143 or step S3144, according to the bus type connected to the server and the path in the device tree of the user space device, the unique bus device function identifier (bus device function, BDF) of the target network resource is obtained from the system device file or database. Before using the event management module 110 to open the first listener, the second listener and the third listener included in the event listening module 120, the database is established when the network resource acquisition module 130 is used to refresh multiple network resources, including the information of the acquired network resources.

[0110] This is because if the state change action is an add operation, since there is no previous record in the database, the query is performed from the system device file. If it is a remove operation, the query is performed directly from the database. When querying, the subsystem and path parameters in the state change information are also used.

[0111] Further, in step S3145, the network resource category of the target network resource is identified according to the BDF. In step S3146, a refresh signal uDevRefresh is generated according to the BDF and the network resource category of the target network resource.

[0112] Since the objects monitored by uDevMonitor are the physical network devices in multiple network resources and the status changes of the network interfaces of the physical network devices, such as the addition and removal of network cards, network ports, IB cards, and IB ports, the scope of the network resource status changes corresponding to the events monitored by it is usually the entire network device. Therefore, the refresh signal uDevRefresh carries the unique system identifier of the target network resource.

[0113] Therefore, by carrying the category of the target network resource in the refresh signal uDevRefresh, the system can quickly search in multiple system files, thereby improving the efficiency of obtaining the changed state of the target network resource according to the refresh signal.

[0114] If the target listener is the second listener IPMonitor, the state change information includes at least the unique system identifier of the target network resource; the target state change information included in the target event is processed, including: using the event processing module 1222 of the second listener of the event monitoring module 120, in step S3241, entering event processing. In step S3242, the network interface object of the network device is obtained. In step S3243, a refresh signal IPRefresh is generated based on the unique system identifier of the target network resource.

[0115] The refresh signal IPRefresh carries the unique system identifier of the target network interface, which means that all network attributes of the target network interface will be refreshed in the network resource acquisition module 130. This is because the network attributes related to the IP address of the network interface monitored by the monitor IPMonitor usually have related linkage events. That is, the changes in the network attributes of the network interface monitored by IPMonitor are usually accompanied by changes in the network attributes of the network interface that are not related to the IP address. The network attributes that are not related to the IP address are the attributes that cannot be monitored by calling the IPmonitor tool.

[0116] Therefore, the scope of the state changes of the network attributes of the network interface monitored by IPMonitor is usually a specific network interface of the network device.

[0117] For example, continuing the example in the previous article: for the monitor IPMonitor, the state change of the network port in the IP link from activated to inactivated can be monitored. Since this network resource state change will cause the following network resource state changes, such as the rate of the network port in the IP link also changes, and the linkage event generated by this state change will be monitored by the monitor NicPMonitor.

[0118] As mentioned above, after filtering by matching rules, the monitor NicPMonitor will not perform subsequent processing on this linkage event, so that the mutually exclusive operation of the monitor IPMonitor and NicPMonitor can be realized.

[0119] However, if the network properties of the network interface monitored by IPMonitor are refreshed, the status of the changed network properties of the network interface corresponding to the associated linkage event that are not related to the IP address cannot be obtained.

[0120] That is, since the objects monitored by IPMonitor are the network interfaces of virtual network devices in multiple network resources and the state changes of network attributes of network interfaces related to IP addresses, the scope of the network resource state changes corresponding to the events monitored is usually a specific network interface. Therefore, it is more comprehensive and reasonable to carry the unique system identifier of the target network interface in the refresh signal IPRefresh to refresh all network attributes of the network interface.

[0121] If the target listener is the third listener NicMonitor, the target state change information includes the unique system identifier of the target network resource and the target network attribute identifier of the target network resource; the target state change information included in the target event is processed, including: using the event processing module 1223 of the third listener of the event monitoring module 120, in step S3341, entering event processing. In step S3342, the network interface object of the target network device and the changed network attribute are obtained. In step S3343, based on the unique system identifier of the network interface object of the target network device and the target network attribute identifier of the target network resource, a refresh signal NicRefresh is generated.

[0122] It can be understood that, for example, if a single event (non-linked event) generated by "change in the rate of the network port in the IP link" is monitored by the listener NicPMonitor, this event can be filtered out as the target event through filtering through matching rules, so that the listener NicPMonitor can perform subsequent processing on this single event.

[0123] Since the object monitored by NicPMonitor is the state change of the network attribute of the network interface that is not related to the IP address among multiple network resources, the scope of the network resource state change corresponding to the event monitored by it is usually the specific network attribute of the specific network interface. Therefore, the refresh signal NicRefresh carries the unique system identifier of the target network resource and the target network attribute identifier of the target network resource, so that the network resource acquisition module 130 refreshes the specific network attribute of the specific network interface.

[0124] Finally, each listener sends the generated refresh signal to the network resource acquisition module 130, so that it can accurately perform the refresh processing of the target network resources. In addition, the refresh processing also realizes the minimized refresh operation of the network resources.

[0125] For example, if a single event generated by "the rate of the network port in the IP link changes" is monitored by the monitor NicPMonitor, this event can be filtered out as the target event through filtering by matching rules. Correspondingly, the monitor NicPMonitor performs subsequent processing on this single event to generate a refresh signal NicRefresh, so that the network resource acquisition module 130 can re-acquire the changed network interface rate through refreshing according to the refresh signal NicRefresh, without refreshing all network attributes of the network interface, thereby reducing the monitoring loss of the system.

[0126] Therefore, based on the target network resource identifier carried by the refresh signal, the network resource acquisition module 130 is used to accurately refresh the target network resource among the network resources, thereby ensuring real-time performance without consuming too many system resources.

[0127] like Figure 3 As shown, the target listener in the event monitoring module 120 is used to process the target state change information included in the target event, obtain a refresh signal of the target network resource corresponding to the target event, and send it to the network resource acquisition module 130.

[0128] For example, Figure 4 A schematic diagram of a computer resource status acquisition process provided in an embodiment of the present application is shown in FIG.

[0129] like Figure 4 As shown, taking the network resources included in the computer resources as an example, a refresh signal is transmitted between the event monitoring module 120 and the network resource acquisition module 130, and the refresh signal is used to prompt the network resource acquisition module 130 to refresh the target network resources.

[0130] The refresh signals uDevRefresh / IPRefresh / NicRefresh respectively sent by each monitor uDevMonitor / IPMonitor / NicPMonitor are sent to the network resource acquisition module 130 to accurately refresh the target network resources.

[0131] If it is uDevRefresh, delete or add the corresponding target network resource according to BDF and the network resource category of the target network resource;

[0132] If it is IPRefresh, refresh all network properties of the corresponding network interface according to the unique system identifier of the target network interface;

[0133] If it is NicRefresh, the network attributes of the corresponding network interface may be refreshed according to the unique system identifier based on the target network interface and the identifier of the target network attribute.

[0134] from Figure 4 It can be seen that the scopes corresponding to the refresh signals uDevRefresh, IPRefresh, and NicRefresh decrease in sequence, and a minimized refresh operation is implemented on each network resource.

[0135] In addition, since the network resource acquisition module 130 also acquires the full amount of network resource status information in the initial stage and stores it in the database, and updates the monitoring data in the database in real time in synchronization with the refreshing of the network resources, the network resource acquisition module 130 can compare the monitoring results and report the changed attributes to the third-party management component to assist the system in effectively managing the network resources corresponding to the integrated network devices.

[0136] It should be noted that in the above embodiments, the implementation process of this solution is introduced with network devices as the object. It is understandable that other hardware devices in the server, such as hard disks, RAID cards, FC, Nvme, etc., can also implement similar monitoring operations based on the same blocking method for event monitoring and have similar monitoring performance, which will not be described in detail here.

[0137] It is understandable that the size of the sequence number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. In addition, in some possible implementations, each step in the above embodiment can be selectively executed according to actual conditions, and can be partially executed or fully executed, which is not limited here. In addition, all or part of any feature in the above embodiment can be freely and arbitrarily combined without contradiction. The combined technical solution is also within the scope of the present application.

[0138] The present application embodiment also provides a computing device 1000. Figure 5 As shown, computing device 1000 includes: bus 1002, processor 1004, memory 1006 and communication interface 1008. Processor 1004, memory 1006 and communication interface 1008 communicate with each other via bus 1002. It should be understood that the present application does not limit the number of processors and memories in computing device 1000.

[0139] The bus 1002 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (ElSA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The bus 1004 is represented by a line, but does not mean that there is only one bus or one type of bus. The bus 1004 may include a path for transmitting information between various components of the computing device 1000 (for example, the memory 1006, the processor 1004, and the communication interface 1008).

[0140] The processor 1004 may include any one or more of a central processing unit, a graphics processing unit (GPU), a microprocessor (MP), a digital signal processor (DSP), a baseboard management controller, and the like.

[0141] The memory 1006 may include a volatile memory, such as a random access memory (RAM). The processor 1004 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0142] The communication interface 1008 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1000 or a cluster of computing devices 1000 and other devices or communication networks.

[0143] The computing device 1000 includes a network device internally, or the computing device 1000 is connected to multiple network devices externally. The internal network device communicates with the processor 1004, the memory 1006 and the communication interface 1008 through the bus 1002, and the external network device communicates with the computing device 1000 through interfaces such as Ethernet, Fibre Channel, and InfiniBand.

[0144] The memory 1006 stores executable program codes / instructions, and the processor 1004 executes the executable program codes / instructions to implement Figure 2 The method flow shown in , thereby implementing all or part of the steps of the method in the above embodiment. In other words, the memory 1006 stores a program / instruction for executing all or part of the steps in the method in the above embodiment.

[0145] An embodiment of the present application provides a server, including: a memory and a processor; the memory and the processor are coupled; the memory is used to store programs; the processor is used to execute the programs stored in the memory, and when the programs stored in the memory are executed, the processor is used to execute the methods in the above embodiments.

[0146] Based on the method in the above embodiment, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.

[0147] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method in the above embodiment.

[0148] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0149] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted by a computer-readable storage medium. The computer instructions can be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.

[0150] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.

Claims

1. A computer resource monitoring method, characterized in that: Applied to a server, the method comprises: Access to computer resources; Encapsulating the state change of the computer resource into one or more events, wherein the state change of the computer resource is used to indicate that the state of the computer resource has changed; In the case of monitoring one or more of the events, processing the monitored events to obtain the state change information of the computer resource, wherein the state change information of the computer resource is used to indicate the information that the state of the computer resource has changed; The computer resources are refreshed based on the status change information of the computer resources.

2. The method according to claim 1, characterized in that The step of encapsulating the state change of the computer resource into one or more events comprises: When one or more state changes of the computer resource are detected, one or more events are created, and state change information of the one or more state changes are respectively encapsulated into the one or more events.

3. The method according to claim 1, characterized in that The computer resources include network resources, the server uses a Linux operating system, and the categories of the network resources include network devices, network interfaces of network devices, and network attributes of network interfaces; Before monitoring the occurrence of one or more of the events, the method further includes: Open the first listener, the second listener and the third listener; The first listener is used to call the Linux user space device UDEV tool to monitor the entity's network device and the events encapsulated by the state changes of the network interface of the entity's network device in a blocking manner; The second listener is used to call the IP monitoring tool and adopt a blocking mode to monitor the virtual network device, the network interface of the virtual network device, and the events encapsulated by the state changes of the network attributes of the network interface related to the IP address; The third listener is used to use a custom implementation method to monitor events encapsulated by changes in the status of network attributes of the network interface that are not related to the IP address in a blocking manner.

4. The method according to claim 1, characterized in that: The computer resources include network resources. Before processing the monitored events, the method further includes: Filtering the one or more events according to a preset matching rule to obtain a target event; Parsing the state change information encapsulated by the target event, and extracting the target state change information therefrom; Updating the state change information encapsulated by the target event to the target state change information; Among them, the target event is a non-linked event among the one or more events, or an event with the largest scope of the corresponding state change among the linked events; the linked event is an event corresponding to the state change caused by the mutual influence and coordination between network resources; the scope includes the entire network device, a specific network interface of the network device, or a specific network attribute of a specific network interface; the target state change information is used to generate a refresh signal for the scope of the state change corresponding to the target event to perform the refresh.

5. The method according to claim 4, characterized in that Before processing the monitored event, the method further includes: Sending the target event to an event queue; The event queue is processed in a preset manner, and a target listener that monitors the target event is determined, so as to process the target event using the target listener.

6. The method according to claim 5, characterized in that The processing of the monitored event to obtain the state change information of the computer resource includes: The target event is parsed using the target listener to obtain the target state change information of the target network resource corresponding to the target event.

7. The method according to claim 3, characterized in that If the listener that listens to the event is the first listener, the state change information includes at least the state change action of the network resource corresponding to the event, the type of the bus connected to the server for communication, and the path in the device tree of the user space device; The refreshing of the network resource based on the state change information of the network resource includes: Determine that the state change action is an add or delete operation, and query and obtain a unique bus device function identifier of the network resource from a system device file or a database according to the type of the bus connected to the server and the path in the device tree of the user space device; the database includes the information of the obtained network resource; identifying a network resource category of the network resource based on the unique bus device function identifier; generating a refresh signal according to the unique bus device function identifier and the network resource category of the network resource; The network resource is refreshed according to the refresh signal.

8. The method according to claim 3, characterized in that If the listener that listens to the event is the second listener, the state change information includes at least a unique system identifier of the network resource; The refreshing of the network resource based on the state change information of the network resource includes: generating a refresh signal based on a unique system identifier of the network resource; The network resource is refreshed according to the refresh signal.

9. The method according to claim 3, characterized in that: If the listener that listens to the event is a third listener, the state change information includes at least a unique system identifier of the network resource and an identifier of a target network attribute of the network resource; The refreshing of the network resource based on the state change information of the network resource includes: generating a refresh signal according to the unique system identifier of the network resource and the identifier of the target network attribute; The network resource is refreshed according to the refresh signal.

10. A server, characterized in that: include: at least one memory for storing a program; At least one processor is used to execute the program stored in the memory, and when the program stored in the memory is executed, the processor is used to execute the method according to any one of claims 1 to 9.