Data acquisition method and device, equipment and storage medium
By obtaining server attribute information and obtaining power consumption information using a command format that complies with the first protocol, the problem of low power consumption accuracy in the IPMI protocol is solved, and higher precision data acquisition is achieved.
Patent Information
- Application Number
- CN202410064568.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-16
- Publication Date
- 2025-07-18
AI Technical Summary
The power consumption acquisition commands of the existing IPMI protocol specifications have data format limitations, resulting in low server power consumption information accuracy.
By obtaining the attribute information of the server, sending the first command to the BMC using the command format that follows the first protocol, receiving and parsing the power consumption information returned by the BMC, avoiding data format limitations and improving data acquisition accuracy.
Improve the accuracy of server power consumption information and data acquisition efficiency, and avoid data loss due to data format limitations.
Smart Images

Figure CN120336108A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and in particular, to a data acquisition method, apparatus, device, and storage medium. Background Art
[0002] The Intelligent Platform Management Interface (IPMI) specification is a standard for defining a set of common computer system interfaces, and users can use IPMI to monitor the operating status of a server and manage the system.
[0003] In related technologies, there is an open-source IPMI protocol in a server, which is used to standardize the interface for a computer operating system to access the hardware status of the server. Based on the power management part of the IPMI protocol, the operating system provides an ipmi-sensor tool for obtaining the hardware power of the server. The ipmi-sensor tool uses the power consumption acquisition command specified in the IPMI protocol to collect the power consumption of the server.
[0004] However, due to the limitations of the data format obtained by the power consumption acquisition command specified in the above IPMI protocol, the accuracy of the power consumption of the collected server is relatively low. Summary of the Invention
[0005] Embodiments of this application provide a data acquisition method, apparatus, device, and storage medium. The technical solutions are as follows:
[0006] According to one aspect of the embodiments of this application, a data acquisition method is provided. The method is executed by a first tool configured in a server, and the method includes:
[0007] Obtain the attribute information of the server;
[0008] According to the attribute information of the server, obtain a first command, where the first command is used to obtain the power consumption information of the server, and the first command follows the command format of the power consumption acquisition command defined by a first protocol. The first protocol is used to standardize the command format of each command and the data format of the data returned by each command. The power consumption acquisition command is a command defined by the first protocol for obtaining the power consumption information of the server;
[0009] Send the first command to a Baseboard Management Controller (BMC) in the server;
[0010] Receive the power consumption information of the server returned by the BMC. The power consumption information of the server is the information obtained by parsing the power consumption data returned by the BMC, and the power consumption data does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol.
[0011] According to one aspect of the embodiments of the present application, a data acquisition device is provided. The device includes:
[0012] An information acquisition module, configured to acquire the attribute information of the server;
[0013] A command acquisition module, configured to acquire a first command according to the attribute information of the server. The first command is used to acquire the power consumption information of the server. The first command follows the command format of the power consumption acquisition command defined by the first protocol. The first protocol is used to standardize the command formats of each command and the data formats of the data returned by each command. The power consumption acquisition command is a command defined by the first protocol for acquiring the power consumption information of the server;
[0014] A command sending module, configured to send the first command to the baseboard management controller BMC in the server;
[0015] An information receiving module, configured to receive the power consumption information of the server returned by the BMC. The power consumption information of the server is the information obtained by parsing the power consumption data returned by the BMC, and the power consumption data does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol.
[0016] According to one aspect of the embodiments of the present application, a server is provided. The server includes a processor and a memory. A computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above data acquisition method.
[0017] According to one aspect of the embodiments of the present application, a computer-readable storage medium is provided. A computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the above data acquisition method.
[0018] According to one aspect of the embodiments of the present application, a computer program product is provided. The computer program product includes a computer program, and the computer program is loaded and executed by a processor to implement the above data acquisition method.
[0019] The technical solution provided by the embodiments of the present application can bring the following beneficial effects:
[0020] After obtaining a first command for obtaining the power consumption information of a server according to the attribute information of the server, sending the first command to the BMC in the server, and receiving the power consumption information of the server returned by the BMC. The first command follows the command format of the power consumption acquisition command defined by the first protocol, and the power consumption information of the server returned by the BMC is information obtained without following the data format of the data returned by the power consumption acquisition command defined by the first protocol. Therefore, compared with the related art, in the process of the server obtaining the power consumption information of the server based on the first command, data loss of the power consumption information due to data format limitations is avoided, the accuracy of the obtained power consumption information of the server is improved, and the data acquisition accuracy of the first tool is also improved. Brief Description of the Drawings
[0021] Figure 1 is a schematic diagram of the implementation environment of the solution provided by an embodiment of the present application;
[0022] Figure 2 is a schematic diagram of calling the first tool without using parameters provided by an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of calling the first tool using a second parameter provided by an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of calling the first tool using a third parameter provided by an embodiment of the present application;
[0025] Figure 5 is a schematic diagram of calling the first tool using a fourth parameter provided by an embodiment of the present application;
[0026] Figure 6 is a schematic diagram of calling the first tool using a first parameter provided by an embodiment of the present application;
[0027] Figure 7 is a flowchart of the data acquisition method provided by an embodiment of the present application;
[0028] Figure 8 is a schematic diagram of the calling process of the first tool provided by an embodiment of the present application;
[0029] Figure 9 is a schematic diagram of the comparison of the technical effects of the technical solution provided by the present application and the technical solution provided by the related art provided by an embodiment of the present application;
[0030] Figure 10 is a block diagram of the data acquisition device provided by an embodiment of the present application;
[0031] Figure 11 is a block diagram of the structure of the server provided by an embodiment of the present application. Detailed implementation manners
[0032] To make the objectives, technical solutions, and advantages of this application clearer, the following will further describe the implementation manners of this application in detail with reference to the accompanying drawings.
[0033] Please refer to Figure 1 , which shows a schematic diagram of the solution implementation environment provided by an embodiment of this application. This solution implementation environment can be implemented as a data acquisition system. This solution implementation environment may include: a server 10.
[0034] The server 10 refers to an electronic device with data calculation, processing, and storage functions. The server 10 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In the embodiment of this application, the server 10 is an electronic device with a display interface and a keyboard input, and information can be input through the keyboard to manage the server 10.
[0035] A first tool 20 is installed in the server 10. The first tool 20 is a tool for obtaining the power consumption information of the server 10. Exemplarily, the first tool 20 can be a binary tool. Optionally, the first tool 20 can be called through the commands of the server, or the first tool can be called by inputting different parameters in the first tool 20.
[0036] A BMC 30 (Baseboard Management Controller) is installed in the server 10. The BMC 30 is a core component for deploying / diagnosing / managing the server, responsible for managing the network interface between the system management software and the platform management hardware, and providing functions such as autonomous supervision, event recording, and recovery control. The BMC 30 can monitor various hardware states of the server system in real time through sensors, such as power consumption, temperature, voltage, fan speed, etc., and store the state information of the hardware in at least one physical address managed by the BMC 30. If a certain state information exceeds the limit range, a hardware exception will be reported in a timely manner. In the embodiment of this application, the power consumption information of the server 20 is stored in the power consumption address managed by the BMC 30, and the power consumption address refers to the physical address of the storage unit that stores the power consumption information of the server.
[0037] In the embodiment of this application, the execution entity of each step can be the first tool configured in the server 10, and the server 10 can provide background services for the call of the first tool 20.
[0038] In the embodiment of the present application, the power consumption address managed by the BMC can be accessed through the first tool. The first tool matches the first command for obtaining the power consumption information of the server according to the attribute information of the server, and sends the first command to the BMC. The BMC will obtain the power consumption data in the power consumption address according to the power consumption address managed by the first command, and return the power consumption data to the first tool. Then, by parsing the power consumption data, the power consumption information of the server can be obtained.
[0039] Next, the usage method of the first tool will be introduced.
[0040] 1. Directly call the first tool without using any parameters, which can also be called the "silent mode", as shown in Figure 2 shown.
[0041] Directly call the first tool through the command of the server, without inputting any parameters in the first tool, and the power consumption information of the server can be output. As shown in Figure 2 shown, after calling the first tool, the power consumption information of the server is directly printed on the display interface of the server, that is, the PSU (Power Supply Unit) is 326.25W.
[0042] 2. Input the second parameter in the first tool, as shown in Figure 3 shown.
[0043] The second parameter is the parameter for obtaining the version information of the first tool through the first tool. The version information of the first tool refers to the identification information of the improved first tool obtained after multiple modifications of the first tool. The version information of the first tool is used to indicate the currently used improved first tool.
[0044] In some embodiments, if the server receives the second parameter input in the first tool, the version information of the first tool is output.
[0045] Input the second parameter in the first tool. After the server receives the second parameter input in the first tool, the version information of the first tool can be output on the display interface of the server. As shown in Figure 3 shown, if the second parameter is the -v parameter, after inputting the -v parameter in the first tool, the power consumption information of the first tool is printed on the display interface of the server, that is, the Version (version information) is v2.0.0.
[0046] 3. Input the third parameter in the first tool, as shown in Figure 4 shown.
[0047] The third parameter is a parameter for obtaining the help information of the first tool through the first tool. The help information of the first tool is used to indicate the usage method of the first tool, specifically referring to the purposes of inputting various parameters in the first tool, that is, the information obtained after inputting various parameters in the first tool.
[0048] In some embodiments, if the server receives the third parameter input in the first tool, it outputs the help information of the first tool.
[0049] When the third parameter is input in the first tool, after the server receives the third parameter input in the first tool, the help information of the first tool can be output on the display interface of the server. For example Figure 4 as shown, if the third parameter is the -h parameter, after inputting the -h parameter in the first tool, the help information of the first tool, that is, Usage (help information), is printed on the display interface of the server. Among them, inputting the -h parameter is used to "displays this help" (display help information), inputting the -v parameter is used to "displays the version" (display version information), inputting the -d parameter is used to "enabledebug print" (print debug information), and inputting the -f parameter is used to "force flush oem local config file" (force flush local cache file).
[0050] 4. Input the fourth parameter in the first tool, which can be referred to Figure 5 as shown.
[0051] The fourth parameter is a parameter for obtaining debug information through the first tool. The debug information is used to indicate the steps for obtaining the power consumption information of the server, specifically including the attribute information of the server, the command information for obtaining the power consumption information of the server, and the command result for obtaining the power consumption information of the server, etc.
[0052] In some embodiments, if the server receives the fourth parameter input in the first tool, it outputs the debug information.
[0053] When the fourth parameter is input in the first tool, after the server receives the fourth parameter input in the first tool, the debug information can be output on the display interface of the server. For example Figure 5As shown, if the fourth parameter is the -d parameter, after entering the -d parameter in the first tool, debug information is printed on the display interface of the server. Among them, Product Manufacturer (server manufacturer), Product Name (server name), Vendor_id (vendor number), and Product_id (production number) represent the attribute information of the server. OEM command represents the command information for obtaining the power consumption information of the server, Result of command represents the hexadecimal result of the command for obtaining the power consumption information of the server, and PSU represents the decimal result of the command for obtaining the power consumption information of the server.
[0054] 5. Enter the first parameter in the first tool, which can be referred to Figure 6 as shown.
[0055] The first parameter is used to refresh the content in the local cache file through the first tool. If the server receives the first parameter entered in the first tool, it obtains the latest content stored in the local cache file and forcibly refreshes the content in the local cache text, so that the content in the local cache file is updated to the latest version.
[0056] Optionally, the first parameter can be used in combination with other parameters, that is, the user can enter the first parameter and other parameters in the first tool. Then, while forcibly refreshing the local cache file on the server, the server also displays the content corresponding to the other parameters on the display interface of the server. As Figure 6 shown, if the first parameter is the -f parameter and the fourth parameter is the -d parameter, and the -f parameter and the -d parameter are entered in combination in the first tool, the latest debug information is printed on the display device of the server, and the latest obtained information overwrites the original local cache file. Figure 5 The power consumption information of the server shown in the debug information as Figure 5 refers to the debug information of the server obtained at the corresponding moment. Figure 6 The power consumption information of the server shown in the debug information as Figure 6 refers to the debug information of the server obtained at the corresponding moment. Therefore, Figure 5 and Figure 6 the PSU values in are different.
[0057] Please refer to Figure 7 , which shows the flowchart of the data acquisition method provided by an embodiment of the present application. The execution subject of each step of this method can be the first tool configured in the server. This method may include at least one of the following steps 710 to 740:
[0058] Step 710, obtain the attribute information of the server.
[0059] The attribute information of the server is used to indicate the currently used server, mainly including the manufacturer information and production batch information of the server. For example, the attribute information of the server may include the information corresponding to the two fields of Product Manufacturer and ProductName. Optionally, it may also include the information corresponding to the fields of Vendor_id and Product_id.
[0060] In some embodiments, the server may be a Linux server or a Windows server.
[0061] Step 720: Obtain a first command according to the attribute information of the server. The first command is used to obtain the power consumption information of the server. The first command follows the command format of the power consumption acquisition command defined by the first protocol. The first protocol is used to standardize the command formats of various commands and the data formats of the data returned by various commands. The power consumption acquisition command is a command defined by the first protocol for obtaining the power consumption information of the server.
[0062] A BMC is installed in the server. The BMC can manage at least one physical address. The data acquired by the corresponding sensors are stored in the storage units corresponding to each physical address. For example, the power consumption data of the server acquired by the power sensor, the temperature data of the server acquired by the temperature sensor, and the voltage data of the server acquired by the voltage sensor are respectively stored in the corresponding storage units. In the embodiments of the present application, the physical address of the storage unit storing the power consumption information of the server may be referred to as the power consumption address, and the physical address of the storage unit storing the attribute information of the server may be referred to as the attribute address. Optionally, the storage units storing the data acquired by different sensors may be storage units within the same register or storage units within different registers. For example, the power consumption data of the server and the temperature data of the server may be stored in the same register, and the voltage data of the server may be stored separately in a register.
[0063] Based on the attribute information of the server, the manufacturer of the server formulates commands corresponding to each physical address according to the physical addresses managed by the BMC. Each command corresponding to a physical address is used to obtain the data in the storage unit corresponding to that physical address.
[0064] The first protocol is a protocol for monitoring each interface of the server, which can intelligently monitor the running status of the server. In the first protocol, the command format for obtaining data of each interface of the server is specified, as well as the data format of the data returned by the command for obtaining data of each interface of the server. The command format refers to the content format included in the command, including the content format of each field in the command and the distribution form of each field. The data format refers to the content format of the data returned by the command, including the representation form of each field in the data returned by the command and the transmission form of the data return. Exemplarily, the first protocol can be the IPMI protocol. The IPMI protocol specifies the command format of each command. For example, in the IPMI protocol, it is specified that the power consumption information of the server is obtained through the raw command, the sensor information of the server is obtained through the sdr command, the log information of the server is obtained through the sel command, and the component information of the server is obtained through the fru command, etc. The command formats of commands such as the raw command, sdr command, sel command, and fru command are different. The IPMI protocol also specifies the data format of the data returned by each command. For example, the IPMI protocol respectively specifies the data formats of the data returned by commands such as the raw command, sdr command, sel command, and fru command. The data formats of the data returned by different commands can be different, or there may be two commands with the same data format of the data returned.
[0065] It should be noted that the commands corresponding to each physical address formulated by the server manufacturer need to follow the command formats of each command defined in the first protocol. For example, the IPMI protocol specifies that the power consumption acquisition command is the raw command, then the command corresponding to the power consumption address formulated by the server manufacturer needs to follow the command format of the raw command. The IPMI protocol also specifies that the log acquisition command is the sel command, then the command corresponding to the log address formulated by the server manufacturer needs to follow the command format of the sel command. However, the data returned by the commands corresponding to each physical address formulated by the server manufacturer does not follow the data formats of the data returned by each command defined in the first protocol. For example, the IPMI protocol specifies that the data format of the data returned by the raw command is an 8-bit field, that is, it means that the data returned by the raw command can only be transmitted with a data capacity of 8 bits. Therefore, if the data capacity of the data returned by the raw command is 16 bits, the data returned by the raw command needs to be data-compressed before data return, resulting in data loss during the process and reducing the data acquisition accuracy. While the data returned by the command corresponding to the power consumption address formulated by the server manufacturer can be directly transmitted with a data capacity of 16 bits, without data loss, improving the data acquisition accuracy.
[0066] In addition, the commands corresponding to each physical address defined by the server manufacturer can directly interact with each physical address managed by the BMC, so as to directly obtain the data stored in the storage unit corresponding to each physical address. However, the commands defined by the first protocol cannot directly interact with each physical address managed by the BMC. For example, if the first protocol is the IPMI protocol, it is necessary to interact with each physical address managed by the BMC through the impi-tool tool.
[0067] In some embodiments, step 720 includes at least one sub-step among steps 721 to 723 (not shown in the figure).
[0068] Step 721: According to the attribute information of the server, obtain the commands respectively corresponding to at least one physical address managed by the BMC. Each command corresponding to a physical address is used to obtain the data stored in the storage unit corresponding to the physical address.
[0069] According to the attribute information of the server, obtain the commands respectively corresponding to each physical address defined by the server manufacturer for the physical addresses managed by the BMC.
[0070] Step 722: Among the commands respectively corresponding to at least one physical address, obtain the command corresponding to the power consumption address. The power consumption address refers to the physical address of the storage unit storing the power consumption information of the server.
[0071] Exemplarily, according to the identification information of the power consumption address, the command corresponding to the power consumption address can be obtained from the commands respectively corresponding to at least one physical address. The power consumption information of the server refers to the differential power between the input power and the output power of the server, which can be used to represent the energy consumed by the server. Therefore, the power consumption information can also be called the power loss information. The BMC obtains the input power and the output power of the server through a power sensor, so as to obtain the power consumption information of the server. Usually, the power consumption information of the server refers to the power consumption information of the server within a unit time. The unit time can be any time unit such as 1s or 10s. This application does not make any limitation in this regard.
[0072] Step 723: Determine the command corresponding to the power consumption address as the first command.
[0073] The command corresponding to the power consumption address defined by the server manufacturer is called the first command.
[0074] Since the first command is the command corresponding to the power consumption address defined by the server manufacturer, using the first command can directly interact with the power consumption address managed by the BMC, avoiding indirectly interacting with the power consumption address via other tools in the related art, which results in a slow response speed of the power consumption acquisition command. Using the first command improves the response speed of the server, thereby improving the data acquisition efficiency of the power consumption information.
[0075] Step 730: Send a first command to the baseboard management controller (BMC) in the server.
[0076] Send a first command to the BMC in the server through a first tool. The BMC, based on the first command, accesses the power consumption address managed by the BMC and obtains power consumption data from the storage unit corresponding to the power consumption address. The server returns the power consumption data to the first tool.
[0077] In some embodiments, step 730 includes at least one sub-step among steps 731-732 (not shown in the figure).
[0078] Step 731: Receive the power consumption data returned by the power consumption address.
[0079] The power consumption data returned by the power consumption address received by the first tool here does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol, that is, it means that the power consumption data returned by the power consumption address received by the first tool does not reduce the data accuracy during the data acquisition process.
[0080] Step 732: Use the data parsing method defined by the server to parse the power consumption data to obtain the power consumption information of the server.
[0081] The data parsing method defined by the server is determined by the attribute information of the server, and can also be said to be determined by the manufacturer of the server. Different servers correspond to different data parsing methods. For example, for Figure 6 the debug information shown, where "Result of command" represents the hexadecimal result of the first command. If there are two fields, 57 and 01, in the command result indicating the power consumption data returned by the power consumption address, the data parsing method defined by the server can be to convert 57 and 01 into binary representation forms respectively, then add them, and convert the added result into decimal representation form to obtain the power consumption information of the server. Optionally, the data parsing method defined by the server can also be to convert 57 and 01 into decimal representation forms respectively, and then use the value corresponding to 57 as the base and the value corresponding to 01 as the exponent to obtain the power consumption information of the server.
[0082] Since the first command does not interact with the power consumption address managed by the BMC through other tools, the data returned by the first command will not go through the parsing process of any tool either. The first tool receives the unparsed power consumption data and uses the data parsing method defined by the server to parse the power consumption data, avoiding loss of the power consumption information of the server and improving the data acquisition accuracy of the first tool for the power consumption information.
[0083] Step 740: Receive the power consumption information of the server returned by the BMC. The power consumption information of the server is the information obtained by parsing the power consumption data returned by the BMC, and the power consumption data does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol.
[0084] According to the data parsing process of the above steps, receive the power consumption information of the server. The power consumption information of the server is the information obtained by parsing the data that does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol.
[0085] The technical solution provided by the embodiments of the present application is to obtain a first command for obtaining the power consumption information of the server according to the attribute information of the server, send the first command to the BMC in the server, and then receive the power consumption information of the server returned by the BMC. The first command follows the command format of the power consumption acquisition command defined by the first protocol, and the power consumption information of the server returned by the BMC is the information obtained without following the data format of the data returned by the power consumption acquisition command defined by the first protocol. Therefore, compared with the related art, in the process of obtaining the power consumption information of the server based on the first command, the server avoids data loss of the power consumption information due to data format limitations, improves the accuracy of the obtained power consumption information of the server, and also improves the data collection accuracy of the first tool.
[0086] In some embodiments, step 710 includes at least one sub-step among steps 711 to 714 (not shown in the figure).
[0087] In some embodiments, obtain the command corresponding to the attribute address from the commands corresponding to at least one physical address managed by the BMC. The attribute address is the physical address of the storage unit for storing the attribute information of the server; determine the command corresponding to the attribute address as the second command.
[0088] Exemplarily, the command corresponding to the attribute address can be obtained from the commands corresponding to at least one physical address according to the identification information of the attribute address. The command corresponding to the attribute address formulated by the manufacturer of the server is called the second command.
[0089] Since the second command is the command corresponding to the attribute address formulated by the manufacturer of the server, using the second command can directly interact with the attribute address managed by the BMC, which can improve the response speed of the server and thus improve the efficiency of the first tool to obtain the attribute information of the server.
[0090] Step 711: Send the second command to the BMC. The second command is used to obtain the attribute information of the server.
[0091] The second command follows the command format of the attribute acquisition command defined by the first protocol. The attribute acquisition command is a command defined by the first protocol for acquiring the attribute information of the server.
[0092] In some embodiments, the attribute data returned by the received attribute address is parsed using the data parsing method defined by the server to obtain the attribute information of the server.
[0093] Here, the attribute data returned by the attribute address received by the first tool does not follow the data format of the data returned by the attribute acquisition command defined by the first protocol.
[0094] Step 712, receive the attribute information of the server returned by the BMC.
[0095] The attribute information of the server is information obtained without following the data format of the data returned by the attribute acquisition command defined by the first protocol.
[0096] Step 713, store the attribute information of the server in the local cache file.
[0097] The local cache file is a file on the server. The local cache file is used to store the information returned by each physical address in the server. For example, store the power consumption information of the server returned by the first command in the local cache file, and store the attribute information of the server returned by the second command in the local cache file.
[0098] In some embodiments, under the condition of meeting the first condition, send a second command to the BMC. Among them, the first condition includes at least one of the following: there is no local cache file in the server; the server receives the first parameter input in the first tool, and the first parameter is used to refresh the content in the local cache file through the first tool; the local cache file fails the compliance check.
[0099] Exemplarily, if there is no local cache file in the server, it means that the server has not sent any commands to the server. By sending a second command to the BMC, the attribute information of the server is obtained. After receiving the attribute information of the server returned by the BMC, create a local cache file in the server and store the attribute information of the server in the local cache file.
[0100] Exemplarily, if the server receives the first parameter input in the first tool, the content in the local cache file will be refreshed through the first tool. By sending a second command to the BMC, the attribute information of the server is obtained. After receiving the attribute information of the server returned by the BMC, overwrite the attribute information of the server in the local cache file to obtain the refreshed local cache file.
[0101] The compliance check is used to check whether the local cache file is damaged and whether the storage format of the local cache file conforms to the format for the first tool to read data. If the local cache file fails the compliance check, it means that the first tool cannot obtain data from it. Therefore, it is necessary to re-obtain the local cache file. After receiving the attribute information of the server returned by the BMC, the local cache file is overwritten to obtain an updated local cache file.
[0102] Through the above steps, the local cache file contains the attribute information of the server, facilitating the subsequent steps to obtain the attribute information of the server from the local cache file.
[0103] Step 714: Obtain the attribute information of the server from the local cache file of the server.
[0104] In some embodiments, when the first condition is not met, obtain the attribute information of the server from the local cache file of the server. That is, when there is a local cache file in the server, and the server has not received the first parameter input in the first tool, and the local cache file passes the compliance check, obtain the attribute information of the server from the local cache file of the server.
[0105] Through the above steps, only send the second command to the BMC when the first tool is executed for the first time to obtain the attribute information of the server, and store the attribute information of the server in the local cache file of the server. Thus, when the first tool is called next time, the attribute information of the server can be directly obtained from the local cache file, improving the acquisition efficiency of the first tool and at the same time improving the performance of the first tool.
[0106] Figure 8 The figure shows a schematic diagram of the calling process of the first tool. The first tool is called through the command of the server. If the second parameter is input in the first tool, the version information of the first tool is output, which can be referred to Figure 3 as shown. If the second parameter is not input in the first tool, it is verified whether the third parameter is input in the first tool. If the third parameter is input in the first tool, the help information of the first tool is output, which can be referred to Figure 4 as shown. If the third parameter is not input in the first tool, it is verified whether the fourth parameter is input in the first tool. If the fourth parameter is input in the first tool, the debug information is output, which can be referred to Figure 5As shown, if the fourth parameter is not input in the first tool, it is verified whether the first condition is satisfied. In the case where the first condition is satisfied, that is, when there is no local cache file in the server, or the server receives the first parameter input in the first tool, or the local cache file fails the compliance check, the attribute information of the server is obtained by sending a second command to the BMC, and the attribute information of the server is stored in the local cache file, and then the attribute information of the server is obtained from the local cache file. In the case where the first condition is not satisfied, that is, when there is a local cache file in the server, and the server does not receive the first parameter input in the first tool, and the local cache file passes the compliance check, the attribute information of the server is directly obtained from the local cache file of the server. Then, according to the attribute information of the server, a first command is obtained, the first tool executes the first command, and receives the power consumption data returned by the server, and uses the data parsing method defined by the server to parse the power consumption data to obtain the power consumption information of the server.
[0107] A comparison schematic diagram of the technical effects (901) of the technical solution provided by this application and the technical effects (902) of the technical solution provided by the related art can be referred to Figure 9 as shown Figure 9 The data acquisition method is to add an operation process with 10% computing power of a core every 10s, continuously pressurize until the overall utilization rate reaches 80%, and then delete a computing power process every 10s interval. During this period, the power consumption corresponding to the technical solution provided by this application and the technical solution provided by the related art are collected and plotted into a curve. When adding an operation process with 10% computing power of a core each time, the operation time of the server increases, and thus the power consumption of the server also increases accordingly. By Figure 9 It can be seen that when adding and deleting computing power processes each time for the technical solution provided by this application, the change of the collected power consumption information is relatively sensitive, so the accuracy of data acquisition is relatively high. While for the technical solution provided by the related art, it cannot capture the change of power consumption information in time and can only obtain it when the power consumption information reaches a certain critical value, so the accuracy of data acquisition is relatively low.
[0108] The following is an apparatus embodiment of this application, which can be used to execute the method embodiment of this application. For the details not disclosed in the apparatus embodiment of this application, please refer to the method embodiment of this application.
[0109] Please refer to Figure 10 , which shows a block diagram of a data acquisition device provided by an embodiment of this application. This device has the function of implementing the above data acquisition method, and this function can be implemented by hardware or by hardware executing corresponding software. This device can be the server introduced above or can be set in the server. As Figure 10As shown, the device 1000 may include: an information acquisition module 1010, a command acquisition module 1020, a command sending module 1030, and an information receiving module 1040.
[0110] The information acquisition module 1010 is configured to acquire the attribute information of the server.
[0111] The command acquisition module 1020 is configured to acquire a first command according to the attribute information of the server, where the first command is used to acquire the power consumption information of the server, the first command follows the command format of the power consumption acquisition command defined by the first protocol, the first protocol is used to standardize the command formats of various commands and the data formats of the data returned by each of the commands, and the power consumption acquisition command is the command defined by the first protocol for acquiring the power consumption information of the server.
[0112] The command sending module 1030 is configured to send the first command to the baseboard management controller BMC in the server.
[0113] The information receiving module 1040 is configured to receive the power consumption information of the server returned by the BMC, where the power consumption information of the server is the information obtained by parsing the power consumption data returned by the BMC, and the power consumption data does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol.
[0114] In some embodiments, the command acquisition module 1020 is configured to:
[0115] According to the attribute information of the server, acquire commands corresponding to at least one physical address managed by the BMC, and each command corresponding to a physical address is used to acquire the data in the storage unit corresponding to the physical address;
[0116] From the commands corresponding to the at least one physical address respectively, acquire the command corresponding to the power consumption address, where the power consumption address refers to the physical address of the storage unit storing the power consumption information of the server;
[0117] Determine the command corresponding to the power consumption address as the first command.
[0118] In some embodiments, the information receiving module 1040 is configured to:
[0119] Receive the power consumption data returned by the power consumption address;
[0120] Adopt the data parsing method defined by the server to parse the power consumption data to obtain the power consumption information of the server.
[0121] In some embodiments, the information acquisition module 1010 is configured to:
[0122] Obtain the attribute information of the server from the local cache file of the server.
[0123] In some embodiments, the apparatus 1000 further includes an information storage module, and the information storage module is configured to:
[0124] Send a second command to the BMC, where the second command is used to obtain the attribute information of the server;
[0125] Receive the attribute information of the server returned by the BMC;
[0126] Store the attribute information of the server into the local cache file.
[0127] In some embodiments, the information storage module is configured to:
[0128] Send the second command to the BMC when a first condition is met;
[0129] Wherein, the first condition includes at least one of the following:
[0130] The local cache file does not exist in the server;
[0131] The server receives a first parameter input in the first tool, and the first parameter is used to refresh the content in the local cache file through the first tool;
[0132] The local cache file fails a compliance check.
[0133] In some embodiments, the information storage module is configured to:
[0134] Obtain a command corresponding to an attribute address from commands respectively corresponding to at least one physical address managed by the BMC, where the attribute address refers to a physical address of a storage unit storing the attribute information of the server;
[0135] Determine the command corresponding to the attribute address as the second command.
[0136] In some embodiments, the information receiving module 1040 is further configured to:
[0137] If the server receives a second parameter input in the first tool, output the version information of the first tool;
[0138] If the server receives a third parameter input in the first tool, output the help information of the first tool, where the help information of the first tool is used to indicate the usage method of the first tool;
[0139] If the server receives a fourth parameter input in the first tool, it outputs debug information, and the debug information is used to indicate the acquisition steps of the power consumption information of the server.
[0140] The technical solution provided by the embodiments of the present application obtains a first command for obtaining the power consumption information of the server according to the attribute information of the server. After sending the first command to the BMC in the server, it receives the power consumption information of the server returned by the BMC. The first command follows the command format of the power consumption acquisition command defined by the first protocol, and the power consumption information of the server returned by the BMC is information obtained without following the data format of the data returned by the power consumption acquisition command defined by the first protocol. Therefore, compared with the related art, in the process of the server obtaining the power consumption information of the server based on the first command, data loss of the power consumption information due to data format limitations is avoided, the accuracy of the obtained power consumption information of the server is improved, and the data acquisition accuracy of the first tool is also improved.
[0141] It should be noted that for the device provided in the above embodiments, when implementing its functions, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the content structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiments and the method embodiments belong to the same concept, and the specific implementation process can be seen in the method embodiments, which will not be repeated here.
[0142] Please refer to Figure 11 , which shows a structural block diagram of a server 1100 provided by an embodiment of the present application. The server 1100 can be any electronic device with data calculation, processing, and storage functions. The server 1100 can be used to implement the data acquisition method provided in the above embodiments.
[0143] Generally, the server 1100 includes a processor 1101 and a memory 1102.
[0144] The processor 1101 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 1101 may be implemented in at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1101 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1101 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1101 may further include an AI processor, which is used to process computational operations related to machine learning.
[0145] The memory 1102 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 1102 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1102 is used to store a computer program, and the computer program is configured to be executed by one or more processors to implement the above data acquisition method.
[0146] Those skilled in the art can understand that Figure 11 the structure shown in does not constitute a limitation on the server 1100, and it may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0147] In a schematic embodiment, a computer-readable storage medium is further provided. A computer program is stored in the storage medium, and when the computer program is executed by the processor of the server, the above data acquisition method is implemented. Optionally, the above computer-readable storage medium may be a ROM (Read-Only Memory), a RAM (Random Access Memory), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0148] In an exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. A processor of the server reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the server executes the above data acquisition method.
[0149] It should be noted that, before and during the process of collecting relevant data of users, this application can display a prompt interface, a pop-up window or output voice prompt information. The prompt interface, pop-up window or voice prompt information is used to prompt the user that their relevant data is being collected currently, so that this application only starts to execute the relevant steps of obtaining the user's relevant data after obtaining the confirmation operation issued by the user for the prompt interface or the pop-up window. Otherwise (that is, when the confirmation operation issued by the user for the prompt interface or the pop-up window is not obtained), the relevant steps of obtaining the user's relevant data are ended, that is, the relevant data of the user is not obtained. In other words, all user data collected by this application is processed strictly in accordance with the requirements of relevant national laws and regulations. Obtaining the informed consent or separate consent of the personal information subject is carried out under the condition of the user's consent and authorization, and subsequent data use and processing behaviors are carried out within the scope of laws, regulations and the authorization of the personal information subject. The collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0150] It should be understood that the "plurality" mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the front and rear associated objects. In addition, the step numbers described herein only exemplarily show a possible execution sequence between steps. In some other embodiments, the above steps may not be executed in the order of the numbers. For example, two steps with different numbers are executed simultaneously, or two steps with different numbers are executed in the reverse order of the illustration. The embodiments of this application do not make any limitations in this regard.
[0151] The above are only exemplary embodiments of this application and are not intended to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this application shall be included in the protection scope of this application.
Claims
1. A data acquisition method, characterized in that, The method is executed by a first tool configured in a server, and the method includes: Obtaining attribute information of the server; According to the attribute information of the server, obtaining a first command, where the first command is used to obtain power consumption information of the server, the first command follows the command format of the power consumption acquisition command defined by a first protocol, the first protocol is used to standardize the command formats of various commands and the data formats of the data returned by each of the commands, and the power consumption acquisition command is a command defined by the first protocol for obtaining the power consumption information of the server; Sending the first command to a baseboard management controller (BMC) in the server; Receiving the power consumption information of the server returned by the BMC, where the power consumption information of the server is information obtained by parsing the power consumption data returned by the BMC, and the power consumption data does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol.
2. The method according to claim 1, wherein The obtaining the first command according to the attribute information of the server includes: According to the attribute information of the server, obtaining commands corresponding to at least one physical address managed by the BMC, and each command corresponding to a physical address is used to obtain data in the storage unit corresponding to the physical address; From the commands corresponding to the at least one physical address respectively, obtaining the command corresponding to the power consumption address, where the power consumption address refers to the physical address of the storage unit storing the power consumption information of the server; Determining the command corresponding to the power consumption address as the first command.
3. The method according to claim 2, wherein The receiving the power consumption information of the server returned by the BMC includes: Receiving the power consumption data returned by the power consumption address; Using the data parsing method defined by the server to parse the power consumption data to obtain the power consumption information of the server.
4. The method according to claim 1, characterized in that, The obtaining the attribute information of the server includes: Obtaining the attribute information of the server from the local cache file of the server.
5. The method according to claim 4, wherein The method further includes: Sending a second command to the BMC, where the second command is used to obtain the attribute information of the server; Receiving the attribute information of the server returned by the BMC; Storing the attribute information of the server into the local cache file.
6. The method according to claim 5, wherein The sending the second command to the BMC includes: Sending the second command to the BMC when a first condition is satisfied; Wherein, the first condition includes at least one of the following: There is no such local cache file in the server; The server receives a first parameter input in the first tool, and the first parameter is used to refresh the content in the local cache file through the first tool; The local cache file fails a compliance check.
7. The method according to claim 5, wherein The method further includes: From the commands corresponding to at least one physical address managed by the BMC, obtaining the command corresponding to the attribute address, where the attribute address refers to the physical address of the storage unit storing the attribute information of the server; Determining the command corresponding to the attribute address as the second command.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: If the server receives a second parameter input in the first tool, it outputs the version information of the first tool; If the server receives a third parameter input in the first tool, it outputs the help information of the first tool, and the help information of the first tool is used to indicate the usage method of the first tool; If the server receives a fourth parameter input in the first tool, it outputs debugging information, and the debugging information is used to indicate the steps for obtaining the power consumption information of the server.
9. A data acquisition device, characterized in that, The device includes: An information acquisition module, configured to acquire the attribute information of the server; A command acquisition module, configured to acquire a first command according to the attribute information of the server, where the first command is used to acquire the power consumption information of the server, the first command follows the command format of the power consumption acquisition command defined by a first protocol, the first protocol is used to standardize the command formats of various commands and the data formats of the data returned by each of the commands, and the power consumption acquisition command is a command defined by the first protocol for acquiring the power consumption information of the server; A command sending module, configured to send the first command to the baseboard management controller (BMC) in the server; An information receiving module, configured to receive the power consumption information of the server returned by the BMC, where the power consumption information of the server is information obtained by parsing the power consumption data returned by the BMC, and the power consumption data does not follow the data format of the data returned by the power consumption acquisition command defined by the first protocol.
10. A server, characterized in that, The server includes a processor and a memory, and a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the data acquisition method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by the processor to implement the data acquisition method according to any one of claims 1 to 8.
12. A computer program product, characterized in that, The computer program product includes a computer program, and the computer program is loaded and executed by the processor to implement the data acquisition method according to any one of claims 1 to 8.