A method and terminal for collecting virtual machine operation data

By creating a virtual interactive device on a virtual machine, writing the real-time running data of the virtual machine to the physical interactive device, and connecting through the network socket protocol, the data incompleteness and complexity of traditional monitoring methods is solved, and the virtual machine is realized High-speed data exchange and unified interface with the host reduce system maintenance costs.

CN118939382BActive Publication Date: 2025-01-10HONGYANG SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411419626.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-10
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

Traditional virtual machine monitoring methods rely on operation logs, resulting in incomplete and complex data, lack of unified interfaces, difficult to access and analyze externally, and may have compatibility issues during system upgrade or maintenance.

Method used

By creating a virtual interactive device corresponding to the physical interactive device on the virtual machine, writing real-time running data to the physical interactive device, and sending acquisition requests to the host through the virtual data bus, establishing a network socket protocol connection, realizing data Direct exchange and unified interface.

Benefits of technology

It avoids dependence on the operation log, ensures high-speed data exchange between the virtual machine and the host, provides a unified data interface, facilitates external systems to collect data, and reduces system development and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939382B_ABST
    Figure CN118939382B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and terminal for collecting virtual machine operation data. By creating a virtual interaction device corresponding to a physical interaction device on a virtual machine, and writing the real-time operation data of the virtual machine into the physical interaction device through the virtual interaction device, a host machine can directly read the target operation data of the virtual machine from the physical interaction device, thereby avoiding the monitoring process from relying on the operation log. At the same time, the virtual machine sends a collection request to the host machine through a virtual data bus, ensuring high-speed data exchange between the virtual machine and the host machine, and avoiding embedding specific codes or components in the virtual machine. In addition, the host machine and the monitoring system establish a target connection of a network socket protocol to transmit target operation data, providing a unified data interface, which is convenient for external systems to collect data while improving data transmission efficiency and reducing system development and maintenance costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data collection, and in particular to a method and a terminal for collecting virtual machine operation data. Background Art

[0002] In the related art, in order to ensure the operation safety of the virtual machine, a related monitoring program is usually set to monitor various data of the virtual machine, so as to determine the operation status of the virtual machine based on the various data of the virtual machine. The monitoring method adopted by the traditional virtual machine is usually to obtain the operation data from the operation log of the virtual machine through the middleware or agent, so as to monitor the operation status of the virtual machine according to the operation data.

[0003] However, this monitoring method relies on the operation logs of the virtual machine. Since the log records may not be updated in real time and need to be cleaned regularly, the collected data may be incomplete. Moreover, the monitoring process requires embedding specific code or components in the virtual machine to record the operation logs, which may increase the complexity of the system. In addition, the existing monitoring methods lack a unified digital interface, making it difficult for the operation data to be accessed and analyzed by external systems or administrators, and there may be compatibility issues during system upgrades or maintenance. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method and a terminal for collecting virtual machine operation data, which can directly obtain the operation data from the virtual machine and avoid the problem of relying on operation logs and intrusive monitoring.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] A method for collecting virtual machine operation data, comprising:

[0007] The virtual machine creates a virtual interactive device corresponding to the physical interactive device of the host machine, and writes the real-time running data of the virtual machine into the physical interactive device through the virtual interactive device;

[0008] The virtual machine sends a collection request to the host machine through a virtual data bus in response to a monitoring instruction of the monitoring system;

[0009] The host machine responds to the collection request by reading the target operation data of the virtual machine through the physical interaction device and sending an upgrade request to the monitoring system;

[0010] The monitoring system upgrades the network transmission protocol to a network socket protocol in response to the upgrade request, and establishes a target connection with the host machine based on the network socket protocol;

[0011] The host machine sends the target operation data to the monitoring system through the target connection.

[0012] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0013] A terminal for collecting virtual machine operation data comprises a memory, a processor and a computer program stored in the memory and running on the processor. When the processor executes the computer program, each step in the above-mentioned method for collecting virtual machine operation data is implemented.

[0014] The beneficial effects of the present invention are as follows: by creating a virtual interactive device corresponding to a physical interactive device on a virtual machine, and writing the real-time operation data of the virtual machine into the physical interactive device through the virtual interactive device, the host machine can directly read the target operation data of the virtual machine from the physical interactive device, thereby avoiding the monitoring process's dependence on the operation log. At the same time, the virtual machine sends a collection request to the host machine through a virtual data bus, ensuring high-speed data exchange between the virtual machine and the host machine, and avoiding embedding specific codes or components in the virtual machine. In addition, the host machine and the monitoring system establish a target connection of the network socket protocol to transmit the target operation data, providing a unified data interface, which is convenient for the external system to collect data while improving data transmission efficiency and reducing system development and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A flowchart of a method for collecting virtual machine operation data according to an embodiment of the present invention;

[0016] Figure 2 A schematic diagram of interaction between a virtual machine and a host machine according to an embodiment of the present invention;

[0017] Figure 3 This is a structural schematic diagram of a terminal for collecting virtual machine operation data according to an embodiment of the present invention;

[0018] Description of labels:

[0019] 100. A terminal for collecting virtual machine operation data; 101. Memory; 102. Processor. DETAILED DESCRIPTION

[0020] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0021] An embodiment of the present invention provides a method for collecting virtual machine operation data, comprising:

[0022] The virtual machine creates a virtual interactive device corresponding to the physical interactive device of the host machine, and writes real-time operation data into the physical interactive device through the virtual interactive device;

[0023] The virtual machine sends a collection request to the host machine through a virtual data bus in response to a monitoring instruction of the monitoring system;

[0024] The host machine responds to the collection request by reading the target operation data of the virtual machine through the physical interaction device and sending an upgrade request to the monitoring system;

[0025] The monitoring system upgrades the network transmission protocol to a network socket protocol in response to the upgrade request, and establishes a target connection with the host machine based on the network socket protocol;

[0026] The host machine sends the target operation data to the monitoring system through the target connection.

[0027] From the above description, it can be seen that the beneficial effect of the present invention is that by creating a virtual interactive device corresponding to the physical interactive device on the virtual machine, and writing the real-time operation data of the virtual machine into the physical interactive device through the virtual interactive device, the host machine can directly read the target operation data of the virtual machine from the physical interactive device, avoiding the monitoring process's dependence on the operation log. At the same time, the virtual machine sends a collection request to the host machine through the virtual data bus to ensure high-speed data exchange between the virtual machine and the host machine, avoiding embedding specific code or components in the virtual machine. In addition, the host machine and the monitoring system establish a target connection of the network socket protocol to transmit the target operation data, providing a unified data interface, which is convenient for the external system to collect data while improving data transmission efficiency and reducing system development and maintenance costs.

[0028] Furthermore, the virtual machine creates a virtual interactive device corresponding to the physical interactive device of the host machine, including:

[0029] The virtual machine obtains a first device attribute of a physical interaction device of the host machine;

[0030] The virtual machine creates a virtual interactive device at the virtualization layer according to the first device attribute;

[0031] The virtual machine establishes a mapping relationship with the virtual interactive device through a virtual input and output mode.

[0032] It can be seen from the above description that by creating a virtual interactive device corresponding to the physical interactive device in the virtualization layer and establishing a mapping relationship, the virtual machine can identify and control the physical interactive device of the host machine.

[0033] Furthermore, before the virtual machine responds to the monitoring instruction of the monitoring system, the method further includes:

[0034] The virtual machine obtains a second device attribute of a physical data device of the host machine;

[0035] The virtual machine creates a virtual data device at the virtualization layer according to the second device attribute;

[0036] The virtual machine establishes a driving relationship with the virtual data device through a virtual input and output mode, so that the virtual machine communicates with the host machine through a virtual data bus.

[0037] It can be seen from the above description that by creating a virtual data device corresponding to the physical data device in the virtualization layer and establishing a driver relationship, the virtual machine can communicate with the physical data device of the host machine.

[0038] Furthermore, the host machine responds to the collection request and reads the target operation data of the virtual machine through the physical interaction device, including:

[0039] The host machine, in response to the acquisition request, obtains a data template corresponding to the acquisition request, and determines a virtual interactive device corresponding to the virtual machine according to the acquisition request;

[0040] The host machine reads target operation data from real-time operation data of a physical interactive device corresponding to the virtual interactive device according to the data template.

[0041] As can be seen from the above description, the host is configured with a preset data template. As long as the host receives a collection request, the host will return to obtain the specified target operation data according to the data template. Since the physical interaction device can interact with the host as hardware, and the physical interaction device can access data with the virtual machine through the virtual interaction device, the host and the virtual machine can directly exchange data through the physical interaction device, without relying on the operation log, avoiding the configuration and registration of the server, and reducing the complexity of the monitoring system.

[0042] Furthermore, the host machine sending an upgrade request to the monitoring system includes:

[0043] The host machine sends an upgrade request to the monitoring system via the network transmission protocol;

[0044] Before the monitoring system upgrades the network transmission protocol to the network socket protocol, it also includes:

[0045] The monitoring system detects whether the current network supports the network socket protocol;

[0046] If yes, the monitoring system upgrades the network transmission protocol to a network socket protocol;

[0047] Otherwise, the monitoring system maintains the communication connection of the current network transmission protocol.

[0048] From the above description, it can be seen that if the monitoring system supports the network socket protocol, data transmission is carried out through the network socket protocol, providing a unified data interface, which is convenient for external systems to collect data while improving data transmission efficiency. If the monitoring system does not support the network socket protocol, data transmission is carried out through the current network transmission protocol to be compatible with data transmission in different scenarios.

[0049] Further, the host machine sending the target operation data to the monitoring system through the target connection includes:

[0050] The host machine converts the format of the target operation data into a target format corresponding to the network socket protocol, and sends the target operation data converted into the target format to the monitoring system through the target connection.

[0051] From the above description, it can be seen that the format of the target running data is converted into the target format corresponding to the network socket protocol and sent directly to the monitoring system through the target connection, avoiding the encapsulation and parsing steps of the network transmission protocol for data and improving the efficiency of data transmission.

[0052] Furthermore, the virtual machine establishes a driving relationship with the virtual data device through a virtual input and output mode, including:

[0053] The virtual machine converts the simulated interaction operation of the virtual data device into the physical interaction operation of the physical data device through the virtualization layer, so that the virtual machine drives the physical data device through the virtual data device.

[0054] From the above description, it can be seen that the virtual machine's simulated interactive operations on virtual data devices are converted into physical interactive operations on physical data devices through the virtualization layer to drive the physical data devices, which has high compatibility and does not require modification of the driver of the current virtual machine operating system.

[0055] Furthermore, the virtual machine writes the real-time operation data into the physical interaction device through the virtual interaction device, including:

[0056] The virtual machine obtains virtual interface information of the virtual interactive device;

[0057] The virtual machine writes the real-time running data into the virtual interactive device through the virtual interface information, so that the virtual machine converts the write operation on the virtual interactive device into the write operation on the physical interactive device through the virtualization layer.

[0058] From the above description, it can be seen that the virtual interface information of the virtual interactive device of the virtual machine interacts with the virtualization layer, and the virtualization layer converts the virtual machine's write operation on the virtual interactive device into a write operation on the physical interactive device, thereby realizing the virtual machine's data writing to the physical interactive device.

[0059] Furthermore, the virtual data bus includes a virtual I2C bus, and the physical interaction device includes a human-machine interface device of a universal serial bus.

[0060] From the above description, it can be seen that the virtual I2C bus can ensure bidirectional data transmission between the virtual machine and the host machine, making the interaction between the virtual machine and the host machine more flexible, and the virtual I2C bus is easy to implement and debug. At the same time, the human-machine interface device of the universal serial bus provides a standardized interface, allowing the operating system to handle different types of human-machine interface devices in a unified way, effectively reducing the complexity of system development and maintenance.

[0061] Another embodiment of the present invention provides a terminal for collecting virtual machine operation data, including a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, each step of the above-mentioned method for collecting virtual machine operation data is implemented.

[0062] From the above description, it can be seen that the beneficial effect of the present invention is that by creating a virtual interactive device corresponding to the physical interactive device on the virtual machine, and writing the real-time operation data of the virtual machine into the physical interactive device through the virtual interactive device, the host machine can directly read the target operation data of the virtual machine from the physical interactive device, avoiding the monitoring process's dependence on the operation log. At the same time, the virtual machine sends a collection request to the host machine through the virtual data bus to ensure high-speed data exchange between the virtual machine and the host machine, avoiding embedding specific code or components in the virtual machine. In addition, the host machine and the monitoring system establish a target connection of the network socket protocol to transmit the target operation data, providing a unified data interface, which is convenient for the external system to collect data while improving data transmission efficiency and reducing system development and maintenance costs.

[0063] The embodiment of the present invention provides a method and terminal for collecting virtual machine operation data, which can be applied to the collection and monitoring of virtual machine related data. It can directly obtain operation data from the virtual machine, avoiding the problem of relying on operation logs and intrusive monitoring. The following is an explanation through specific embodiments:

[0064] Please refer to Figure 1 to Figure 2 , Embodiment 1 of the present invention is:

[0065] A method for collecting virtual machine operation data, comprising:

[0066] S1. The virtual machine creates a virtual interactive device corresponding to the physical interactive device of the host machine, and writes the real-time running data of the virtual machine into the physical interactive device through the virtual interactive device.

[0067] Wherein, the physical interaction device includes a human-machine interface device of a universal serial bus.

[0068] In some embodiments, the human interface device of the universal serial bus is a USB HID (Human Interface Device) device. A USB HID device is a device used for human-computer interaction. For example, keyboards, mice, game controllers, touch screens, digital boards / drawing boards, bar / fingerprint scanners, printers, audio controllers, remote controls, virtual reality controllers, and other devices are all USB HID devices. These devices usually communicate with computers using the USB HID protocol because the HID class provides a standardized interface that enables the operating system to handle these devices in a unified manner without installing specific drivers for each device. Operating systems usually have built-in support for HID devices, which makes HID devices have good compatibility and ease of use.

[0069] In some embodiments, before step S1, the circuit structure and software program of the host need to be designed. Among them, the circuit structure design is specifically: the corresponding USB HID device and I2C bus device are connected to the hardware components of the host through a dedicated interface line, so that the host is equipped with a corresponding physical interaction device and a physical data device. Among them, the dedicated interface line includes a data line, a control line and a power line to ensure high-speed data transmission and stable operation of the device. The interface model or type used by each device is selected according to the actual application scenario and performance requirements. For example, the I2C bus device adopts the standard I2C protocol, and the USB HID device adopts the USB3.0 or higher version protocol that supports high-speed data transmission. The software program design is specifically: the driver and middleware corresponding to the USB HID device and the I2C bus device are developed in the host to support the configuration and data transmission of the USB HID device and the I2C bus device. Among them, the driver is used to communicate with the hardware bus to ensure the correct reading and writing of data; the middleware is used to implement data formatting and network transmission protocol conversion for subsequent data processing and transmission.

[0070] Specifically, in step S1, creating a virtual interactive device corresponding to the physical interactive device of the host machine includes:

[0071] S11. The virtual machine obtains a first device attribute of a physical interaction device of the host machine.

[0072] In some embodiments, the first device attribute includes a device identification and a manufacturer identification.

[0073] S12: The virtual machine creates a virtual interactive device at a virtualization layer according to the first device attributes.

[0074] S13: The virtual machine establishes a mapping relationship with the virtual interactive device through a virtual input and output method.

[0075] In some embodiments, the virtual machine establishes a mapping relationship with the virtual interactive device through a virtual input and output mode to implement a response operation of the virtual interactive device under standard input and output.

[0076] In some embodiments, in a virtualized environment, a virtual machine interacts with the physical hardware of a host machine through a virtualization layer (such as a Hypervisor or VMM). Specifically, when a virtual machine needs to use a physical USB HID device, it includes: 1. Device discovery: When a physical USB HID device is inserted into a host machine, the host machine's operating system detects the new device and loads the corresponding driver. The virtualization layer can sense this event and notify the virtual machine to transfer the relevant device properties of the physical USB HID device to the virtual machine. 2. Virtualization layer update: In order to enable the virtual machine to recognize and use the newly added physical USB HID device, the virtualization layer may need to update or configure its internal virtual device model, that is, create a virtual USB HID device to correctly simulate the physical USB HID device and expose it to the virtual machine. 3. Device mapping: The virtualization layer maps the virtual USB HID device to the virtual machine so that the operating system in the virtual machine thinks that it is directly connected to a physical USB HID device. This mapping process includes creating a virtual USB controller and a virtual HID device, and passing the data stream of the physical device to the virtual machine through the virtualization layer.

[0077] It should be noted that the virtual machine usually does not need to actively call the virtualization layer to identify the physical USB HID device. When the physical USB HID device is inserted, the host's operating system will notify the virtualization layer, and then the virtualization layer will update the virtual device list of the virtual machine accordingly.

[0078] In some embodiments, after the physical interactive device is virtualized through step S1, the physical interactive device can be recognized by the virtual machine as virtual hardware, and can also exchange data with the host machine as physical hardware. At this time, the data transmission between the host machine and the virtual machine can be analogous to that achieved through a virtual USB bus.

[0079] Specifically, in step S1, writing the real-time operation data into the physical interaction device through the virtual interaction device includes:

[0080] S14. The virtual machine obtains virtual interface information of the virtual interactive device.

[0081] S15. The virtual machine writes the real-time running data into the virtual interactive device through the virtual interface information, so that the virtual machine converts the write operation on the virtual interactive device into a write operation on the physical interactive device through the virtualization layer.

[0082] In some embodiments, when the virtual machine needs to read data from a physical USB HID device, it includes: the operating system in the virtual machine interacts with the virtual USB HID device provided by the virtualization layer through a standard USB HID driver. The virtual machine calls the API interface (Application Programming Interface) provided by the operating system, interacts with the virtualization layer through these API interfaces, and finally reads data from the physical USB HID device. When the virtual machine needs to write data to the physical USB HID device, it includes: when the virtual machine calls the API interface provided by the operating system, the data to be written is passed to the virtualization layer through these API interfaces, and then the virtualization layer passes the data to the physical USB HID device.

[0083] It should be noted that when the virtual machine needs to interact with the physical USB HID device, it will operate through the standard interface provided by the operating system. Therefore, the virtual machine interacts with the virtualization layer through the standard USB HID interface provided by the operating system, and the virtualization layer converts the interactive operation of the virtual USB HID device into the actual operation of the physical USB HID device.

[0084] S2. The virtual machine sends a collection request to the host machine through a virtual data bus in response to a monitoring instruction of a monitoring system.

[0085] In some embodiments, the monitoring system can access the network where the host and virtual machines are located through a wired network of Ethernet protocol or a wireless network of a device such as a router. In the initialization stage, the monitoring system sends a communication establishment request through the HTTP protocol, and the request includes the identity information of the system. After receiving the request, the host and virtual machines will verify the identity information and permissions of the system before establishing a communication connection.

[0086] Wherein, the virtual data bus includes a virtual I2C bus.

[0087] Specifically, before step S2, the method further includes:

[0088] S201. The virtual machine obtains a second device attribute of a physical data device of the host machine.

[0089] S202: The virtual machine creates a virtual data device at a virtualization layer according to the second device attribute.

[0090] S203: The virtual machine establishes a driving relationship with the virtual data device through a virtual input and output mode, so that the virtual machine communicates with the host machine through a virtual data bus.

[0091] Specifically, the step S203 includes:

[0092] S2031. The virtual machine converts the simulated interaction operation of the virtual data device into the physical interaction operation of the physical data device through the virtualization layer, so that the virtual machine drives the physical data device through the virtual data device.

[0093] In some embodiments, the virtual input and output mode requires configuring a virtualized network interface card and a controller at the virtualization layer so that the virtual machine can communicate with the physical data devices of the host machine at the virtualization layer.

[0094] In some embodiments, after the virtual machine obtains the second device attribute of the physical data device of the host machine, it can also directly allocate the physical data device to the virtual machine through the virtual pass-through method of the virtualization layer, so that the virtual machine can directly control these physical data devices without multiple conversions through the virtual layer, thereby improving the interaction performance between the host machine and the virtual machine.

[0095] In some embodiments, a virtual I2C bus communication channel is formed between the virtual machine and the host machine by virtualizing the physical I2C device. Specifically, if the virtual machine needs to communicate with the physical I2C device on the host machine at high speed, a virtual I2C bus is formed through I2C bus virtualization technology to ensure that the virtualization layer can effectively process the I2C communication request. At the same time, other auxiliary technologies may be required to improve the overall data exchange speed.

[0096] In some embodiments, in order to achieve high-speed data exchange between physical devices and virtual devices, the I2C bus may be optimized and accelerated through SR-IOV (Single Root I / O Virtualization) technology.

[0097] In some embodiments, Figure 2 As shown, the host machine is configured with a physical I2C bus device and a physical USB HID device, and the virtual machine creates a corresponding virtual I2C bus device and a virtual USB HID device, so that data transmission is achieved between the host machine and the virtual machine based on the virtual I2C bus and the virtual USB bus.

[0098] S3. The host machine responds to the collection request, reads the target operation data of the virtual machine through the physical interaction device, and sends an upgrade request to the monitoring system.

[0099] Specifically, in step S3, in response to the acquisition request, reading the target operation data of the virtual machine through the physical interaction device includes:

[0100] S31. The host machine obtains a data template corresponding to the collection request in response to the collection request, and determines a virtual interactive device corresponding to the virtual machine according to the collection request.

[0101] S32: The host machine reads target operation data from real-time operation data of a physical interactive device corresponding to the virtual interactive device according to the data template.

[0102] In some embodiments, when the host sends the data template to the physical interactive device, since the physical interactive device is virtualized, the data template will be acquired by the virtual interactive device with the same mapping in the virtual machine, so the virtual machine writes the data required by the host to the physical interactive device through the virtual interactive device, so that the host can read the target running data. This process is similar to connecting two physical devices through a USB bus to achieve data transmission.

[0103] Specifically, in step S3, sending an upgrade request to the monitoring system includes:

[0104] S33. The host machine sends an upgrade request to the monitoring system via the network transmission protocol.

[0105] In some embodiments, the network transmission protocol is the HTTP protocol, and the host sends an upgrade request to the monitoring system through the GET method or POST method of the HTTP protocol. The upgrade request includes an Upgrade header field to indicate that the host wishes to upgrade the current connection from the HTTP protocol to the network socket protocol, namely, the WebSocket protocol.

[0106] S4. The monitoring system upgrades the network transmission protocol to a network socket protocol in response to the upgrade request, and establishes a target connection with the host machine based on the network socket protocol.

[0107] Specifically, before upgrading the network transmission protocol to the network socket protocol, it also includes:

[0108] S41, the monitoring system detects whether the current network supports the network socket protocol;

[0109] S42: If yes, the monitoring system upgrades the network transmission protocol to the network socket protocol.

[0110] In some embodiments, if the monitoring system supports the WebSocket protocol, the monitoring system responds to the host's upgrade request and returns a response notification containing a 101 Switching Protocols status code to indicate that the host agrees to upgrade the current connection from the HTTP protocol to the WebSocket protocol. If the host receives the response notification, the current connection is upgraded to the WebSocket protocol to establish the target connection.

[0111] S43. Otherwise, the monitoring system maintains the communication connection of the current network transmission protocol.

[0112] In some embodiments, if the monitoring system does not support the WebSocket protocol, the host machine and the monitoring system still perform data transmission according to the HTTP protocol, wherein the HTTP protocol is performed in a Ping-Pong manner, and data interaction is performed by a polling.

[0113] S5. The host machine sends the target operation data to the monitoring system through the target connection.

[0114] Specifically, step S5 includes:

[0115] S51. The host machine converts the format of the target operation data into a target format corresponding to the network socket protocol, and sends the target operation data converted into the target format to the monitoring system through the target connection.

[0116] In some embodiments, the format of the target operation data is converted into a JSON format corresponding to the WebSocket protocol.

[0117] In some embodiments, the host establishes a target connection with the monitoring system based on the WebSocket protocol, so that the host can push the target operation data in JSON format to the monitoring system in real time. This two-way, full-duplex communication method makes the data exchange between the host and the monitoring system more efficient and flexible.

[0118] In some embodiments, after receiving the target operation data through the target connection under the WebSocket protocol, the monitoring system can parse the target operation data in JSON format in real time to determine the operation status of the virtual machine.

[0119] In some embodiments, by introducing the WebSocket protocol, the network connection is smoothly transitioned from HTTP requests to real-time data transmission of the WebSocket protocol, which not only reduces network overhead but also improves the real-time and reliability of data transmission, allowing the monitoring system to respond to changes in the operating status of the virtual machine more efficiently.

[0120] A method for collecting virtual machine operation data of the present invention can be applied to a variety of monitoring and management scenarios, such as resource management of cloud computing environments, monitoring of containerized applications, management of Internet of Things devices, and performance optimization of edge computing environments. Specifically, in the resource management of cloud computing environments, since users on cloud computing platforms may need to monitor and manage a large number of virtual machine instances, the collection method of the present invention can effectively collect and analyze the operation indicators of each virtual machine, such as CPU utilization, memory consumption, etc., thereby helping cloud service providers to more effectively allocate resources and optimize performance. In the monitoring of containerized applications, due to the popularity of containerization technology, many applications are deployed as containers. The collection method of the present invention can collect and monitor the operation data of containers in real time to help developers and operation and maintenance personnel understand the performance status of applications and make adjustments and optimizations in a timely manner. In the management of Internet of Things devices, since devices in Internet of Things scenarios need to be remotely managed and monitored, the collection method of the present invention can collect the operation data of Internet of Things devices, such as sensor data processing speed, network delay, etc., to help device manufacturers and system administrators monitor the status of devices in real time and perform remote maintenance and management. In the performance optimization of the edge computing environment, since computing resources are limited and widely distributed, real-time monitoring of computing resource data in the edge computing environment is particularly important. The collection method of the present invention can collect and analyze the performance data of the device on the edge node, help optimize the computing task scheduling and resource allocation of the edge node, and improve the overall performance of the edge computing system.

[0121] Thus, the present invention can detect abnormal activities or potential security threats by monitoring the operation data of the virtual machine, such as when the CPU utilization rate suddenly increases, it indicates that the virtual machine is attacked by malware. At the same time, by analyzing the operation data, the operation trend and operation mode of the system performance can be inferred to achieve data-driven decision-making and optimization, for example, historical data can be used to predict the future system load so as to expand or shrink computing resources in time. In addition, the resource allocation of the virtual machine is automatically adjusted based on the operation data to meet the demand changes in different time periods, such as increasing CPU and memory resources at high loads and releasing corresponding resources at low loads to achieve dynamic optimization of resources and cost savings. In addition, in some multi-user environments, since different users or organizations share the same set of computing resources, by monitoring and limiting the operation data of each user, it can ensure that resources are fairly allocated and utilized, and avoid interference or influence of a certain user on other users.

[0122] Please refer to Figure 3 , Embodiment 2 of the present invention is:

[0123] A terminal 100 for collecting virtual machine operation data includes a memory 101, a processor 102, and a computer program stored in the memory 101 and running on the processor 102. When the processor 102 executes the computer program, each step of a method for collecting virtual machine operation data in the first embodiment is implemented.

[0124] In summary, the present invention provides a method and terminal for collecting virtual machine operation data, configures a universal serial bus human-machine interface device at the host machine, and creates a virtual human-machine interface device corresponding to the human-machine interface device on the virtual machine, so that data interaction is achieved between the host machine and the virtual machine through the human-machine interface device, that is, the virtual machine writes real-time operation data into the human-machine interface device, and then the host machine reads the target operation data from the human-machine interface device, so there is no need to record the operation data of the virtual machine in the operation log, avoiding dependence on the operation log. At the same time, the host machine is also configured with an I2C bus device, and a virtual I2C bus device corresponding to the I2C bus device is created on the virtual machine, so that the host machine and the virtual machine can communicate through the I2C bus, ensuring high-speed data exchange between the virtual machine and the host machine, and avoiding embedding specific code or components in the virtual machine. In addition, the host machine and the monitoring system upgrade the connection to a network socket protocol connection, providing a unified data interface, which is convenient for the external system to collect data, and the original request to send data between the host machine and the monitoring system is converted into real-time sending data, improving data transmission efficiency and reducing system development and maintenance costs.

[0125] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for collecting virtual machine operation data, characterized in that: include: The virtual machine creates a virtual interactive device corresponding to the physical interactive device of the host machine, and writes the real-time running data of the virtual machine into the physical interactive device through the virtual interactive device; The virtual machine sends a collection request to the host machine through a virtual data bus in response to a monitoring instruction of the monitoring system; The host machine responds to the collection request by reading the target operation data of the virtual machine through the physical interaction device and sending an upgrade request to the monitoring system; The monitoring system upgrades the network transmission protocol to a network socket protocol in response to the upgrade request, and establishes a target connection with the host machine based on the network socket protocol; The host machine sends the target operation data to the monitoring system through the target connection; The virtual interactive devices created by the virtual machine corresponding to the physical interactive devices of the host machine include: The virtual machine obtains a first device attribute of a physical interaction device of the host machine; The virtual machine creates a virtual interactive device at the virtualization layer according to the first device attribute; The virtual machine establishes a mapping relationship with the virtual interactive device through a virtual input and output mode; Before the virtual machine responds to the monitoring instruction of the monitoring system, the method further includes: The virtual machine obtains a second device attribute of a physical data device of the host machine; The virtual machine creates a virtual data device at the virtualization layer according to the second device attribute; The virtual machine establishes a driving relationship with the virtual data device through a virtual input and output mode, so that the virtual machine communicates with the host machine through a virtual data bus; The host machine responds to the acquisition request and reads the target operation data of the virtual machine through the physical interaction device, including: The host machine, in response to the acquisition request, obtains a data template corresponding to the acquisition request, and determines a virtual interactive device corresponding to the virtual machine according to the acquisition request; The host machine reads target operation data from real-time operation data of a physical interactive device corresponding to the virtual interactive device according to the data template; The virtual data bus includes a virtual I2C bus, and the physical interaction device includes a human-machine interface device of a universal serial bus.

2. The method for collecting virtual machine operation data according to claim 1, characterized in that: The host machine sending an upgrade request to the monitoring system includes: The host machine sends an upgrade request to the monitoring system via the network transmission protocol; Before the monitoring system upgrades the network transmission protocol to the network socket protocol, it also includes: The monitoring system detects whether the current network supports the network socket protocol; If yes, the monitoring system upgrades the network transmission protocol to a network socket protocol; Otherwise, the monitoring system maintains the communication connection of the current network transmission protocol.

3. The method for collecting virtual machine operation data according to claim 1, characterized in that: The host machine sending the target operation data to the monitoring system through the target connection includes: The host machine converts the format of the target operation data into a target format corresponding to the network socket protocol, and sends the target operation data converted into the target format to the monitoring system through the target connection.

4. The method for collecting virtual machine operation data according to claim 1, characterized in that: The virtual machine establishing a driving relationship with the virtual data device through a virtual input and output method includes: The virtual machine converts the simulated interaction operation of the virtual data device into the physical interaction operation of the physical data device through the virtualization layer, so that the virtual machine drives the physical data device through the virtual data device.

5. The method for collecting virtual machine operation data according to claim 1, characterized in that: The virtual machine writes the real-time operation data into the physical interaction device through the virtual interaction device, including: The virtual machine obtains virtual interface information of the virtual interactive device; The virtual machine writes the real-time running data into the virtual interactive device through the virtual interface information, so that the virtual machine converts the write operation on the virtual interactive device into the write operation on the physical interactive device through the virtualization layer.

6. A terminal for collecting virtual machine operation data, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, each step in a method for collecting virtual machine operation data as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method, device and equipment for collecting GPU (Graphics Processing Unit) performance data of virtual machine

    CN114116393A

  • Virtual machine management method and related device

    CN117539588A