Electric quantity value display method and device, storage medium and electronic equipment
Through the BMC connection with the USB interface of the server host, USB Gadget driver is used to calculate the health of each server component and send the power value, which solves the problem of lack of real-time and intuitive server health prompts in the existing technology, and realizes real-time monitoring and intuitive display of server health.
Patent Information
- Application Number
- CN202510031045.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-01-08
AI Technical Summary
The prior art lacks a real-time, intuitive server health prompt method that does not require additional software environments, and cannot understand server status in real time.
Connect to the server host through the USB interface through the baseboard management controller (BMC). Use USB Gadget driver to obtain the operating data of each server component, calculate the health of each component and determine the overall health of the server. Send the power value to the server through the USB interface, so that it can display the health through the target icon.
Real-time monitoring and intuitive display of server health is realized, without the need for active user query, and improves the efficiency and user experience of server management.
Smart Images

Figure CN119988133A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and specifically, to a method and device for displaying a power value, a storage medium, and an electronic device. Background Art
[0002] With the rapid development of Internet services, the demand for servers in various industries is gradually increasing, so the widespread application of servers is imperative. Servers are generally in long-term operation, and many of their peripherals such as CPU, memory, hard disk and other devices are also powered on for a long time. Therefore, monitoring these peripherals and evaluating the health of the entire server is a very meaningful task.
[0003] The work of monitoring servers is generally undertaken by the Baseboard Management Controller (BMC) system. Usually, the BMC system will actively report alarm logs and provide WebUI client software for users to actively query to view the running status of the server and the health of each component. The method of collecting active alarm logs to determine the health of the server is generally used in application scenarios with a large number of servers. The WebUI also requires users to actively query, and it is impossible to know the server status in real time.
[0004] Regarding related technologies, users are required to actively log in to client software such as WebUI to query the server status. There is a lack of a real-time, intuitive server health prompt method that does not require an additional software environment. No effective solution has been proposed yet.
[0005] Therefore, it is necessary to improve the related technology to overcome the above-mentioned defects in the related technology. Summary of the invention
[0006] The embodiments of the present application provide a method and device for displaying power values, a storage medium, and an electronic device to at least solve the problem in the related art that there is a lack of a real-time, intuitive server health prompt method that does not require an additional software environment.
[0007] According to one embodiment of the present application, a method for displaying a power value is provided, comprising: a baseboard management controller applied to a server, the baseboard management controller being connected to a host of the server via a USB interface, wherein the baseboard management controller comprises: a USB Gadget driver, comprising: obtaining operation data of multiple components of the server, and determining the health of each component according to the operation data of each component; determining the health of the server according to the health of each component; controlling the USB Gadget driver to determine the power value of a battery device according to the health, and sending the power value to the server via the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health, and the USB Gadget driver is used to simulate the battery device.
[0008] In an exemplary embodiment, controlling the USB Gadget driver to determine the power value of the battery device according to the health includes: determining a mapping relationship between the health and the power value; and controlling the USB Gadget driver to map the health to the power value according to the mapping relationship.
[0009] In an exemplary embodiment, before obtaining the operating data of multiple components of the server, the method further includes: configuring a device descriptor of the battery device in the framework of the USB Gadget driver, wherein the device descriptor of the battery device includes: a description of the battery function; when the baseboard management controller is connected to the host of the server via a USB interface, sending the device descriptor of the battery device to the server via the USB interface, so that the server loads a target icon corresponding to the battery device according to the device descriptor.
[0010] In an exemplary embodiment, determining the health of the server according to the health of each component includes: determining a weight value of each component; and determining the health of the server according to the weight value and the health of each component.
[0011] In an exemplary embodiment, determining the weight value of each component includes at least one of the following: determining the weight value of each component according to the hardware configuration of the server; determining the weight value of each component according to the application scenario of the server; determining the weight value of each component according to the operating status of each component.
[0012] In an exemplary embodiment, when the multiple components include: a central processing unit, a hard disk, and a memory, determining the health of each component according to the operating data of each component includes: determining a first duration that the temperature of the central processing unit is greater than a first temperature threshold, and determining a first ratio of the first duration to the operating time of the central processing unit; determining a second duration that the load utilization of the central processing unit is greater than a load utilization threshold, and determining a second ratio of the second duration to the operating time of the central processing unit; determining a first level of the number of alarm data of the central processing unit, and determining a second level of the operating time; determining the health of the central processing unit according to the first ratio, the second ratio, the first level, and the second level;
[0013] Acquire monitoring data of the hard disk, determine the matching degree of the monitoring data with standard monitoring data; determine a third level of the read and write speed of the hard disk, a fourth level of the usage time of the hard disk, and a fifth level of the number of alarm data of the hard disk; determine the health of the hard disk according to the matching degree, the third level, the fourth level and the fifth level;
[0014] Determine a third duration during which the temperature of the memory is greater than a second temperature threshold, and determine a third ratio of the third duration to the running time of the memory; determine the error rate and the usage frequency of the memory; determine the health of the memory based on the third ratio, the error rate and the usage frequency.
[0015] In an exemplary embodiment, obtaining the operating data of multiple components of the server includes at least one of the following: obtaining the operating data of the central processing unit of the server through the PECI interface; obtaining the operating data of the hard disk and memory of the server through the I2C interface; parsing IPM I commands through the KCS interface to obtain the alarm data reported by the server, and determining the operating data of multiple components of the server based on the alarm data.
[0016] According to another embodiment of the present application, a device for displaying a power value is provided, comprising: a first determination module, used to obtain operating data of multiple components of the server, and determine the health of each component based on the operating data of each component; a second determination module, used to determine the health of the server based on the health of each component; a control module, used to control the USB Gadget driver to determine the power value of a battery device based on the health, and send the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health, and the USB Gadget driver is used to simulate the battery device.
[0017] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0018] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0019] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0020] Through this application, the operation data of multiple components of the server are obtained, and the health of each component is determined according to the operation data of each component; the health of the server is determined according to the health of each component; the USB Gadget driver is controlled to determine the power value of the battery device according to the health, and the power value is sent to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health, and the USB Gadget driver is used to simulate the battery device. That is, in an embodiment of the present application, the health of each component is calculated according to the data of each component of the server, and the total health of the server is calculated. The battery function is enumerated through the USB Gadget driver, so that the server can intuitively display the power value through the target icon, thereby reflecting the health of the server. Therefore, the problem of lacking a real-time, intuitive server health prompt method that does not require an additional software environment can be solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a hardware structure block diagram of a server device of a method for displaying a power value in an embodiment of the present application;
[0022] Figure 2 is a flow chart of a method for displaying a power value according to an embodiment of the present application;
[0023] Figure 3 It is a system block diagram of BMC and host (HOST) in the related art;
[0024] Figure 4 It is an actual physical block diagram of a system application in which a BMC uses a USB Gadget battery function to prompt a server health status according to an embodiment of the present application;
[0025] Figure 5 It is a software flow chart of the BMC data acquisition module of the embodiment of the present application;
[0026] Figure 6 is a software flow chart of the BMC data analysis module of the embodiment of the present application;
[0027] Figure 7 4 is a structural block diagram of a device for displaying a power value according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0030] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a method for displaying a power value in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0031] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for displaying the power value in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0032] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0033] In this embodiment, a method for displaying a power value is provided, which is applied to a baseboard management controller of a server, wherein the baseboard management controller is connected to a host of the server via a USB interface, wherein the baseboard management controller includes: a USB Gadget driver, Figure 2 is a flow chart of a method for displaying a power value according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0034] Step S202, obtaining operation data of multiple components of the server, and determining the health of each component according to the operation data of each component;
[0035] Step S204, determining the health of the server according to the health of each component;
[0036] Step S206, controlling the USB Gadget driver to determine the power value of the battery device according to the health status, and sending the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health status, and the USB Gadget driver is used to simulate the battery device.
[0037] Through the above steps, the operation data of multiple components of the server are obtained, and the health of each component is determined according to the operation data of each component; the health of the server is determined according to the health of each component; the USB Gadget driver is controlled to determine the power value of the battery device according to the health, and the power value is sent to the server through the USB interface, so that the server displays the power value through the target icon, wherein the power value is used to indicate the health, and the USB Gadget driver is used to simulate the battery device. That is, in an embodiment of the present application, the health of each component is calculated according to the data of each component of the server, and the total health of the server is calculated. The battery function is enumerated through the USB Gadget driver, so that the server can intuitively display the power value through the target icon, thereby reflecting the health of the server. Therefore, the problem of lacking a real-time, intuitive server health prompt method that does not require an additional software environment can be solved.
[0038] Optionally, in order to better understand the above step S206, the above step S206 can be implemented in the following manner:
[0039] Determine a mapping relationship between the health status and the power value; and control the USB Gadget driver to map the health status to the power value according to the mapping relationship.
[0040] The embodiment of the present application converts the abstract server health into an intuitive power display, as follows:
[0041] First, you need to define the evaluation range of server health. For example, health may be a value from 0 to 100, where 0 means the server is completely unhealthy and 100 means the server is very healthy.
[0042] Defines the range of battery value for a battery device. For example, the battery value is usually from 0% to 100%, where 0% means the battery is exhausted and 100% means the battery is full.
[0043] The mapping relationship between health and power value is usually a linear or nonlinear function relationship, or a more complex nonlinear relationship. The above mapping relationship should ensure that the decrease in health is proportional to the decrease in power displayed, so that users can intuitively understand the health status of the server.
[0044] By calling the interface of the USB Gadget driver (for example, the ioctl interface), the calculated health value is passed to the driver, and the logic of the mapping relationship is implemented inside the driver.
[0045] Through the above embodiments, the invention realizes real-time monitoring and intuitive display of server health, providing users with convenient maintenance and management means, especially in the use scenario of a small number of servers, without the need for additional software environment or active query operations, greatly improving user experience and server management efficiency.
[0046] Optionally, before obtaining the operating data of multiple components of the server, it also includes: configuring a device descriptor of the battery device in the framework of the USB Gadget driver, wherein the device descriptor of the battery device includes: a description of the battery function; when the baseboard management controller is connected to the host of the server through a USB interface, sending the device descriptor of the battery device to the server through the USB interface, so that the server loads a target icon corresponding to the battery device according to the device descriptor.
[0047] It should be noted that the device descriptor configuration device descriptor in the USB Gadget driver framework is important information used by the host to identify the device type, function and configuration when the USB device communicates with the host. In this application, the configured battery device descriptor not only contains basic USB device information, but also specifically includes a description of the battery function. By setting these descriptors in the USBGadget driver, it can be ensured that the device is correctly identified by the host operating system as a general USB device with battery function.
[0048] When the BMC is connected to the server's host through the USB interface, it will actively send the device descriptor to the host. This is the first step in establishing communication between the USB device and the host. With the correct device descriptor, the host can recognize that this is a device with battery function and is ready to receive subsequent power information.
[0049] After receiving the device descriptor, the server's host operating system will load the corresponding battery icon based on the information in the descriptor, which is usually displayed in the operating system's user interface. Regardless of which operating system the user is using (such as Windows, Linux, etc.), as long as the system supports the identification and display of USB devices, the battery icon can be seen, providing users with an intuitive way to understand the health of the server.
[0050] The embodiments of the present application achieve the convenience of not requiring users to actively query, thereby improving the efficiency of server management and user experience.
[0051] Optionally, determining the health of the server according to the health of each component includes: determining a weight value of each component; and determining the health of the server according to the weight value and the health of each component.
[0052] The embodiment of the present application is based on the health of each key component of the server, and by assigning different weight values to these components to reflect their influence on the overall operation status of the server. The details are as follows:
[0053] Identify and quantify the contribution or impact of different components in a server to the overall health. For example, in a server, components such as the CPU, memory, hard disk, and fan have different degrees of impact on the stability and performance of the server. Therefore, these components may be given different weight values when evaluating the health of the server. Each component is assigned a weight value, which is combined with the health of the component to calculate the overall health of the server.
[0054] The calculation method may be to multiply the health of each component by its corresponding weight value, then add up all the products, and finally normalize the sum to obtain a health score within a specific range (eg, 0 to 100).
[0055] For example, “total health = (CPU health*CPU weight value + hard disk health*hard disk weight value + memory health*memory weight value + …) / total weight value”.
[0056] This application is an embodiment that provides a more comprehensive and refined server health assessment solution, which not only takes into account the health status of each component, but also takes into account their relative importance in the server, so as to more accurately reflect the actual operation status of the server. In practical applications, this method can help operation and maintenance personnel quickly locate problem components and perform maintenance and upgrades in a timely manner to maintain high availability and performance of the server.
[0057] In the embodiments of the present application, multiple methods for determining the weight value of each component are provided, including at least one of the following:
[0058] 1) Determining the weight value of each component according to the hardware configuration of the server;
[0059] Different hardware may have different degrees of impact on the overall performance of the server. For example, for a server configured with a high-performance CPU and a large amount of memory, the health of the CPU and memory may have a greater impact on the overall health, while the health weight of the hard disk is relatively low. Conversely, if the server is mainly used for storage, the health weight of the hard disk should be higher. Evaluation mechanism: The importance of hardware configuration can be automatically evaluated by defining a set of rules. For example, if the number of CPU cores of the server exceeds a certain threshold, the CPU health weight can be increased; if the total amount of memory reaches a certain level, the memory health weight can be increased; for storage servers, if the number or capacity of hard disks reaches a certain level, the hard disk health weight can be increased.
[0060] 2) Determining the weight value of each component according to the application scenario of the server;
[0061] Different application scenarios have different requirements for server hardware. For example, for compute-intensive applications, the performance and health of the CPU are particularly important; while for data-intensive applications, the stability of the hard disk and network may be more critical. Scenario recognition algorithm: Develop an algorithm to identify the main application scenarios of the server. This can be achieved by analyzing indicators such as the type of software applications on the server, the utilization of the CPU and hard disk, and network traffic. Once the application scenario is identified, the health weights of each component can be adjusted accordingly.
[0062] 3) Determining a weight value of each component according to the operating status of each component;
[0063] During server operation, hardware usage will change over time. Therefore, the dynamic weight adjustment strategy should include real-time monitoring of hardware usage and dynamically adjust the weight according to the current hardware load. Real-time monitoring system: BMC can monitor the load and performance of each component of the server in real time, such as CPU usage, hard disk read and write speed, memory occupancy, etc. If an abnormal usage or performance indicator of a component is detected, the health weight of the component can be temporarily increased to more accurately reflect the current server health status.
[0064] For example, suppose the server is equipped with a high-performance CPU, large-capacity memory, and multiple hard disks, and its main application scenario is data analysis. Initially, you can set the CPU weight to 0.3, the memory weight to 0.4, and the hard disk weight to 0.3. During operation, if the CPU usage rate continues to exceed 80%, you can temporarily adjust the CPU weight to 0.4 to more accurately reflect the health status of the server under high computing load.
[0065] Dynamically adjusting the health weights of components such as the CPU, hard disk, and memory needs to be based on the server's hardware configuration, application scenarios, real-time monitoring, and user feedback. By properly designing and implementing the above strategies, the accuracy and practicality of server health assessment can be improved, providing users with more accurate server status information.
[0066] In an exemplary embodiment, when the multiple components include: a central processing unit, a hard disk, and a memory, determining the health of each component according to the operating data of each component includes: determining a first duration that the temperature of the central processing unit is greater than a first temperature threshold, and determining a first ratio of the first duration to the operating time of the central processing unit; determining a second duration that the load utilization of the central processing unit is greater than a load utilization threshold, and determining a second ratio of the second duration to the operating time of the central processing unit; determining a first level of the number of alarm data of the central processing unit, and determining a second level of the operating time; determining the health of the central processing unit according to the first ratio, the second ratio, the first level, and the second level;
[0067] In other words, the CPU health is calculated as follows:
[0068] 1) Temperature monitoring: The normal operating temperature of the CPU is between 50-80℃. Exceeding this range may indicate overheating. You can set a temperature threshold, such as exceeding 80℃ as a warning state, and calculate the percentage of the duration exceeding the threshold to the total time to evaluate the health.
[0069] 2) Load monitoring: CPU load is usually measured by utilization. Long-term high load may affect the life of the CPU. You can set a load threshold, such as more than 80% for high load, and also calculate the percentage of high load duration in the total time.
[0070] 3) Alarm data: CPU error reports, such as checksum errors, clock errors, etc. You can set a threshold for the number of errors. If the threshold is exceeded, the health level will be reduced.
[0071] 4) Running time: A CPU that runs for a long time may face more wear and tear, and the degree of aging can be calculated by the total running time.
[0072] The above indicators are weighted according to their importance, and then a health score of 0 to 100 is calculated comprehensively.
[0073] Acquire monitoring data of the hard disk, determine the matching degree of the monitoring data with standard monitoring data; determine a third level of the read and write speed of the hard disk, a fourth level of the usage time of the hard disk, and a fifth level of the number of alarm data of the hard disk; determine the health of the hard disk according to the matching degree, the third level, the fourth level and the fifth level;
[0074] The above monitoring data may be SMART data. The SMART data of the hard disk includes various health information of the hard disk, such as error rate, number of remapped sectors, rotation time, etc.
[0075] In other words, the indicators that affect the health of the hard disk are:
[0076] 1) Monitor data and set thresholds for various indicators. If the thresholds are exceeded, the health level will be reduced;
[0077] 2) Read and write speed: monitor the hard disk's read and write speed, compare it with the standard speed, and set the speed drop threshold;
[0078] 3) Usage time: The usage time of the hard disk will also affect its health. Set a life threshold. If it exceeds the threshold, the health will be affected.
[0079] 4) Warning data: Hard disk error records, such as the number of bad sectors, can set a threshold, exceeding which reduces health.
[0080] Determine a third duration during which the temperature of the memory is greater than a second temperature threshold, and determine a third ratio of the third duration to the running time of the memory; determine the error rate and the usage frequency of the memory; determine the health of the memory based on the third ratio, the error rate and the usage frequency.
[0081] In other words, the memory health is calculated as:
[0082] 1) Error rate: Monitor the memory error rate, including ECC check errors, and set the error rate threshold.
[0083] 2) Temperature monitoring: Memory also has a temperature threshold. Too high a temperature may cause data loss or performance degradation.
[0084] 3) Frequency of use: High frequency of use will cause certain wear and tear on the memory. The frequency of use over a period of time can be calculated and a threshold can be set.
[0085] Optionally, obtaining the operating data of multiple components of the server includes at least one of the following: obtaining the operating data of the central processing unit of the server through the PECI interface; obtaining the operating data of the hard disk and memory of the server through the I2C interface; parsing IPM I commands through the KCS interface to obtain the alarm data reported by the server, and determining the operating data of multiple components of the server based on the alarm data.
[0086] It should be noted that PECI (Platform Environment Control Interface) is an efficient, low-latency communication protocol, mainly used for BMC to communicate with the CPU on the server. Through the PECI interface, the BMC can obtain key indicators such as CPU temperature, voltage, frequency, power usage, etc. in real time. These data are crucial for evaluating the operating status and health of the CPU.
[0087] I2C (Inter-Integrated Circuit) is a bidirectional two-wire serial bus protocol used for communication between microcontrollers and peripheral devices. In a server environment, I2C can be used to monitor and manage various hardware devices, such as hard disks, memory, power management modules, etc. Through the I2C interface, the BMC can collect data such as hard disk temperature, rotation speed, SMART status, and memory temperature, usage, error count, etc. This data is critical for determining the health of hard disks and memory, and can help identify potential hardware failures.
[0088] KCS (Keyboard Controller Style) is one of the communication methods defined in the IPMI (Intelligent Platform Management Interface) specification, which is used for simple polling communication between BMC and IPMI host. IPMI commands are usually used for remote monitoring and management of servers. By parsing these commands through the KCS interface, BMC can obtain alarm data actively reported by the server, including but not limited to system failure, resource exhaustion, overtemperature, power supply abnormality, etc. These alarm data can provide instant feedback on the overall health of the server, help quickly identify and locate problems, and are another important data source for server health assessment.
[0089] In the embodiment of the present application, the operating data of the CPU, hard disk, memory and the alarm data of the server obtained by BMC through PECI, I2C and KCS interfaces constitute the basis for a comprehensive assessment of the health status of the server. The collection and analysis of these data can help users understand the status of the server in real time and take timely measures to prevent or solve potential problems.
[0090] In order to better understand the process of the above-mentioned method for displaying the power value, the implementation method flow of the above-mentioned display of the power value is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.
[0091] In the related technology, active log reporting of the BMC system is used, such as SNMP, SMTP, Syslog, or the monitoring system software of each component developed by the BMC system developer, and the customer can actively query the server health through WebUI or other client software. Figure 3 shown.
[0092] Based on the solutions in the related art, it is necessary to actively log in to the client UI software to query the server health status. Therefore, there is a lack of a real-time, intuitive and server health prompt method that does not require an additional software environment. In this embodiment, a method for displaying power values is provided, which is applied to Figure 4 The system shown, Figure 4 This is an actual physical block diagram of a system application in which the BMC uses the USB Gadget battery function to prompt the server health status according to an embodiment of the present application, as follows:
[0093] The system in the embodiment of the present application mainly has three implementation modules, including:
[0094] 1.USB Gadget drives battery function enumeration and battery power setting module:
[0095] BMC uses the USB gadget driver to implement the battery function through the USB interface with the host, so that a battery device can be enumerated under the host's OS. The USB gadget driver enumerates devices according to the standard protocol specified by USB, so the battery device enumerated under the host can be displayed normally under any operating system.
[0096] Implement the function of setting the battery power in the USB Gadget driver, so that the battery power can be displayed accordingly under the Host OS.
[0097] Implement the ioctl interface and provide the application layer data analysis module with an interface for setting the battery power of the USB Gadget.
[0098] 2.BMC real-time collection of Host component data module:
[0099] The detailed flow chart of the data acquisition module software is as follows: Figure 5 As shown, the details are as follows:
[0100] Step 1: The BMC collects various data of the server CPU in real time through the PECI interface.
[0101] Step 2: The BMC collects data about the server's fans, hard disks, and other devices in real time through the I2C interface.
[0102] Step 3: The BMC parses the IPMI command through the KCS interface to obtain the alarm data actively reported by the server.
[0103] Step 4: Classify and save the collected data into the BMC cache for use by the data analysis module.
[0104] 3.Host component data analysis module:
[0105] The detailed flow chart of the data analysis module software is as follows: Figure 6 As shown, the details are as follows:
[0106] Step 1: The data analysis module obtains data of various server components from the collected data cache in real time.
[0107] Step 2: Use the data of each component (CPU, hard disk, memory, IPMI) and its corresponding dedicated algorithm to calculate the health of each component.
[0108] Step 3: Based on the health of each component calculated over a period of time, use a comprehensive algorithm to calculate the health of the server. For example, the formula is as follows (the health algorithm for each component may be different, and the total health percentage may also be different):
[0109] Total health = ((CPU health * 0.2 + hard disk health * 0.5 + memory health * 0.3) * 100)%;
[0110] Step 4: Use the interface provided by the USB Gadget driver to set the battery function power according to the calculated total health.
[0111] The embodiment of the present application proposes a method for BMC to use USB Gadget driver to enumerate the battery (Battery) function to prompt the health of the server. The BMC system generally provides a hardware interface of USB Device in the hardware connection with the Host. This USB interface is usually used when the BMC uses the keyboard, video or mouse (Keyboard Video Mouse, referred to as KVM) port and virtual media function. The embodiment of the present application uses this USB interface to use the BMC to use the USBGadget driver to enumerate the battery (Battery) function, so that when the Host detects the USB connection, a battery device can be enumerated and displayed under the operating system of the Host through the USB interface, and a battery icon can be seen under the UI of the operating system (Operating System, referred to as OS); at the same time, the BMC synchronously monitors the data of each component of the Host and analyzes it, calculates the health of the server under the corresponding algorithm, and then sets the battery power enumerated by the USB Gadget driver to indicate the health of the server, so that the user can judge the health of the server by the battery power under the human-computer interaction interface (UI) of the OS, and use the low power alarm prompt of the OS to warn the user that there is a problem with the server, so that the user can make corresponding processing in time.
[0112] Through the embodiments of the present application, it is possible to enumerate common battery devices under any operating system without relying on the operating system on the host side, thus eliminating the need for users to install other software environments; prompts can be actively displayed on the operating system interface used by users, and an alarm function can be provided to avoid users logging into the client software to query.
[0113] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0114] In this embodiment, a display device for the value of electric quantity is also provided, and the device is used to implement the above-mentioned embodiment and preferred implementation mode, and the descriptions which have been made are omitted. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0115] Figure 7 is a structural block diagram of a device for displaying a power value according to an embodiment of the present application, such as Figure 7 As shown, the device comprises:
[0116] A first determination module 72, configured to obtain operation data of multiple components of the server, and determine the health of each component according to the operation data of each component;
[0117] A second determination module 74, configured to determine the health of the server according to the health of each component;
[0118] The control module 76 is used to control the USB Gadget driver to determine the power value of the battery device according to the health status, and send the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health status, and the USB Gadget driver is used to simulate the battery device.
[0119] Through the above-mentioned device, the operation data of multiple components of the server are obtained, and the health of each component is determined according to the operation data of each component; the health of the server is determined according to the health of each component; the USB Gadget driver is controlled to determine the power value of the battery device according to the health, and the power value is sent to the server through the USB interface, so that the server displays the power value through the target icon, wherein the power value is used to indicate the health, and the USB Gadget driver is used to simulate the battery device. That is, in an embodiment of the present application, the health of each component is calculated according to the data of each component of the server, and the total health of the server is calculated. The battery function is enumerated through the USB Gadget driver, so that the server can intuitively display the power value through the target icon, thereby reflecting the health of the server. Therefore, the problem of lacking a real-time, intuitive server health prompt method that does not require an additional software environment can be solved.
[0120] In an exemplary embodiment, the control module 76 is used to determine a mapping relationship between the health level and the power value; and control the USB Gadget driver to map the health level to the power value according to the mapping relationship.
[0121] In an exemplary embodiment, the above-mentioned device also includes: a configuration module, which is used to configure the device descriptor of the battery device in the framework of the USB Gadget driver, wherein the device descriptor of the battery device includes: a description of the battery function; when the baseboard management controller is connected to the host of the server through a USB interface, the device descriptor of the battery device is sent to the server through the USB interface, so that the server loads the target icon corresponding to the battery device according to the device descriptor.
[0122] In an exemplary embodiment, the second determination module 74 is used to determine the weight value of each component; and determine the health of the server according to the weight value and the health of each component.
[0123] In an exemplary embodiment, the second determination module 74 is used to perform at least one of the following: determining the weight value of each component according to the hardware configuration of the server; determining the weight value of each component according to the application scenario of the server; determining the weight value of each component according to the operating status of each component.
[0124] In an exemplary embodiment, when the multiple components include: a central processing unit, a hard disk, and a memory, the first determination module 72 is used to determine a first duration that the temperature of the central processing unit is greater than a first temperature threshold, and determine a first ratio of the first duration to the running time of the central processing unit; determine a second duration that the load utilization of the central processing unit is greater than a load utilization threshold, and determine a second ratio of the second duration to the running time of the central processing unit; determine a first level of the number of alarm data of the central processing unit, and determine a second level of the running time; determine the health of the central processing unit according to the first ratio, the second ratio, the first level, and the second level;
[0125] Acquire monitoring data of the hard disk, determine the matching degree of the monitoring data with standard monitoring data; determine a third level of the read and write speed of the hard disk, a fourth level of the usage time of the hard disk, and a fifth level of the number of alarm data of the hard disk; determine the health of the hard disk according to the matching degree, the third level, the fourth level and the fifth level;
[0126] Determine a third duration during which the temperature of the memory is greater than a second temperature threshold, and determine a third ratio of the third duration to the running time of the memory; determine the error rate and the usage frequency of the memory; determine the health of the memory based on the third ratio, the error rate and the usage frequency.
[0127] In an exemplary embodiment, the first determination module 72 is used to perform at least one of the following: obtaining the operating data of the central processing unit of the server through the PECI interface; obtaining the operating data of the hard disk and memory of the server through the I2C interface; parsing the IPM I command through the KCS interface to obtain the alarm data reported by the server, and determining the operating data of multiple components of the server based on the alarm data.
[0128] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0129] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0130] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0131] S1, obtaining operation data of multiple components of the server, and determining the health of each component according to the operation data of each component;
[0132] S2, determining the health of the server according to the health of each component;
[0133] S3, controlling the USB Gadget driver to determine the power value of the battery device according to the health status, and sending the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health status, and the USB Gadget driver is used to simulate the battery device.
[0134] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0135] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0136] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0137] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0138] S1, obtaining operation data of multiple components of the server, and determining the health of each component according to the operation data of each component;
[0139] S2, determining the health of the server according to the health of each component;
[0140] S3, controlling the USB Gadget driver to determine the power value of the battery device according to the health status, and sending the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health status, and the USB Gadget driver is used to simulate the battery device.
[0141] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0142] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0143] An embodiment of the present application also provides a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any one of the above method embodiments.
[0144] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0145] S1, obtaining operation data of multiple components of the server, and determining the health of each component according to the operation data of each component;
[0146] S2, determining the health of the server according to the health of each component;
[0147] S3, controlling the USB Gadget driver to determine the power value of the battery device according to the health status, and sending the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health status, and the USB Gadget driver is used to simulate the battery device.
[0148] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0149] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0150] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for displaying a power value, characterized in that: A baseboard management controller applied to a server, wherein the baseboard management controller is connected to a host of the server via a USB interface, wherein the baseboard management controller comprises: a USB Gadget driver, including: Acquire operation data of multiple components of the server, and determine the health of each component according to the operation data of each component; Determining the health of the server according to the health of each component; Control the USB Gadget driver to determine the power value of the battery device according to the health status, and send the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health status, and the USB Gadget driver is used to simulate the battery device.
2. The method according to claim 1, characterized in that Controlling the USB Gadget driver to determine the power value of the battery device according to the health level includes: Determine a mapping relationship between the health level and the power value; Control the USB Gadget driver to map the health status to the power value according to the mapping relationship.
3. The method according to claim 1, characterized in that Before obtaining the operating data of the plurality of components of the server, the method further includes: The device descriptor of the battery device is configured in the framework of the USB Gadget driver, wherein the device descriptor of the battery device includes: a description of the battery function; When the baseboard management controller is connected to the host of the server through a USB interface, the device descriptor of the battery device is sent to the server through the USB interface, so that the server loads the target icon corresponding to the battery device according to the device descriptor.
4. The method according to claim 1, characterized in that Determining the health of the server according to the health of each component includes: Determining a weight value of each component; The health of the server is determined according to the weight value and the health of each component.
5. The method according to claim 4, characterized in that Determining the weight value of each component includes at least one of the following: Determining a weight value of each component according to the hardware configuration of the server; Determining a weight value of each component according to an application scenario of the server; The weight value of each component is determined according to the operating status of each component.
6. The method according to claim 1, characterized in that In the case where the multiple components include: a central processing unit, a hard disk, and a memory, determining the health of each component according to the operation data of each component includes: Determine a first duration that the temperature of the central processing unit is greater than a first temperature threshold, and determine a first ratio of the first duration to an operating time of the central processing unit; Determine a second duration during which the load utilization of the central processing unit is greater than a load utilization threshold, and determine a second ratio of the second duration to the running time of the central processing unit; Determine a first level of the amount of alarm data of the central processing unit, and determine a second level of the running time; determine the health of the central processing unit according to the first proportion, the second proportion, the first level, and the second level; Acquire monitoring data of the hard disk, and determine the matching degree between the monitoring data and standard monitoring data; Determining a third level of the read / write speed of the hard disk, a fourth level of the usage time of the hard disk, and a fifth level of the amount of warning data of the hard disk; determining the health of the hard disk according to the matching degree, the third level, the fourth level, and the fifth level; Determine a third duration during which the temperature of the memory is greater than a second temperature threshold, and determine a third ratio of the third duration to the operating time of the memory; determining an error rate and a frequency of use of said memory; The health of the memory is determined according to the third proportion, the error rate, and the usage frequency.
7. The method according to claim 1, characterized in that Obtaining operation data of multiple components of the server includes at least one of the following: Obtaining the operation data of the central processing unit of the server through the PECI interface; Obtaining the operating data of the hard disk and memory of the server through the I2C interface; The IPMI command is parsed through the KCS interface to obtain the alarm data reported by the server, and the operation data of multiple components of the server are determined according to the alarm data.
8. A display device for electric quantity value, characterized in that: include: A first determination module, configured to obtain operation data of multiple components of the server, and determine the health of each component according to the operation data of each component; The second determination module is used to determine the health of the server according to the health of each component; the control module is used to control the USB Gadget driver to determine the power value of the battery device according to the health, and send the power value to the server through the USB interface, so that the server displays the power value through a target icon, wherein the power value is used to indicate the health, and the USB Gadget driver is used to simulate the battery device.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Energy management method and device based on neural network
CN116405933A
Server host log collection method, device and equipment and medium
CN117331782A
Joint estimation method, device and equipment for electric quantity and health degree of battery and medium
CN117388711A
Monitor System and Monitor Method
TW201624407A
Techniques of monitoring and updating system component health status
US20190171507A1
Cited By
Health degree monitoring method and device of server storage system, server and medium
CN120448223A
Method, device, server and medium for monitoring health of server storage system
CN120448223B