A python-based multi-thread remote server stability test system and method
The Python-based multi-threaded remote server stability testing system enables parallel testing of multiple servers without complex configuration, solving the problems of cumbersome testing processes, insufficient security, and low efficiency in existing technologies. It improves testing efficiency and security and supports large-scale cluster testing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN GOOXI INFORMATION SECURITY CO LTD
- Filing Date
- 2026-01-12
- Publication Date
- 2026-05-29
Smart Images

Figure CN121501688B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of server testing technology, specifically relating to a multi-threaded remote server stability testing system and method with a GUI, which is suitable for parallel stability testing scenarios of multiple servers and can realize remote control of various testing modes such as AC loop, powercycle, and reboot. Background Technology
[0002] Server stability testing is a crucial step in ensuring reliable equipment operation. Existing testing methods often require executing test scripts directly within the operating system of the server under test, which has the following drawbacks:
[0003] 1. The test preparation process is cumbersome: the test scripts need to be manually uploaded to each server under test, the OS passwordless login permissions need to be configured, and the startup scripts need to be set up, which is time-consuming and labor-intensive.
[0004] 2. Insufficient security: Configuring passwordless login will reduce the server's security level, posing a risk of data leakage or unauthorized access;
[0005] 3. Low testing efficiency: It cannot control multiple servers to perform parallel testing at the same time, and different servers need to be configured with test parameters separately, which is not suitable for large-scale server cluster testing;
[0006] 4. Difficulty in tracing anomalies: Test logs are mostly stored locally on the server under test, requiring additional operations to retrieve them, and lack comparative analysis with the initial state, making it difficult to quickly locate the cause of the anomaly.
[0007] Therefore, there is an urgent need for a remote server stability testing solution that requires no complex pre-configuration, supports multi-threaded parallel testing, and is secure and efficient. Summary of the Invention
[0008] This invention aims to provide a Python-based multi-threaded remote server stability testing system and method. Through GUI visualization and SSH remote communication, it enables parallel stability testing of multiple servers, simplifies the testing process, avoids security risks associated with passwordless login, and improves testing efficiency and anomaly tracing capabilities.
[0009] This invention is specifically achieved through the following technical solution:
[0010] A Python-based multi-threaded remote server stability testing system includes a GUI interaction module, a multi-threaded control module, an SSH communication module, a PDU control module, a log management module, and a status comparison module.
[0011] The GUI interaction module provides a parameter input and test control interface, which supports inputting the IP address of the server under test, OS username, OS password, and port number, selecting the test method, setting the number of tests, displaying the test progress, and supporting the creation of multiple independent test windows;
[0012] The multi-threaded control module is used to create and manage multiple test threads, each thread corresponding to a server under test, to achieve parallel testing;
[0013] The SSH communication module is used to establish an SSH remote connection between the local device and the server under test, collect server component information, and issue test commands.
[0014] The PDU control module is used to control the PDU to perform power-on and power-off operations, in order to realize the AC cycle test mode.
[0015] The log management module is used to collect and store test logs out of band. The logs are stored in the script execution path of the local device.
[0016] The status comparison module is used to compare the server component information collected each time with the baseline information collected the first time, and mark abnormal differences.
[0017] As a further improvement of the present invention, the testing method includes three modes: AC cycle, reboot, and power cycle. In the AC cycle mode, the PDU controls the server to power down and wait 60 seconds before powering it back on. In the reboot mode, a reboot command is sent via SSH. In the power cycle mode, a power cycle command is sent via the ipmitool tool.
[0018] As a further improvement of the present invention, the server component information includes at least one of the following: CPU model, memory capacity, hard disk configuration, network card information, and BIOS version.
[0019] As a further improvement of the present invention, the GUI interaction module is developed based on the Tkinter or PyQt framework, with each server under test corresponding to an independent test window, supporting independent parameter configuration and control.
[0020] This invention also provides a Python-based method for testing the stability of a multi-threaded remote server, applied to the aforementioned testing system. The method includes the following steps:
[0021] S1: Start the GUI interaction module, create at least one test window, input the parameters of the server under test, select the test method, and set the number of tests;
[0022] S2: The multi-threaded control module creates an independent test thread for each server under test;
[0023] S3: Establish a remote connection via the SSH communication module and collect server component information as baseline information for the first time;
[0024] S4: Execute the corresponding test operation according to the selected test method;
[0025] S5: After the server restarts or powers on, component information is collected again, compared with baseline information, and test logs are recorded.
[0026] S6: Repeat steps S4-S5 until the set number of tests is reached, and the GUI interaction module updates the test progress in real time.
[0027] S7: After the test is completed, a complete test report is generated and stored locally.
[0028] As a further improvement of the present invention, in step S1, the parameters of the server under test include IP address, port number, OS username, and OS password; in step S6, the test progress includes the number of times already performed and the number of times remaining.
[0029] As a further improvement of the present invention, in step S4, when performing the AC cycle test, the PDU control module controls the server to power down and wait 60 seconds before powering it back on; when performing the reboot test, a reboot command is sent via SSH; when performing the power cycle test, a power cycle command is sent via the ipmitool tool.
[0030] As a further improvement of the present invention, in step S5, if there is a difference between the collected component information and the baseline information, the log management module marks the difference as abnormal and records it in the log.
[0031] The beneficial effects of this invention are: 1. Simplified testing process: No need to upload scripts, configure passwordless login, or start the test on boot; tests can be started directly by inputting parameters through the GUI, significantly shortening test preparation time; 2. Enhanced security: SSH username + password authentication method is adopted to avoid security risks associated with passwordless login; 3. Significantly improved testing efficiency: Supports multi-threaded parallel control, enabling simultaneous stability testing of multiple servers under different modes and parameters, adapting to large-scale cluster testing scenarios; 4. Convenient anomaly tracing: Out-of-band log collection and storage locally allows for quick location of anomaly differences by comparing baseline information with each collected data, facilitating problem troubleshooting; 5. Intuitive and user-friendly operation: The GUI visual interface lowers the operational threshold, test progress is displayed in real time, and parameter configuration is flexible, suitable for different testing needs. Attached Figure Description
[0032] Figure 1 This is a schematic diagram illustrating the application scenario of the present invention;
[0033] Figure 2 This is a schematic diagram of the functional modules of the Python-based multi-threaded remote server stability testing system of the present invention;
[0034] Figure 3 This is a flowchart of the pre-detection and initialization part of the test method of the present invention;
[0035] Figure 4 This is a flowchart of the power supply cycle control section in the test method of the present invention;
[0036] Figure 5 This is a flowchart of the state detection and log comparison part of the test method of the present invention;
[0037] Figure 6 This is a diagram of the GUI test interface of the present invention. Detailed Implementation
[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] A PDU (Power Distribution Unit) is an intelligent device for distributing power. It converts a single input power source into multiple output ports, providing stable power to multiple electronic devices (such as servers and testing instruments). It also features intelligent functions such as remote control and status monitoring, unlike ordinary power strips (which only provide power extension and lack remote control capabilities). In this server stability testing technical solution, the PDU is a core hardware component. Figure 1 As shown, the control terminal connects to the PDU and the server under test via a network, and the PDU is connected to the server under test via a power cord.
[0040] like Figure 2 As shown, the present invention provides a Python-based multi-threaded remote server stability testing system.
[0041] The system includes a GUI interaction module, a multi-threaded control module, an SSH communication module, a PDU control module, a log management module, and a status comparison module, with the following specific structure:
[0042] GUI Interaction Module: Built on a Python graphical development framework, it provides a parameter input and test control interface. It supports inputting the IP address of the server under test, OS username, OS password, and port number, selecting the test method (AC cycle, reboot, power cycle), setting the number of tests, and displaying the test progress (number of tests performed and number of tests remaining). It also supports creating multiple test windows to achieve independent parameter configuration and parallel control of multiple servers.
[0043] Multi-threaded control module: Used to create and manage multiple test threads, each thread corresponds to one server under test, executes the test process independently, and the threads do not interfere with each other. It supports controlling at least two servers at the same time to perform stability tests in the same or different modes.
[0044] SSH communication module: Used to establish an SSH remote connection between the local device and the server under test. No passwordless login configuration is required. The identity is verified by entering the OS username and password, enabling the collection of server component information, the issuance of test commands, and the out-of-band collection of logs.
[0045] PDU control module: Used to control the PDU (Power Distribution Unit) to perform power-on and power-off operations, and to implement ACcycle test mode. It supports waiting for a preset time (default 60 seconds) after the server is powered off before powering on, to ensure that the server is completely powered off.
[0046] Log management module: Used to store out-of-band collected test logs. The logs are stored in the script execution path of the local device and include test time, server IP, component information, exception records, etc. It supports real-time recording and traceability of logs.
[0047] Status comparison module: It is used to compare the server component information collected in each test with the baseline information collected in the first test. If there is a difference, it is marked as an anomaly and recorded in the anomaly log.
[0048] Furthermore, the testing methods include three modes: AC cycle, reboot, and power cycle.
[0049] AC cycle mode: The server is powered off via PDU → waits 60 seconds → is powered on to complete one cycle test;
[0050] reboot mode: Controls the server to reboot the operating system by issuing reboot commands via SSH;
[0051] Power cycle mode: Power cycle commands are issued via the ipmitool tool to disconnect and reconnect the server power.
[0052] Furthermore, the server component information includes hardware and system configuration information such as CPU model, memory capacity, hard disk configuration, network card information, and BIOS version, which serve as benchmark data for status comparison.
[0053] Furthermore, the GUI interaction module is developed based on the Tkinter or PyQt framework, supports independent window configuration, and each server under test corresponds to an independent test window, which facilitates parameter management and progress monitoring.
[0054] like Figure 3-5 As shown, the Python-based multi-threaded remote server stability testing method of the present invention, applied to the above-mentioned testing system, includes the following steps:
[0055] 1. Test preparation steps:
[0056] Run the Python-based test script, start the GUI interactive module, and create at least one new test window;
[0057] In each test window, enter the parameters for the server under test: IP address, port number, OS username, OS password, select the test method (AC cycle / reboot / power cycle), and set the number of tests;
[0058] 2. Test startup steps:
[0059] Click the "Start Test" button, and the multi-threaded control module will create an independent test thread for each server under test;
[0060] Each thread establishes a remote connection to the server under test via the SSH communication module using the entered username and password, without the need to configure passwordless login;
[0061] 3. Baseline Information Acquisition Steps:
[0062] After the SSH connection is established, the first component information (CPU, memory, hard disk, etc.) of the server under test is collected and stored in the log management module as baseline information.
[0063] Stability test execution steps:
[0064] Execute the corresponding test operation based on the selected test method:
[0065] In AC cycle mode: The PDU control module sends a power-down command to the PDU, waits 60 seconds to ensure the server is completely powered down, and then sends a power-on command.
[0066] In reboot mode: Reboot commands are sent via SSH to control the server operating system to restart;
[0067] In power cycle mode: the server power is restarted by issuing a power cycle command through the ipmitool tool;
[0068] 5. Status comparison and log recording steps:
[0069] After the server restarts or powers on, the component information is collected again via the SSH communication module, and the status comparison module compares it with the baseline information.
[0070] The log management module records the test time, server IP, collected component information, and comparison results to the local log. If there are discrepancies, it will be marked as an anomaly and the anomaly details will be recorded.
[0071] 6. Steps for iterative testing and progress updates:
[0072] Repeat steps S6-S8 until the set number of tests is reached;
[0073] The GUI interactive module updates the test progress in real time, displaying the number of tests completed and the number of tests remaining for each server;
[0074] 7. Test completion steps:
[0075] After all tests are completed, the SSH connection and test thread are closed, and the log management module generates a complete test report, which is stored in the local script path.
[0076] The test system in this embodiment is developed based on Python 3.8. The GUI interaction module uses the Tkinter framework, the SSH communication module uses the paramiko library, and the multi-threaded control module is implemented based on the threading library.
[0077] Local test equipment configuration: CPU is Intel Core i7, memory is 16GB, and operating system is Windows 10;
[0078] The servers under test are 2, with IP addresses of 192.168.29.48 and 192.168.28.212 respectively. Both are running Linux, with the username root and password Gooxi123.
[0079] PDU device: A smart PDU that supports remote control and connects to the local device network to perform power-on / power-off operations for AC cycle testing.
[0080] like Figure 6As shown, the testing method in this embodiment includes the following specific operations:
[0081] Run the test script, start the GUI interactive module, and create two new test windows;
[0082] Enter the following parameters in the first window: IP=192.168.29.48, port number=22, username=root, password=Gooxi123, test method=ipmitool power cycle, number of tests=1000;
[0083] Enter the following parameters in the second window: IP=192.168.28.212, port number=22, username=root, password=Gooxi123, test mode=AC cycle, number of tests=500;
[0084] Click the "Start Test" button in both windows, and the multi-threaded control module will create two independent test threads;
[0085] Thread 1 connects to 192.168.29.48 via SSH, collects information on components such as CPU and memory as a baseline, issues the ipmitool power cycle command, restarts, collects component information again and compares it with the baseline, and records the log.
[0086] Thread 2 connects to 192.168.28.212 via SSH, collects baseline information, sends a power-down command through the PDU control module, waits 60 seconds before powering on, restarts, collects and compares information, and records logs.
[0087] The GUI interaction module updates the progress in real time: Thread 1 displays "427 tests have been performed in this round, 573 tests remain", and Thread 2 displays "233 tests have been performed in this round, 267 tests remain".
[0088] After the test is completed, two independent log files are generated and stored in the local script path, containing the time of each test, the status comparison results, and the exception records.
[0089] The above embodiments enable parallel stability testing of two servers without the need for complex pre-configuration, improve testing efficiency by more than 50%, and allow for direct local traceability of logs, making anomaly location convenient.
[0090] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A Python-based multithreaded remote server stability testing system, characterized in that, The system includes a GUI interaction module, a multi-threaded control module, an SSH communication module, a PDU control module, a log management module, and a status comparison module. The GUI interaction module provides a parameter input and test control interface, supporting input of the IP address of the server under test, OS username, OS password, and port number; selection of test mode; setting of test count; display of test progress; and support for creating multiple independent test windows. The test modes include AC cycle, reboot, and power cycle. In AC cycle mode, the server is powered down via PDU and waits 60 seconds before being powered back on. In reboot mode, a reboot command is issued via SSH. In power cycle mode, a power cycle command is issued via the ipmitool tool. The multi-threaded control module is used to create and manage multiple test threads, each thread corresponding to a server under test, to achieve parallel testing; The SSH communication module is used to establish an SSH remote connection between the local device and the server under test, collect server component information, and issue test commands. The PDU control module is used to control the PDU to perform power-on and power-off operations, in order to realize the AC cycle test mode. The log management module is used to collect and store test logs out of band. The logs are stored in the script execution path of the local device. The status comparison module is used to compare the server component information collected each time with the baseline information collected the first time, and mark abnormal differences.
2. The system according to claim 1, characterized in that, The server component information includes at least one of the following: CPU model, memory capacity, hard disk configuration, network card information, and BIOS version.
3. The system according to claim 1, characterized in that, The GUI interaction module is developed based on the Tkinter or PyQt framework. Each server under test corresponds to an independent test window, which supports independent parameter configuration and control.
4. A Python-based method for testing the stability of a multi-threaded remote server, applied to the system described in any one of claims 1-3, characterized in that, The method includes the following steps: S1: Start the GUI interaction module, create at least one test window, input the parameters of the server under test, select the test method, and set the number of tests; S2: The multi-threaded control module creates an independent test thread for each server under test; S3: Establish a remote connection via the SSH communication module and collect server component information as baseline information for the first time; S4: Execute the corresponding test operation according to the selected test method; S5: After the server restarts or powers on, component information is collected again, compared with baseline information, and test logs are recorded. S6: Repeat steps S4-S5 until the set number of tests is reached, and the GUI interaction module updates the test progress in real time. S7: After the test is completed, a complete test report is generated and stored locally.
5. The test method according to claim 4, characterized in that, In step S1, the parameters of the server under test include IP address, port number, OS username, and OS password; in step S6, the test progress includes the number of times the test has been performed and the number of times remaining.
6. The test method according to claim 4, characterized in that, In step S4, when performing the AC cycle test, the PDU control module controls the server to power down and wait 60 seconds before powering it back on; when performing the reboot test, a reboot command is sent via SSH; when performing the power cycle test, a power cycle command is sent via the ipmitool tool.
7. The test method according to claim 4, characterized in that, In step S5, if there is a difference between the collected component information and the baseline information, the log management module will mark the difference as an anomaly and record it in the log.