One-key log capturing method and device of server
By regularly checking the server status and automatically crawling one-click logs, the problem of difficulty in timely discovering and handling of downtime is solved, and fast and accurate fault analysis and repair are achieved, improving product quality and customer experience.
Patent Information
- Application Number
- CN202411162986.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-12-27
AI Technical Summary
During server production and testing, downtime is difficult to detect and deal with in a timely manner, resulting in potential hidden dangers affecting the customer experience. The existing methods are cumbersome and time-consuming, and there is a lack of automated solutions.
By regularly checking the operating status of the server, automatically save hardware information and when a downtime is detected, one-click logs are captured according to the serial number and the IP address of the substrate management controller, to realize an automated log crawling process and reduce manual intervention and misjudgment .
Timely detect server downtime, automatically trigger the log capture process, ensure that fault information is captured as soon as possible, prevent hidden dangers from flowing into the market, improve product quality and customer experience, and improve fault location and maintenance efficiency.
Smart Images

Figure CN119201562A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a one-key log capture method and device for a server. Background Art
[0002] In the modern server production and testing process, it is crucial to ensure the stability and reliability of the server. However, during the testing process of the production line, the server may experience unexpected situations such as downtime, resulting in the inability to complete the test normally. This situation is usually not immediately discovered by the operator, because the downtime phenomenon does not directly indicate a test failure. The operator only realizes that there may be an abnormality when the test time is too long and attracts attention.
[0003] In the related art, after discovering that the server is down, the operator needs to manually connect to the server's baseboard management controller BMC serial port, obtain relevant information and log in to the BMC's web interface to capture the one-click log. This process is cumbersome and time-consuming. At the same time, there are cases where the operator does not perform problem analysis and repairs as required and directly re-powers on and retests. For servers that are no longer down after retesting, they may flow into the market due to insufficient analysis, resulting in potential hidden dangers that affect customer experience. Therefore, in the production testing process, there is an urgent need for a method to accurately estimate the test time, promptly discover and determine the server's downtime, and quickly and effectively capture the one-click log of the downed server. Summary of the invention
[0004] The embodiments of the present disclosure provide a one-click log capture method and device for a server, aiming to solve the problems existing in the above-mentioned background technology.
[0005] In order to solve the above technical problems, the present disclosure is implemented as follows:
[0006] In a first aspect, an embodiment of the present disclosure provides a one-click log capture method for a server, the method comprising:
[0007] After the target server to be tested is powered on, the hardware information of the target server is saved to a database, the hardware information including the serial number, part number and baseboard management controller IP address;
[0008] Performing a target test item test on the target server, and regularly checking whether the target server is down;
[0009] In the case where it is detected that the target server is down, determining the part number and baseboard management controller IP address of the target server from the database according to the serial number of the target server;
[0010] The one-key log of the target server is captured according to the part number and baseboard management controller IP address of the target server.
[0011] Optionally, the hardware information further includes a network IP; and the testing of the target test item on the target server and regularly checking whether the target server is down includes:
[0012] Determining the target server based on the serial number of the target server;
[0013] Performing a test of a target test item on the target server;
[0014] Run a monitoring program to check whether the target server is offline;
[0015] When it is determined that the target server is offline, a ping command is sent to the network IP of the target server;
[0016] If the target server does not respond to the ping command, after waiting for a first preset time, continue to send a preset number of ping commands to the network IP of the target server;
[0017] When the target server does not respond to the ping command within a preset number of times, it is determined that the target server is down.
[0018] Optionally, the method further comprises:
[0019] When it is determined that the target server is not offline, after waiting for a second preset time, sending a ping command to the network IP of the target server, where the second preset time is greater than the first preset time;
[0020] If the target server does not respond to the ping command, after waiting for the first preset time, continue to send a preset number of ping commands to the network IP of the target server;
[0021] When the target server does not respond to the ping command within a preset number of times, it is determined that the target server is down.
[0022] Optionally, the running of the monitoring program to check whether the target server is offline includes:
[0023] Running the monitoring program to obtain the estimated running time of the target test item;
[0024] When the actual running time of the test program of the target test item exceeds the estimated running time, it is determined that the target server is offline.
[0025] Optionally, the method further comprises:
[0026] When the target test item is a memory stress test, running the test program of the memory stress test in rounds;
[0027] After each round of memory stress testing is completed, check whether the target server is offline;
[0028] When it is determined that the target server is offline, obtaining memory configuration parameters of the target server, wherein the memory configuration parameters include memory size, memory speed, number of CPU cores, and memory performance parameters;
[0029] Determine the round running time of the memory stress test according to the memory configuration parameters of the target server through the memory stress test tool IMT, and adjust the estimated running time of the memory stress test according to the round running time;
[0030] Modify the test program of the memory stress test from an offline state to a normal state, perform the next round of memory stress test on the target server, and regularly check whether the target server is down;
[0031] In the case where it is detected that the target server is down, determining the part number and baseboard management controller IP address of the target server from the database according to the serial number identification of the target server;
[0032] The one-key log of the target server is captured according to the part number and baseboard management controller IP address of the target server.
[0033] Optionally, the method further comprises:
[0034] When it is determined that the target server is offline, a ping command is sent to the network IP of the target server;
[0035] In the case where the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, after waiting for a third preset time, executing the steps of: sending a ping command to the network IP of the target server;
[0036] The method further comprises:
[0037] When it is determined that the target server is not offline, after waiting for a second preset time, sending a ping command to the network IP of the target server;
[0038] In the case that the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, the step of checking whether the target server is offline is performed.
[0039] Optionally, the method further comprises:
[0040] When the target server is put on the shelf, the rack number and the time of putting on the shelf of the target server are recorded, wherein the rack number represents the position of the target server in the test rack;
[0041] Saving the serial number, rack number and shelf time of the target server to the database;
[0042] Naming the one-key log according to the serial number, part number, rack number and shelf time of the target server;
[0043] The method further comprises:
[0044] According to the name of the one-key log, a target server where downtime occurs is determined from multiple servers in the test rack.
[0045] In a second aspect, an embodiment of the present disclosure provides a one-key log capture device for a server, the device comprising:
[0046] A saving module is used to save the hardware information of the target server to be tested to a database after the target server is powered on, wherein the hardware information includes a serial number, a part number and an IP address of a baseboard management controller;
[0047] A checking module, used to test the target test items on the target server and regularly check whether the target server is down;
[0048] A determination module, configured to determine the part number and baseboard management controller IP address of the target server from the database according to the serial number of the target server when the target server is detected to be down;
[0049] The one-key log capture module is used to capture the one-key log of the target server according to the part number and baseboard management controller IP address of the target server.
[0050] Optionally, the hardware information also includes a network IP; and the inspection module includes:
[0051] A target server determination submodule, configured to determine the target server based on the serial number of the target server;
[0052] A test submodule, used to test the target test items on the target server;
[0053] A monitoring submodule, used to run a monitoring program to check whether the target server is offline;
[0054] A command sending submodule, used for sending a ping command to the network IP of the target server when it is determined that the target server is offline;
[0055] A continue sending submodule is used for continuing to send a preset number of ping commands to the network IP of the target server after waiting for a first preset time if the target server does not respond to the ping command;
[0056] The downtime determination submodule is used to determine that the target server is down when the target server does not respond to the ping command within a preset number of times.
[0057] Optionally, the device further comprises:
[0058] A first command sending module is used to send a ping command to the network IP of the target server after waiting for a second preset time when it is determined that the target server is not offline, and the second preset time is greater than the first preset time;
[0059] A continuing sending module is used for continuing to send a preset number of ping commands to the network IP of the target server after waiting for the first preset time if the target server does not respond to the ping command;
[0060] The downtime determination module is used to determine that the target server is down when the target server does not respond to the ping command within a preset number of times.
[0061] Optionally, the monitoring submodule includes:
[0062] An acquisition unit, used for running the monitoring program to acquire the estimated running time of the target test item;
[0063] The determination unit is used to determine that the target server is offline when the actual running time of the test program of the target test item exceeds the estimated running time.
[0064] Optionally, the device further comprises:
[0065] A round running module, used for running the test program of the memory stress test in rounds when the target test item is a memory stress test;
[0066] A round checking module, used to check whether the target server is offline after each round of memory stress testing is completed;
[0067] A parameter acquisition module, used to acquire memory configuration parameters of the target server when it is determined that the target server is offline, wherein the memory configuration parameters include memory size, memory speed, number of CPU cores, and memory performance parameters;
[0068] A time adjustment module, used to determine the round running time of the memory stress test according to the memory configuration parameters of the target server through the memory stress test tool IMT, and adjust the estimated running time of the memory stress test according to the round running time;
[0069] A modification module, used to modify the test program of the memory stress test from an offline state to a normal state, perform the next round of memory stress test on the target server, and regularly check whether the target server is down;
[0070] A memory stress test determination module, used to determine the part number and baseboard management controller IP address of the target server from the database according to the serial number identifier of the target server when the target server is detected to be down;
[0071] The memory stress test one-click log capture module is used to capture the one-click log of the target server according to the part number and baseboard management controller IP address of the target server.
[0072] Optionally, the device further comprises:
[0073] A second command sending module is used to send a ping command to the network IP of the target server when it is determined that the target server is offline;
[0074] The first repetitive module is used for, when the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, after waiting for a third preset time, executing the steps of: sending a ping command to the network IP of the target server;
[0075] The device also includes:
[0076] A third command sending module is used to send a ping command to the network IP of the target server after waiting for a second preset time when it is determined that the target server is not offline;
[0077] The second repetitive module is used to execute the step of checking whether the target server is offline when the target server responds to the ping command normally or when the target server responds to the ping command normally within a preset number of times.
[0078] Optionally, the device further comprises:
[0079] A recording module, used for recording the rack number and the time of the target server being put on the rack when the target server is put on the rack, wherein the rack number represents the position of the target server in the test rack;
[0080] A rack information saving module, used to save the serial number, rack number and shelf time of the target server to the database;
[0081] A naming module, used for naming the one-key log according to the serial number, part number, rack number and shelf time of the target server;
[0082] The device also includes:
[0083] The downtime server determination module is used to determine the target server where downtime occurs from multiple servers in the test rack according to the name of the one-key log.
[0084] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of a one-click log capture method of a server.
[0085] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a one-click log capture method for a server are implemented.
[0086] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0087] The present disclosure can timely detect server downtime by regularly checking the operating status of the server and automatically trigger the subsequent log capture process. This automated process avoids the delays and possible misjudgments caused by relying on manual operations, ensures that key information can be captured as soon as the server fails, effectively prevents servers with hidden dangers from entering the market, and improves the quality of the final product and the customer's experience. By capturing the one-click log of the downed server in real time, the maintenance personnel can quickly locate the location of the faulty server and use the obtained log information to perform accurate fault analysis and maintenance operations. Even if the power is accidentally turned off during the test, it will not affect the subsequent maintenance actions, thereby further improving the response speed and accuracy of the maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for describing the embodiments of the present disclosure are briefly introduced below.
[0089] Figure 1 This is a schematic diagram of the steps of a one-key log capture method for a server provided by an embodiment of the present disclosure;
[0090] Figure 2This is a schematic diagram of a process for determining server downtime provided by an embodiment of the present disclosure;
[0091] Figure 3 It is a schematic diagram of a process of grabbing a one-click log of a downed server provided by an embodiment of the present disclosure;
[0092] Figure 4 It is a schematic diagram of the architecture of a one-key log capture device for a server provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0093] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0094] Modern data centers generally deploy hundreds or even thousands of servers, which need to run around the clock to support the continuity of various businesses. Once a server goes down, the operation and maintenance personnel of the data center need to quickly locate the faulty server and obtain relevant log information in order to troubleshoot the problem. The present disclosure uses an automated log capture method to automatically capture the logs of the target server to be tested when the server goes down, reducing manual intervention and improving fault handling efficiency. For data centers, this means that the downtime response time will be greatly shortened, and the time and loss of business interruptions will be greatly reduced. In addition, the function of automatically saving server hardware information in the present disclosure can ensure the accuracy and completeness of the logs, providing sufficient data support for subsequent fault analysis.
[0095] Figure 1 FIG. 1 is a schematic diagram of steps of a one-key log capture method for a server provided by an embodiment of the present disclosure. Figure 1 As shown, the method includes:
[0096] Step S101, after the target server to be tested is powered on, the hardware information of the target server is saved in a database, the hardware information including the serial number, part number and baseboard management controller IP address.
[0097] Step S102: testing the target test items on the target server, and regularly checking whether the target server is down.
[0098] Step S103: when it is detected that the target server is down, the part number and baseboard management controller IP address of the target server are determined from the database according to the serial number of the target server.
[0099] Step S104: Capture the one-key log of the target server according to the part number and baseboard management controller IP address of the target server.
[0100] Involving step S101, this step is triggered after the target server to be tested is assembled and powered on, that is, its premise is that the target server has been powered on and is in a state where hardware information can be obtained. The hardware information of the target server is automatically obtained through built-in detection tools or scripts. The hardware information includes: serial number (SN), part number (PN) and baseboard management controller (BMC) IP address. The acquired hardware information will be uploaded to a central database via the network. The database mentioned in the embodiment of the present disclosure is specifically used to store and manage relevant information of all servers being tested. During the saving process, the serial number (SN) is used as the primary key, and the information of each server can be uniquely identified and quickly queried. The implementation of step S101 ensures that the server to be tested has its detailed hardware information recorded, and provides the necessary basic data for subsequent automated monitoring, fault detection and log capture.
[0101] Involving step S102, the execution of the target test items: after the target server is powered on and the hardware information is saved to the database, the predetermined target test items are automatically started. The target test items include aging tests, memory stress tests, CPU stress tests, disk I / O tests, etc., to ensure the stability and performance of the target server under extreme conditions. During the test process, in order to promptly detect possible failures or downtime, the target server is periodically checked for status. Once the target server is determined to be down, this status is immediately recorded in the database, and the corresponding operation process is triggered for subsequent log capture and fault handling, including the steps of finding the hardware information of the target server and preparing to capture one-click logs.
[0102] Involving step S103, when it is detected that the target server is down, information extraction of the down target server is immediately started for subsequent log capture and fault analysis. According to the unique identifier of the target server, that is, the serial number (SN) of the target server, the relevant hardware information of the target server is extracted from the previously saved database. The part number (PN) and BMC IP address are associated with the serial number of the target server so that subsequent scripts can accurately locate the server that needs to capture one-key logs. At the same time, this information will be used to generate a log file name that complies with the naming rules to facilitate subsequent fault analysis and recording.
[0103] Involving step S104, after determining the part number (PN) and baseboard management controller (BMC) IP address of the target server, call the log capture program (such as collectonekey.sh) to perform a one-click log capture operation. The log capture program connects to the BMC IP address of the target server through the network, and uses the function of the BMC interface to extract the one-click log. The generated log file will be uploaded and stored in a designated server or database (such as a diag server). At the same time, the relevant maintenance personnel are notified that a new fault log has been generated. Maintenance personnel can directly locate the server with the downtime problem based on the file name of the one-click log, and quickly carry out troubleshooting and repair work. It greatly improves the efficiency of production line troubleshooting, reduces the risk of errors in manual operations, and ensures the stability of product quality.
[0104] The present disclosure can timely detect server downtime by regularly checking the operating status of the server and automatically trigger the subsequent log capture process. This automated process avoids the delays and possible misjudgments caused by relying on manual operations, ensures that key information can be captured as soon as the server fails, effectively prevents servers with hidden dangers from entering the market, and improves the quality of the final product and the customer's experience. By capturing the one-click log of the downed server in real time, the maintenance personnel can quickly locate the location of the faulty server and use the obtained log information to perform accurate fault analysis and maintenance operations. Even if the power is accidentally turned off during the test, it will not affect the subsequent maintenance actions, thereby further improving the response speed and accuracy of the maintenance.
[0105] Exemplarily, the hardware information also includes a network IP; the testing of the target test items on the target server and regularly checking whether the target server is down include: determining the target server based on the serial number of the target server; testing the target test items on the target server; running a monitoring program to check whether the target server is offline; if it is determined that the target server is offline, sending a ping command to the network IP of the target server; if the target server does not respond to the ping command, after waiting for a first preset time, continuing to send a preset number of ping commands to the network IP of the target server; when the target server does not respond to the ping command within the preset number of times, determining that the target server is down.
[0106] The target server to be tested is matched to the serial number. After the test starts, a series of preset test items are executed on the target server. During the test, the monitoring program is run to check whether the target server is offline. The monitoring program runs in the background and regularly checks whether the target server is still running, that is, whether it is online. If the target server is online, it means that it is running normally and there is no downtime. Figure 2This is a flow chart of determining server downtime provided by an embodiment of the present disclosure. Figure 2 The main process of determining downtime is explained on the right. When it is determined that the target server is offline, further checks are performed. A ping command is sent to the network IP of the target server. The ping command is used to check whether the target server is still reachable in the network. If the target server does not respond to the initial ping command, wait for the first preset time, and then send the ping command again. In the embodiment of the present disclosure, the first preset time is preferably 3 minutes. This process is repeated multiple times (preset times) to ensure that network problems or short system delays are not misjudged as target server downtime. When the target server does not respond to the ping command within the preset number of times, if the target server does not respond within the preset number of times (preferably 3 times), it is determined that the target server has been down.
[0107] The downtime determination process provided by the embodiment of the present disclosure ensures the efficiency and accuracy of the testing process, minimizes human intervention, and improves the degree of automation, thereby ensuring production efficiency and product quality.
[0108] Exemplarily, the method also includes: when it is determined that the target server is not offline, after waiting for a second preset time, sending a ping command to the network IP of the target server, the second preset time is greater than the first preset time; when the target server does not respond to the ping command, after waiting for the first preset time, continuing to send a preset number of ping commands to the network IP of the target server; when the target server does not respond to the ping command within the preset number of times, determining that the target server is down.
[0109] Below Figure 2 The main process of determining downtime is explained on the left. If it is checked that the target server is not offline, after waiting for the second preset time, a ping command is sent to the network IP of the target server. The second preset time is set to a longer time interval, preferably 10 minutes. If the target server does not respond to the ping command after the above time interval (i.e., the second preset time), after waiting for the first preset time, continue to send a preset number of ping commands to the network IP of the target server. If the target server still does not respond within the preset number of times, it is determined that the target server may have been down.
[0110] It should be noted here that, compared with the first preset time, the second preset time is longer, which can effectively reduce the frequency of ping operations, thereby reducing interference with the network and server. Frequent ping operations may consume unnecessary bandwidth and computing resources, especially in large-scale server clusters, and this consumption may significantly affect the overall network performance. In addition, there are often short fluctuations or delays in the network environment. If the ping command is sent too frequently, the server status may be misjudged due to these temporary network problems. A longer time interval can avoid this situation and give the network time to recover stability. A 10-minute time interval can ensure that the server has enough time to complete these tasks and avoid misjudging the server status due to long task processing time. Therefore, the second preset time is preferably 10 minutes in the embodiment of the present disclosure. The first preset time uses a shorter time interval to quickly repeat the detection and confirm whether the server is really down in a shorter time. If the server is only temporarily unresponsive, it may resume normal response during the second or third ping. The 3-minute interval can quickly discover the true status of the server and prevent misjudgment caused by short-term network jitter. This design balances efficiency and accuracy, ensuring that the production process will not be affected by misjudgment. Therefore, as mentioned above, in the embodiment of the present disclosure, the first preset time is preferably 3 minutes.
[0111] Exemplarily, running the monitoring program to check whether the target server is offline includes: running the monitoring program to obtain the estimated running time of the target test item; if the actual running time of the test program of the target test item exceeds the estimated running time, determining that the target server is offline.
[0112] The monitoring program will continuously detect the running status of the target server, especially to determine whether the target server is offline. Before each test item starts, the estimated running time is calculated based on the configuration of the target server and the type of target test item. Specifically, the estimated running time is calculated based on historical data, the complexity of the test item, and the hardware configuration of the target server (such as memory size, number of CPU cores, memory speed, etc.). The estimated running time is used to determine whether the test item is executed as planned. At the same time, the monitoring program tracks the actual running time of each test item and compares it with the estimated running time. If the actual running time of the test item exceeds the estimated running time, it means that the test item has fallen into some abnormal state, such as an infinite loop, hardware failure, or test interruption caused by downtime. At this point, the target server is determined to be offline.
[0113] Exemplarily, the method also includes: when the target test item is a memory stress test, running the test program of the memory stress test in rounds; after each round of memory stress test is completed, checking whether the target server is offline; when it is determined that the target server is offline, obtaining the memory configuration parameters of the target server, the memory configuration parameters including memory size, memory speed, number of CPU cores and memory performance parameters; determining the round running time of the memory stress test according to the memory configuration parameters of the target server through a memory stress test tool IMT, and adjusting the estimated running time of the memory stress test according to the round running time; modifying the test program of the memory stress test from an offline state to a normal state, performing the next round of memory stress test on the target server, and regularly checking whether the target server is down; when it is detected that the target server is down, determining the part number and baseboard management controller IP address of the target server from the database according to the serial number identifier of the target server; and capturing the one-key log of the target server according to the part number and baseboard management controller IP address of the target server.
[0114] Unlike other test items, the memory stress testing tool IMT is not simply executed on a scheduled basis, but is tested in rounds. After each round of memory testing is completed, check whether the preset test time is reached. If not, proceed to the next round of testing. The running time of the memory stress test is affected by the server hardware configuration (such as memory size, memory speed, number of CPU cores, memory performance parameters, etc.). Due to the different configurations of each server, the running time of IMT is not fixed. Therefore, it is necessary to dynamically adjust the test time according to the actual situation to ensure that the test can effectively cover all possibilities of memory failures. In summary, the present disclosure considers the case where the target test item is a memory stress test separately.
[0115] When the server performs a memory stress test, the IMT tool executes it in rounds. After each round of testing, a judgment is made to check whether the test has reached the preset time. After each round of testing, the status of the target server is checked. Once the target server is determined to be offline, the memory configuration parameters of the target server are obtained from the database, including memory size (mem_size), memory speed (mem_speed), number of CPU cores (cpu_cores), and memory performance parameters (mem_mlc). The present disclosure embodiment provides the following formula to calculate the round running time of the memory stress test:
[0116]
[0117] In the formula, mem_size is the memory size in GB; cpu_cores is the number of CPU cores; mem_speed is the memory speed in MHz; mem_mlc is the memory performance parameter, which indicates the multi-level cache performance of the memory. According to the round running time calculated above, the estimated running time of the memory stress test is dynamically adjusted. If the target server resumes normal operation after the estimated running time of the memory stress test is adjusted, the test continues, and the IMT program is changed from the offline state to the normal state to enter the next round of memory stress test. Even if the test machine enters the offline state, the IMT program can still dynamically adjust the test time to ensure that the stress test will not stop until it is completed, and avoid the test from failing to end correctly due to network jitter or other problems. Continue to monitor the memory test process and regularly check whether the target server is down. Once the server is confirmed to be down, the part number and baseboard management controller (BMC) IP address of the target server are obtained from the database according to the serial number of the target server. Then, call the script to automatically capture the one-key log and store it in the specified server location for subsequent analysis and maintenance.
[0118] By dynamically adjusting the test time and automating downtime detection and log capture, the present invention effectively solves the problem of being unable to estimate the test time during memory stress testing due to variable configurations. At the same time, it ensures the comprehensiveness of memory stress testing and prevents servers with hidden dangers from flowing to customers, thereby improving production efficiency and product quality.
[0119] Exemplarily, the method further includes: when it is determined that the target server is offline, sending a ping command to the network IP of the target server; when the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, after waiting for a third preset time, executing the step of sending a ping command to the network IP of the target server.
[0120] Below Figure 2 The branch loop process on the right is explained. When it is determined that the target server is offline, a ping command is sent to the network IP address of the server to check whether the target server can still respond to network requests. If the server responds to the ping command normally, it means that the server is still online and no further measures need to be taken immediately. Alternatively, the server has one or a small number of ping failures, but can still resume normal response within a preset number of times. This is considered a temporary network fluctuation rather than a serious downtime. After waiting for a third preset time period, the ping command is sent again to continue to cyclically monitor the status of the server. In the disclosed embodiment, the third preset time is preferably 5 minutes, because the 5-minute time interval is long enough to balance the impact of short-term network jitters without excessively delaying the detection of problems.
[0121] Exemplarily, the method further includes: when it is determined that the target server is not offline, after waiting for a second preset time, sending a ping command to the network IP of the target server; when the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, executing the step of checking whether the target server is offline.
[0122] Below Figure 2 The branch loop process on the left is explained. When it is determined that the target server is not offline, that is, the server is still connected to the network and can respond to the ping command, periodic monitoring continues to ensure its continued normal operation. The ping command will not be sent again immediately, but the second preset time period will be waited for to avoid too frequent network checks, thereby reducing unnecessary network and system resource consumption. After waiting for the second preset time, the ping command is sent to the network IP address of the target server again to check whether the server is still online. This process is part of the system monitoring loop, which confirms the status of the server by sending ping commands regularly. If the server responds to the ping command normally, it means that the server is still online and running normally, and no further action is needed at this time. Alternatively, if the server has a small number of ping failures but resumes normal response within the preset number of times, this situation is regarded as a temporary network fluctuation rather than a serious downtime problem, and the status of the target server continues to be monitored, and the target server is checked regularly in a cycle to see if it is offline.
[0123] Exemplarily, the method further includes: when the target server is put on the shelf, recording the rack number and the putting on the shelf time of the target server, the rack number representing the position of the target server in the test rack; saving the serial number, rack number and the putting on the shelf time of the target server to the database; naming the one-key log according to the serial number, part number, rack number and the putting on the shelf time of the target server;
[0124] The method further includes: determining a target server where downtime occurs from a plurality of servers in a test rack according to the name of the one-key log.
[0125] When the target server is assembled, the next step is to move it to the test rack for racking. Rack operation refers to installing the server in a specified physical location (rack) for subsequent testing. In order to ensure management and tracking during the test process, the following information is recorded when racking: rack number, which identifies the specific location of the target server in the test rack. Each rack may contain multiple servers, and the position of each server in the rack is unique, represented by the rack number; racking time, the specific time point when the server is installed on the rack, is used to record and manage the test timeline. These two pieces of information are saved to the database together when they are racked and associated with the serial number of the target server. During the test process, if the target server goes down, capture the one-key log for analysis. Name the one-key log according to the serial number, part number, rack number and racking time of the target server. The naming rules can be as follows:
[0126] Workbench number_PN_List_SN_Time_onekeylog.tar.
[0127] Once a one-click log is generated, the system or operator can quickly determine which server has experienced a downtime by looking at the name of the one-click log. Because the log name contains key information such as the rack number and serial number, the physical location (specific location in the rack) and identity of the target server that experienced a downtime can be quickly located.
[0128] Assume that a server with a serial number of 24C620338 is put on the rack at W3-N1-B4 and crashes at a certain time (for example, 17:00 on July 5, 2024). After detecting this, the server information is extracted from the database and a one-key log is generated. At this time, assume that the file name of the one-key log is:
[0129] W3-N1-B4_NF5280M6_60053691_24C620338_20240705170000_onekeylog.tar;
[0130] By using the log name, the maintenance personnel can quickly locate the target server at W3-N1-B4 that has experienced a downtime, and perform fault analysis and repair based on the log content. In this way, maintenance operations can be carried out in a timely and accurate manner, preventing the faulty server from entering the customer's use phase.
[0131] Exemplarily, after capturing the one-click log of the target server according to the part number and baseboard management controller IP address of the target server, the method further includes: using a log analysis tool to automatically analyze the one-click log and generate an analysis report; the analysis report includes the cause of the downtime, the hardware modules involved, relevant log information and recommended maintenance measures; and saving the analysis report together with the one-click log to a database.
[0132] After grabbing the one-click log, the log analysis tool is automatically called to conduct an in-depth analysis of the log file. These tools can parse various information in the log, such as hardware status, error information, temperature data, etc., to find out the root cause of the downtime. After the automated analysis is completed, a detailed analysis report is generated. The report includes the cause of the downtime, the hardware modules involved, the relevant log information, and the recommended repair measures. The analysis report and the original one-click log will be saved in the database for future reference or further analysis. At the same time, the analysis results are pushed to the relevant operators or maintenance personnel to ensure that they get the downtime information and repair suggestions at the first time, so that they can quickly perform troubleshooting and repair operations. It not only improves the efficiency of fault handling, but also reduces the hidden dangers that may be caused by manual analysis errors, further ensuring the stability of the production line and delivery quality.
[0133] The disclosed embodiment mainly takes the target server as the object to illustrate the process of one-click log capture. The following describes the overall process of one-click log capture of a downtime server in combination with an actual scenario (i.e., multiple servers to be tested). Figure 3 FIG. 1 is a flow chart of a method for capturing a downtime server log with one key provided by an embodiment of the present disclosure. Figure 3As shown, multiple servers to be tested are installed on the designated server rack. These servers are assigned unique rack numbers to identify their physical locations in the test rack. After the racking is completed, each server is powered on in turn and starts to work. In this process, the hardware information of each server (including serial number, part number, baseboard management controller IP address and network IP, etc.) is automatically collected and saved in the central database. The Diag server, as the server responsible for managing and monitoring all servers to be tested, starts a one-key log capture program, which runs continuously to monitor the status of all connected servers. The log capture program preliminarily configures the hardware information of each server and is ready to capture logs at any time. The Diag server inspects the status of all servers by sending ping commands or other monitoring signals regularly. The monitoring program checks whether the server is online and working properly. If it is detected that a server does not respond to the ping command or other status monitoring signal, the server is marked as possibly down and further checked. After sending the ping command multiple times and receiving no response, the Diag server confirms that the server is down. At this time, according to the serial number of the down server, the part number and baseboard management controller IP address of the server are obtained from the database. Based on the information in the database, the specific model of the downed server is determined. This judgment may be crucial for subsequent log analysis, because different models may involve different log file formats or specific analysis tools. Based on the acquired part number and baseboard management controller IP address, the Diag server performs a one-click log capture operation to extract the relevant log files before and after the downtime from the downed server. The captured log files are saved to the central database together with the hardware information of the downed server, the time when the downtime occurred, the model, and other information. The log files are named for easy identification. These log files can be further analyzed after the failure occurs to find out the cause of the downtime and take appropriate repair measures. In addition, the storage of log files can also be used for long-term monitoring data accumulation for future trend analysis or prediction.
[0134] Figure 4 : is a schematic diagram of the architecture of a one-key log capture device for a server provided by an embodiment of the present disclosure, such as Figure 4 As shown, the device comprises:
[0135] The saving module 201 is used to save the hardware information of the target server to the database after the target server to be tested is powered on, wherein the hardware information includes a serial number, a part number and an IP address of a baseboard management controller;
[0136] A checking module 202 is used to test the target test items on the target server and regularly check whether the target server is down;
[0137] The determination module 203 is used to determine the part number and baseboard management controller IP address of the target server from the database according to the serial number of the target server when it is detected that the target server is down;
[0138] The one-key log capture module 204 is used to capture the one-key log of the target server according to the part number and baseboard management controller IP address of the target server.
[0139] Exemplarily, the hardware information also includes a network IP; the inspection module includes:
[0140] A target server determination submodule, configured to determine the target server based on the serial number of the target server;
[0141] A test submodule, used to test the target test items on the target server;
[0142] A monitoring submodule, used to run a monitoring program to check whether the target server is offline;
[0143] A command sending submodule, used for sending a ping command to the network IP of the target server when it is determined that the target server is offline;
[0144] A continue sending submodule is used for continuing to send a preset number of ping commands to the network IP of the target server after waiting for a first preset time if the target server does not respond to the ping command;
[0145] The downtime determination submodule is used to determine that the target server is down when the target server does not respond to the ping command within a preset number of times.
[0146] Exemplarily, the device further comprises:
[0147] A first command sending module is used to send a ping command to the network IP of the target server after waiting for a second preset time when it is determined that the target server is not offline, and the second preset time is greater than the first preset time;
[0148] A continuing sending module, configured to continue sending a preset number of ping commands to the network IP of the target server after waiting for the first preset time if the target server does not respond to the ping command;
[0149] The downtime determination module is used to determine that the target server is down when the target server does not respond to the ping command within a preset number of times.
[0150] Exemplarily, the monitoring submodule includes:
[0151] An acquisition unit, used for running the monitoring program to acquire the estimated running time of the target test item;
[0152] The determination unit is used to determine that the target server is offline when the actual running time of the test program of the target test item exceeds the estimated running time.
[0153] Exemplarily, the device further includes:
[0154] A round running module, used for running the test program of the memory stress test in rounds when the target test item is a memory stress test;
[0155] A round checking module, used to check whether the target server is offline after each round of memory stress testing is completed;
[0156] A parameter acquisition module, used to acquire memory configuration parameters of the target server when it is determined that the target server is offline, wherein the memory configuration parameters include memory size, memory speed, number of CPU cores, and memory performance parameters;
[0157] A time adjustment module, used to determine the round running time of the memory stress test according to the memory configuration parameters of the target server through the memory stress test tool IMT, and adjust the estimated running time of the memory stress test according to the round running time;
[0158] A modification module, used to modify the test program of the memory stress test from an offline state to a normal state, perform the next round of memory stress test on the target server, and regularly check whether the target server is down;
[0159] A memory stress test determination module, used to determine the part number and baseboard management controller IP address of the target server from the database according to the serial number identifier of the target server when the target server is detected to be down;
[0160] The memory stress test one-click log capture module is used to capture the one-click log of the target server according to the part number and baseboard management controller IP address of the target server.
[0161] Exemplarily, the device further includes:
[0162] A second command sending module is used to send a ping command to the network IP of the target server when it is determined that the target server is offline;
[0163] The first repetitive module is used for, when the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, after waiting for a third preset time, executing the steps of: sending a ping command to the network IP of the target server;
[0164] The device also includes:
[0165] A third command sending module is used to send a ping command to the network IP of the target server after waiting for a second preset time when it is determined that the target server is not offline;
[0166] The second repetitive module is used to execute the step of checking whether the target server is offline when the target server responds to the ping command normally or when the target server responds to the ping command normally within a preset number of times.
[0167] Exemplarily, the device further includes:
[0168] A recording module, used for recording the rack number and the time of the target server being put on the rack when the target server is put on the rack, wherein the rack number represents the position of the target server in the test rack;
[0169] A rack information saving module, used to save the serial number, rack number and shelf time of the target server to the database;
[0170] A naming module, used for naming the one-key log according to the serial number, part number, rack number and shelf time of the target server;
[0171] The device also includes:
[0172] The downtime server determination module is used to determine the target server where downtime occurs from multiple servers in the test rack according to the name of the one-key log.
[0173] The embodiment of the present disclosure also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned one-key log capture method embodiment on a server are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0174] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned one-key log capture method embodiment on a server is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other.
[0175] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, devices, electronic devices, and storage media. Therefore, the embodiments of the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0176] The embodiments of the present disclosure are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a server, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded into a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable terminal device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0177] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present disclosure.
[0178] Finally, it should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "include..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements. The one-key log capture method and device for a server provided by the present disclosure are described in detail above. The principles and implementation methods of the present disclosure are explained in this article using specific examples. The description of the above embodiments is only used to help understand the method and its core idea of the present disclosure; at the same time, for those of ordinary skill in the art, according to the idea of the present disclosure, there will be changes in the specific implementation method and scope of application. In summary, the content of this specification should not be understood as a limitation on the present disclosure.
Claims
1. A one-click log capture method for a server, characterized in that: The method comprises: After the target server to be tested is powered on, the hardware information of the target server is saved to a database, the hardware information including the serial number, part number and baseboard management controller IP address; Performing a target test item test on the target server, and regularly checking whether the target server is down; In the case where it is detected that the target server is down, determining the part number and baseboard management controller IP address of the target server from the database according to the serial number of the target server; The one-key log of the target server is captured according to the part number and baseboard management controller IP address of the target server.
2. The method according to claim 1, characterized in that: The hardware information also includes a network IP; the testing of the target test items on the target server and regularly checking whether the target server is down include: Determining the target server based on the serial number of the target server; Performing a test of a target test item on the target server; Run a monitoring program to check whether the target server is offline; When it is determined that the target server is offline, a ping command is sent to the network IP of the target server; If the target server does not respond to the ping command, after waiting for a first preset time, continue to send a preset number of ping commands to the network IP of the target server; When the target server does not respond to the ping command within a preset number of times, it is determined that the target server is down.
3. The method according to claim 2, characterized in that The method further comprises: When it is determined that the target server is not offline, after waiting for a second preset time, sending a ping command to the network IP of the target server, where the second preset time is greater than the first preset time; If the target server does not respond to the ping command, after waiting for the first preset time, continue to send a preset number of ping commands to the network IP of the target server; When the target server does not respond to the ping command within a preset number of times, it is determined that the target server is down.
4. The method according to claim 2, characterized in that: The running monitoring program to check whether the target server is offline includes: Running the monitoring program to obtain the estimated running time of the target test item; When the actual running time of the test program of the target test item exceeds the estimated running time, it is determined that the target server is offline.
5. The method according to claim 1, characterized in that The method further comprises: When the target test item is a memory stress test, running the test program of the memory stress test in rounds; After each round of memory stress testing is completed, check whether the target server is offline; When it is determined that the target server is offline, obtaining memory configuration parameters of the target server, wherein the memory configuration parameters include memory size, memory speed, number of CPU cores, and memory performance parameters; Determine the round running time of the memory stress test according to the memory configuration parameters of the target server through the memory stress test tool IMT, and adjust the estimated running time of the memory stress test according to the round running time; Modify the test program of the memory stress test from an offline state to a normal state, perform the next round of memory stress test on the target server, and regularly check whether the target server is down; In the case where it is detected that the target server is down, determining the part number and baseboard management controller IP address of the target server from the database according to the serial number identification of the target server; The one-key log of the target server is captured according to the part number and baseboard management controller IP address of the target server.
6. The method according to claim 2 or 3, characterized in that: The method further comprises: When it is determined that the target server is offline, a ping command is sent to the network IP of the target server; In the case where the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, after waiting for a third preset time, executing the steps of: sending a ping command to the network IP of the target server; The method further comprises: When it is determined that the target server is not offline, after waiting for a second preset time, sending a ping command to the network IP of the target server; In the case that the target server responds to the ping command normally, or when the target server responds to the ping command normally within a preset number of times, the step of checking whether the target server is offline is performed.
7. The method according to claim 1, characterized in that The method further comprises: When the target server is put on the shelf, the rack number and the time of putting on the shelf of the target server are recorded, wherein the rack number represents the position of the target server in the test rack; Saving the serial number, rack number and shelf time of the target server to the database; Naming the one-key log according to the serial number, part number, rack number and shelf time of the target server; The method further comprises: According to the name of the one-key log, a target server where downtime occurs is determined from multiple servers in the test rack.
8. A one-click log capture device for a server, characterized in that: The device comprises: A saving module is used to save the hardware information of the target server to be tested to a database after the target server is powered on, wherein the hardware information includes a serial number, a part number and an IP address of a baseboard management controller; A checking module, used to test the target test items on the target server and regularly check whether the target server is down; A determination module, configured to determine the part number and baseboard management controller IP address of the target server from the database according to the serial number of the target server when the target server is detected to be down; The one-key log capture module is used to capture the one-key log of the target server according to the part number and baseboard management controller IP address of the target server.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.