Fault repair method and device, computer equipment and storage medium
By automatically detecting and repairing network failures in the server, using the repair policy table and weight index values, the efficiency and success rate of fault repair are improved, and the problem of low efficiency of fault repair operations in the existing technology is solved.
Patent Information
- Application Number
- CN202411194655.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The existing network fault repair operation is low and relies on manual analysis and troubleshooting, resulting in a long troubleshooting time and affecting network stability.
By implementing automatic fault detection and repair mechanisms in the server, using the repair policy table corresponding to the target fault type, automatically perform repair operations based on network level and weight index values, reducing manual intervention.
It improves the efficiency and success rate of fault repair, reduces the time for manual analysis and exclusion, and enhances the automatic repair capability of network equipment.
Smart Images

Figure CN119155161A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a fault repair method, device, computer equipment and storage medium. Background Art
[0002] With the rapid development of information technology and the continuous expansion of network scale, the stable operation of network equipment plays a vital role in the stability of the entire network. However, in the actual network environment, network equipment may have various faults, such as physical connection problems, equipment aging, configuration errors or external interference. If these faults are not discovered and handled in time, they may cause network service interruption and seriously affect the normal business activities of enterprises and individuals.
[0003] Current network monitoring mainly relies on the Simple Network Management Protocol (SNMP). SNMP can mainly monitor the network link status and basic performance indicators. When abnormal network link status or performance indicators are detected, the technicians are notified to analyze and troubleshoot the problem.
[0004] Thus, the efficiency of the fault recovery operation is low. Summary of the invention
[0005] In view of this, the present invention provides a fault repair method, apparatus, computer equipment, storage medium and program product to solve the problem of low fault repair operation efficiency.
[0006] In a first aspect, the present invention provides a fault repair method, which is applied to a network fault detection system, wherein the network fault detection system includes a server and at least one network device, and the method is executed by the server, and the method includes:
[0007] When a detection instruction is obtained, a fault detection operation is performed on each of the network devices according to the detection instruction, wherein the detection instruction includes a target fault type;
[0008] Receiving a target log generated by any network device during the fault detection operation, wherein the target log includes a target event type, a target network level, and a target communication address;
[0009] Determining whether the target event type is the target fault type;
[0010] When it is determined that the target event type is the target fault type, obtaining a target repair strategy table corresponding to the target fault type;
[0011] According to the target network level and the target repair strategy table, a repair operation is performed on the target network device corresponding to the target communication address.
[0012] A fault repair method provided by the present invention has the following advantages:
[0013] When the server obtains the detection instruction, it can perform the fault detection operation according to the target fault type carried in the detection instruction, and collect the target log in the fault detection operation process. When the target event type in the target log is determined to be the target fault type, the server can perform the repair operation on the target network device through the target repair strategy table and target network level corresponding to the target fault type. During the entire detection process, the server can automatically perform the fault repair operation without the need for technical personnel to perform complex analysis and troubleshooting operations, which can improve the efficiency of the fault repair operation.
[0014] In an optional implementation, the target repair strategy table includes at least one network level, at least one repair strategy corresponding to each of the network levels, and a weight index value corresponding to each of the repair strategies;
[0015] The performing a repair operation on a target network device corresponding to the target communication address according to the target network level and the target repair strategy table includes:
[0016] According to the target network level, determining in the target repair strategy table at least one target repair strategy corresponding to the target network level;
[0017] According to the weight index value corresponding to each of the target repair strategies, a first repair strategy with the largest weight index value is selected from at least one of the target repair strategies;
[0018] According to the first repair strategy, obtaining a first repair script corresponding to the first repair strategy;
[0019] According to the first repair script, a first repair operation is performed on the target network device.
[0020] Specifically, since different network layers may have different causes for the same fault, a corresponding repair strategy is set for each network layer in the target repair strategy table, which can meet the needs of different network layers for fault repair and is more comprehensive. In addition, the weight index value indicates the probability of successful repair of each target repair strategy. Therefore, when repairing for the first time, using the first repair strategy with the largest weight index value can make the probability of successful repair greater, that is, it can improve the efficiency of the repair operation.
[0021] In an optional implementation, after performing a first repair operation on the target network device according to the first repair script, the method further includes:
[0022] Obtaining a target time point for completing the first repair operation;
[0023] Obtain at least one log generated by the target network device after the target time point;
[0024] Determine whether there is a log of the target fault type in at least one of the logs;
[0025] When it is determined that the log of the target fault type does not exist in at least one of the logs, determining that the fault corresponding to the target fault type in the target network device has been repaired;
[0026] or,
[0027] When it is determined that at least one of the logs contains a log of the target fault type, a second repair strategy is selected from at least one of the target repair strategies according to the weight index value corresponding to each of the repair strategies, wherein the weight index value of the second repair strategy is less than the weight index value of the first repair strategy, and is greater than the weight index values of other repair strategies in the target repair strategy table except the first repair strategy;
[0028] Adjusting the weight index value of the second repair strategy to a value greater than the weight index value of the first repair strategy, so that the weight index value of the second repair strategy is an adjustment strategy with the largest weight index value among at least one of the repair strategies;
[0029] According to the second repair strategy, obtaining a second repair script corresponding to the second repair strategy;
[0030] According to the second repair script, a second repair operation is performed on the target network device.
[0031] Specifically, after completing the repair operation, the result of the repair operation can be learned from the log, and in the case of repair failure, other alternative repair strategies can be adopted to further improve the probability of successful repair, that is, to improve the efficiency of the repair operation.
[0032] In an optional embodiment, the method further includes:
[0033] Acquire historical repair data corresponding to the target fault type and the target network level, wherein the historical repair data includes at least one repair strategy and the number of successful repairs for each of the repair strategies;
[0034] Determining whether a third repair strategy is a repair strategy among at least one of the repair strategies included in the historical repair data, wherein the third repair strategy is a strategy that successfully repairs the target network device;
[0035] When it is determined that the third repair strategy is one of the at least one repair strategy included in the historical repair data, updating the number of successful repairs corresponding to the third repair strategy;
[0036] Determine a weight index value of each of the repair strategies in the historical repair data according to the number of successful repairs corresponding to each of the repair strategies in the historical repair data;
[0037] The target repair strategy table is updated according to the weight index value of each of the repair strategies in the historical repair data.
[0038] Specifically, after each successful repair, by updating the target repair strategy table, the next time the target fault type is handled at the target network layer, the repair strategy can be selected according to the latest repair situation. In this way, the target repair strategy table is adjusted in real time according to the real-time repair situation, so that in the subsequent occurrence of the same fault, the repair strategy with the highest success probability can be used to execute the repair strategy, which can improve the repair efficiency.
[0039] In an optional implementation, when it is determined that the third repair strategy is not any of the at least one repair strategy included in the historical repair data, the method further includes:
[0040] The third repair strategy is added to the historical repair data, and the number of successful repairs corresponding to the third repair strategy is set to one.
[0041] Specifically, since technicians may add new repair strategies based on actual conditions, technicians can add new repair strategies to historical repair data accordingly to facilitate subsequent statistics and adjust weight index values for them, so that the target repair strategy table is more consistent with actual conditions and more accurate.
[0042] In an optional embodiment, the method further includes:
[0043] When a target trigger instruction is detected, obtaining current configuration information and preset configuration information of each of the network devices;
[0044] Determining whether the current configuration information of the target network device is consistent with the preset configuration information;
[0045] When it is determined that the current configuration information of the target network device is inconsistent with the preset configuration information, an alarm notification is generated according to the communication address of the target network device.
[0046] Specifically, by timely comparing the current configuration information of the network device with the preset configuration information, it can be found whether the configuration information of the network device has been modified incorrectly, so that the technicians can correct it in time to avoid more serious failures.
[0047] In an optional embodiment, when the target repair strategy table is an initial repair strategy table used when performing an initial detection operation corresponding to the target fault type, the target fault type is a loop fault, and the target network layer is an access layer, the first repair strategy is to restart the port, and the second repair strategy is to close the port.
[0048] Specifically, since the loop failure is likely caused by the access layer itself, when a loop failure occurs in the access layer, the port of the target network device can be restarted to determine whether the corresponding problem is solved after restarting the port. If it cannot be solved, the port can be closed to avoid more serious failures.
[0049] In a second aspect, the present invention provides a fault repair device, which is applied to a network fault detection system, wherein the network fault detection system includes a server and at least one network device, and the device includes:
[0050] A detection module, configured to, when a detection instruction is obtained, perform a fault detection operation on each of the network devices according to the detection instruction, wherein the detection instruction includes a target fault type;
[0051] A receiving module, configured to receive a target log generated by any network device during the fault detection operation, wherein the target log includes a target event type, a target network level, and a target communication address;
[0052] A determination module, used to determine whether the target event type is the target fault type;
[0053] an acquisition module, configured to acquire a target repair strategy table corresponding to the target fault type when it is determined that the target event type is the target fault type;
[0054] A repair module is used to perform a repair operation on a target network device corresponding to the target communication address according to the target network level and the target repair strategy table.
[0055] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the fault repair method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0056] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the fault repair method of the first aspect or any corresponding embodiment thereof.
[0057] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the fault repair method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 is a schematic diagram of the architecture of a network fault detection system according to an embodiment of the present invention;
[0060] Figure 2 is a schematic diagram of the architecture of another network fault detection system according to an embodiment of the present invention;
[0061] Figure 3 is a flowchart of a fault repair method according to an embodiment of the present invention;
[0062] Figure 4 is a flow chart of another fault repair method according to an embodiment of the present invention;
[0063] Figure 5 is a structural block diagram of a fault repair device according to an embodiment of the present invention;
[0064] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0066] The embodiment of the present invention provides a network fault detection system, such as Figure 1 As shown, the network fault detection system includes a server and at least one network device, wherein the network device can be a switch, a router, etc. The server establishes a network communication connection with each network device. In some optional implementations, the network layer is generally divided into a core layer, a convergence layer, and an access layer. Accordingly, when each network device is a switch, the architecture of the network fault detection system can be as follows: Figure 2 As shown, the server is first connected to the core layer switch, the core layer switch is connected to the aggregation layer switch, and the aggregation layer switch is then connected to the access layer switch.
[0067] Network devices may encounter various errors during operation, such as disconnection between devices, configuration information modification, etc. In order to ensure the safe operation of the network fault detection system, the server can detect each network device connected to itself and restore it in time when a fault is detected.
[0068] In the above application scenario, an embodiment of the present invention provides a fault repair method, which improves the efficiency of the fault repair operation by automatically repairing the fault.
[0069] According to an embodiment of the present invention, an embodiment of a fault repair method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0070] In this embodiment, a fault recovery method is provided, which can be executed by the above-mentioned server. Figure 3 is a flow chart of a fault repair method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0071] Step S301: When a detection instruction is obtained, a fault detection operation is performed on each network device according to the detection instruction.
[0072] The detection instruction may include a target fault type, which may be a loop fault, a link fault, a hardware fault, a configuration fault, etc. A loop fault refers to a situation in which a data packet in a network continuously circulates in one or more network paths.
[0073] Specifically, the technician can actively initiate a test, that is, can select a fault type on his own terminal, so that the terminal can generate a detection instruction according to the fault type selected by the technician and send it to the server.
[0074] Alternatively, the server may periodically generate detection instructions according to preset rules, which may specifically be:
[0075] The server may store at least one fault type and a detection sequence corresponding to each fault type. In each cycle, the server may determine the fault type of the current detection cycle based on the fault type detected last time and the detection sequence corresponding to each fault type, and generate a detection instruction based on the fault type of the current detection cycle.
[0076] In some optional implementations, in order to improve the flexibility of detection, the detection instruction may further include identification information or a communication address of at least one network device, so that the server can perform detection on a specified network device.
[0077] In some optional implementations, the server may also obtain the current configuration of each resource of the server, and determine the first number of network devices that can be currently detected based on the number of network devices in the network fault detection system and the preset basic number, determine the second number of fault types that can be detected based on the current configuration of each resource of the server and the basic configuration resource information of each fault type, and select the first number of network devices from at least one network device connected to the server to perform the second number of detections. For example, the resources may be network resources, computing resources, storage resources, etc.
[0078]
[0079] Wherein, N is the first number, D is the number of network devices in the network fault detection system, k is the preset basic number, that is, the pre-specified basic number of network devices when detecting any type of fault, q is the total number of fault types, R net is the current remaining network resources of the server, R net is the current remaining computing resources of the server, R stor is the current remaining storage resource of the server, F i,net is the network resources required for the i-th fault type, F i,comp is the computing resources required for the i-th fault type, F i,compis the computing resources required for the i-th fault type, F i,stor is the storage resource required for the i-th fault type. net , R net and R stor It constitutes the current resource configuration of the server itself.
[0080] In this way, the server can automatically initiate fault detection and perform fault recovery operations in a timely manner when its own resources are sufficient. When its own resources are insufficient, it does not perform fault detection and recovery operations, or performs relatively few fault detection and recovery operations to reasonably use resources.
[0081] Step S302: receiving a target log generated by any network device during a fault detection operation.
[0082] The target log may include the target event type, target network level and target communication address.
[0083] Specifically, the server can integrate network management protocols such as System Log (SysLog) and Simple Network Management Protocol (SNMP). During the detection of network devices, logs can be collected from the detected network devices through the network management protocol. For each collected log, the server can extract key information from the log through a pre-built regular expression or JavaScript Object Notation (JSON), such as the generation time of the log, the event source (for example, whether the log comes from a router or a switch), the physical location, the event type, the network level, the communication address, the port information, etc. For example, the log can be as shown in Table 1.
[0084] Table 1
[0085]
[0086] Step S303: determine whether the target event type is a target fault type.
[0087] Step S304: when it is determined that the target event type is a target fault type, a target repair strategy table corresponding to the target fault type is obtained.
[0088] The target repair strategy table includes at least one network level, at least one repair strategy corresponding to each network level, and a weight index value corresponding to each repair strategy. For example, when the target fault type is a loop fault, the target repair strategy table corresponding to the target fault type may be as shown in Table 2. Table 2 is an initial repair strategy table corresponding to the first detection of a loop fault.
[0089] Table 2
[0090]
[0091]
[0092] Specifically, a fault strategy table corresponding to each fault type may be stored in the server. The server may determine whether the target event type is the target fault type. When the target event type is determined to be the target fault type, it may be considered that the network device corresponding to the target communication address has a fault of the target fault type and needs to be repaired. At this point, the server may determine a target repair strategy table corresponding to the target fault type based on the target fault type. Alternatively, when it is determined that the target event type is not the target fault type, it may be considered that the network device corresponding to the target communication address does not have a fault of the target fault type and does not need to be repaired. At this point, the server may continue to process the next log.
[0093] Step S305: Perform a repair operation on the target network device corresponding to the target communication address according to the target network level and the target repair strategy table.
[0094] Specifically, since the causes of the same fault are different when they occur at different network layers, the server can perform repair operations on the target network device according to the following steps:
[0095] Step 1: According to the target network level, at least one target repair strategy corresponding to the target network level is determined in the target repair strategy table.
[0096] Step 2: According to the weight index value corresponding to each target repair strategy, a first repair strategy with the largest weight index value is selected from at least one target repair strategy.
[0097] Step three: according to the first repair strategy, obtain a first repair script corresponding to the first repair strategy.
[0098] Step 4: Perform a first repair operation on the target network device according to the first repair script.
[0099] Step 5: Obtain the target time point for completing the first repair operation.
[0100] Step six: obtain at least one log generated by the target network device after the target time point.
[0101] Step 7: Determine whether there is a log of the target fault type in at least one log.
[0102] Step eight: when it is determined that there is no log of the target fault type in at least one log, it is determined that the fault corresponding to the target fault type in the target network device has been repaired.
[0103] Step nine: when it is determined that at least one log has a log of the target fault type, a second repair strategy is selected from at least one target repair strategy according to a weight index value corresponding to each repair strategy.
[0104] The weight index value of the second repair strategy is smaller than the weight index value of the first repair strategy, and is larger than the weight index values of other repair strategies in the target repair strategy table except the first repair strategy.
[0105] Step ten: adjust the weight index value of the second repair strategy to a value greater than the weight index value of the first repair strategy, so that the weight index value of the second repair strategy is the adjusted strategy with the largest weight index value among at least one repair strategy.
[0106] Step eleven: according to the second repair strategy, obtain a second repair script corresponding to the second repair strategy.
[0107] Step 12: Perform a second repair operation on the target network device according to the second repair script.
[0108] In Table 2, when the target network layer is the access layer, the first repair strategy is to restart the port, and the second repair strategy is to close the port; or, when the target network layer is the core layer or the aggregation layer, the first repair strategy is to ignore, and the second repair strategy is to restart the port.
[0109] For example, the target fault type is a loop fault, and the target network layer is the core layer. In step one, three target repair strategies corresponding to the "core layer" can be determined, namely "ignore", "restart port" and "close port". The weight index values corresponding to these three target repair strategies are "100", "99" and "98", respectively. The target repair strategy with the largest weight index value is "ignore", that is, the first repair strategy is "ignore". The server can obtain the first repair script according to the first repair strategy and perform the first repair operation. After completing the first repair operation, the server can record the target time point for completing the first repair operation, and select the log after the target time point from the received log for specific analysis, that is, determine whether the event type in the log is the target fault type. If so, it is determined that the fault of the target fault type in the server has not been repaired. If not, it is determined that the fault of the target fault type in the server has been repaired.
[0110] When it is determined that the target fault type in the server has not been repaired, the server can select the target repair strategy "Restart Port" with the second largest weight index value, that is, the second repair strategy is "Restart Port". Then, the server can adjust the weight index value of the second repair strategy to "100" and the weight index value of the first repair strategy to "99". At this time, the second repair strategy in the target repair strategy corresponding to the "core layer" is the target repair strategy with the largest weight index value. Similarly, the server can obtain the second repair script according to the second repair strategy, and execute the second repair operation, and so on, to complete the entire repair operation process.
[0111] For example, after the weight index value is modified, the target repair strategy table may be as shown in Table 3.
[0112] Table 3
[0113]
[0114]
[0115] In some optional implementations, when the server has performed repair operations according to all target repair strategies corresponding to the target network layer, and the target fault type of the server has not been repaired, the server can generate a first alarm notification (the first alarm notification may include information such as the communication address, network layer and physical location of the target network device), and send it to the terminal where the technician is located, and resolve it through manual intervention, so that all faults can be resolved in a timely manner.
[0116] In some optional implementations, when the repair operation is successfully completed through a target repair strategy (for example, the third repair strategy) corresponding to the target network layer, the server may also update the target repair strategy table according to the third repair strategy. Accordingly, the update may be performed through the following specific steps:
[0117] Step 1: Obtain historical repair data corresponding to the target fault type and target network level.
[0118] The historical repair data may include at least one repair strategy and the number of successful repairs for each repair strategy.
[0119] Step 2: Determine whether the third repair strategy is one of the at least one repair strategy included in the historical repair data.
[0120] The third repair strategy is a strategy for successfully repairing the target network device, and may be the first repair strategy or the second repair strategy mentioned above.
[0121] Step three: when it is determined that the third repair strategy is one of the at least one repair strategy included in the historical repair data, the number of successful repairs corresponding to the third repair strategy is updated.
[0122] Step 4: Determine the weight index value of each repair strategy in the historical repair data according to the number of successful repairs corresponding to each repair strategy in the historical repair data.
[0123] Step 5: Update the target repair strategy table according to the weight index value of each repair strategy in the historical repair data.
[0124] Step six: when it is determined that the third repair strategy is not any of the at least one repair strategy included in the historical repair data, the first repair strategy is added to the historical repair data, and the number of successful repairs corresponding to the third repair strategy is set to one.
[0125] In some optional implementations, after each repair operation is performed, the server may update the target repair strategy table regardless of success or failure. Accordingly, the update may be performed through the following specific steps:
[0126] Step 1: Obtain historical repair data corresponding to the target fault type and target network level.
[0127] Among them, the historical repair data may include at least one repair strategy, as well as the number of successful repairs, the number of failed repairs, the total number of repairs for each repair strategy, and the first proportion of the number of successful repairs in the total number of repairs and the second proportion of the number of failed repairs in the total number of repairs.
[0128] Step 2: Determine whether the fourth repair strategy is one of the at least one repair strategy included in the historical repair data.
[0129] Among them, the fourth repair strategy is any target repair strategy.
[0130] Step three, when it is determined that the third repair strategy is one of the at least one repair strategy included in the historical repair data, the number of successful repairs, the number of failed repairs, the total number of repairs, the first ratio and the second ratio corresponding to the fourth repair strategy are updated respectively.
[0131] Step 4: Determine the weight index value of each repair strategy in the historical repair data according to the first ratio or the second ratio corresponding to each repair strategy in the historical repair data.
[0132] The first ratio is directly proportional to the weight index value, and the second ratio is inversely proportional to the weight index.
[0133] Step 5: Update the target repair strategy table according to the weight index value of each repair strategy in the historical repair data.
[0134] Step six: When it is determined that the fourth repair strategy is not any of the at least one repair strategy included in the historical repair data, the fourth repair strategy is added to the historical repair data, and the number of successful repairs, number of failed repairs, total number of repairs, first ratio and second ratio corresponding to the fourth repair strategy are updated.
[0135] In the fault repair method provided in this embodiment, when the server obtains the detection instruction, it can perform the fault detection operation according to the target fault type carried in the detection instruction, and collect the target log in the fault detection operation process. When the target event type in the target log is determined to be the target fault type, the server performs the repair operation on the target network device through the target repair strategy table and target network level corresponding to the target fault type. During the entire detection process, the server can automatically perform the fault repair operation without the need for technical personnel to perform complex analysis and troubleshooting operations, which can improve the efficiency of the fault repair operation.
[0136] Since a failure in the configuration information of a network device is a relatively serious problem, in addition to detection based on logs, a fault repair method is provided in this embodiment, which is specifically used to detect a configuration failure of a network device and can be executed by the above-mentioned server. Figure 4 is a flow chart of a fault repair method according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0137] Step S401, when a target trigger instruction is detected, current configuration information and preset configuration information of each network device are obtained.
[0138] The configuration information may include identification information, communication address, network level, physical location, port information, host name, etc. of the network device.
[0139] Specifically, the server can periodically generate a target trigger instruction, or the technician can perform a configuration detection operation on the terminal, so that the terminal generates a target trigger instruction according to the technician's operation and sends it to the server. In this way, the server can detect the target trigger instruction and obtain the communication address of each network device connected to it. Further, according to the communication address of each network device, the current configuration information and preset configuration information of each network device can be obtained.
[0140] In some optional implementations, the server can use Ansible's Expect script to capture the configuration information of the network device. For example, the Expect script can be as follows:
[0141] "#! / usr / bin / expect
[0142] set timeout 10
[0143] setipaddr[lindex$argv 0]
[0144] setcmd[lindex$argv 1]
[0145] set username AAA
[0146] set password 123456
[0147] spawnsshruijie@$ipaddr
[0148] expect"*password:"{send"$password\n"}
[0149] expect"#"{send"configure terminal\n"}
[0150] expect"#"{send"$cmd\n"}
[0151] expect"#"{send"end\n"}
[0152] expect"#"{send"wr\n"}
[0153] expect"#"{send"exit\n"}
[0154] expect eof"
[0155] The script starts by setting several variables, including the timeout, the communication address of the network device to connect to, the command to execute, the username, and the password. It then uses the spawn command to start a new SSH session, and then sends the password when the "*password:" prompt appears. After a successful login, it waits for the "#" prompt to appear, and then sends the "configure terminal", the user-defined command ($cmd), the end of the configuration, the save configuration, and the exit command.
[0156] Step S402: determine whether the current configuration information of the target network device is consistent with the preset configuration information.
[0157] Step S403: when it is determined that the current configuration information of the target network device is inconsistent with the preset configuration information, an alarm notification is generated according to the communication address of the target network device.
[0158] Specifically, for the target network device, the server can compare each item of information included in its current configuration information with each item of information included in the preset configuration information. As long as any information is inconsistent, it can be considered that configuration drift has occurred. At this time, the server can generate an alarm notification based on the communication address of the target network device and send it to the terminal where the technician is located, so that the technician can perform configuration modification operations.
[0159] The fault repair method provided in this embodiment can detect whether the configuration information of the network device has been modified incorrectly by timely comparing the current configuration information of the network device with the preset configuration information, so as to facilitate technical personnel to correct it in time and avoid more serious faults.
[0160] In this embodiment, a fault recovery device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0161] This embodiment provides a fault recovery device, such as Figure 5 As shown, including:
[0162] The detection module 501 is used to perform a fault detection operation on each network device according to the detection instruction when a detection instruction is obtained, wherein the detection instruction includes a target fault type;
[0163] A receiving module 502 is used to receive a target log generated by any network device during a fault detection operation, wherein the target log includes a target event type, a target network level, and a target communication address;
[0164] A determination module 503 is used to determine whether the target event type is a target fault type;
[0165] An acquisition module 504 is used to acquire a target repair strategy table corresponding to the target fault type when it is determined that the target event type is a target fault type;
[0166] The repair module 505 is used to perform a repair operation on the target network device corresponding to the target communication address according to the target network level and the target repair strategy table.
[0167] In some optional implementations, the target repair strategy table includes at least one network level, at least one repair strategy corresponding to each network level, and a weight index value corresponding to each repair strategy;
[0168] The repair module 505 is specifically used for:
[0169] According to the target network level, determining at least one target repair strategy corresponding to the target network level in the target repair strategy table;
[0170] According to the weight index value corresponding to each target repair strategy, a first repair strategy with the largest weight index value is selected from at least one target repair strategy;
[0171] According to the first repair strategy, obtaining a first repair script corresponding to the first repair strategy;
[0172] According to the first repair script, a first repair operation is performed on the target network device.
[0173] In some optional implementations, the repair module 505 is further configured to:
[0174] Obtaining a target time point for completing the first repair operation;
[0175] Obtain at least one log generated by the target network device after the target time point;
[0176] Determine whether there is a log of the target fault type in at least one log;
[0177] When it is determined that there is no log of the target fault type in at least one log, determining that the fault corresponding to the target fault type in the target network device has been repaired;
[0178] or,
[0179] When it is determined that at least one log has a log of the target fault type, a second repair strategy is selected from at least one target repair strategy according to the weight index value corresponding to each repair strategy, wherein the weight index value of the second repair strategy is less than the weight index value of the first repair strategy and greater than the weight index values of other repair strategies in the target repair strategy table except the first repair strategy;
[0180] Adjusting the weight index value of the second repair strategy to a value greater than the weight index value of the first repair strategy, so that the weight index value of the second repair strategy is the adjustment strategy with the largest weight index value among at least one repair strategy;
[0181] According to the second repair strategy, obtaining a second repair script corresponding to the second repair strategy;
[0182] According to the second repair script, a second repair operation is performed on the target network device.
[0183] In some optional implementations, the repair module 505 is further configured to:
[0184] Acquire historical repair data corresponding to the target fault type and the target network level, wherein the historical repair data includes at least one repair strategy and the number of successful repairs for each repair strategy;
[0185] Determining whether the third repair strategy is one of the at least one repair strategy included in the historical repair data, wherein the third repair strategy is a strategy that successfully repairs the target network device;
[0186] When it is determined that the third repair strategy is one of the at least one repair strategy included in the historical repair data, updating the number of successful repairs corresponding to the third repair strategy;
[0187] Determine the weight index value of each repair strategy in the historical repair data according to the number of successful repairs corresponding to each repair strategy in the historical repair data;
[0188] According to the weight index value of each repair strategy in the historical repair data, the target repair strategy table is updated.
[0189] In some optional implementations, the repair module 505 is further configured to:
[0190] When it is determined that the third repair strategy is not any of the at least one repair strategy included in the historical repair data, the third repair strategy is added to the historical repair data, and the number of successful repairs corresponding to the third repair strategy is set to one.
[0191] In some optional implementations, the determination module 503 is further configured to:
[0192] When a target trigger instruction is detected, the current configuration information and preset configuration information of each network device are obtained;
[0193] Determine whether the current configuration information of the target network device is consistent with the preset configuration information;
[0194] When it is determined that the current configuration information of the target network device is inconsistent with the preset configuration information, an alarm notification is generated according to the communication address of the target network device.
[0195] In some optional embodiments, when the target repair strategy table is an initial repair strategy table used when performing an initial detection operation corresponding to a target fault type, the target fault type is a loop fault, and the target network layer is an access layer, the first repair strategy is to restart the port and the second repair strategy is to close the port.
[0196] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0197] The fault repair device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0198] The embodiment of the present invention also provides a computer device having the above Figure 5 Fault repair device shown.
[0199] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0200] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware integrated circuit. The hardware integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0201] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0202] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0203] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0204] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0205] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0206] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0207] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A fault repair method, It is characterized in that The method is applied to a network fault detection system, the network fault detection system includes a server and at least one network device, the method is executed by the server, and the method includes: When a detection instruction is obtained, a fault detection operation is performed on each of the network devices according to the detection instruction, wherein the detection instruction includes a target fault type; Receiving a target log generated by any network device during the fault detection operation, wherein the target log includes a target event type, a target network level, and a target communication address; Determining whether the target event type is the target fault type; When it is determined that the target event type is the target fault type, obtaining a target repair strategy table corresponding to the target fault type; According to the target network level and the target repair strategy table, a repair operation is performed on the target network device corresponding to the target communication address.
2. The method according to claim 1, It is characterized in that The target repair strategy table includes at least one network level, at least one repair strategy corresponding to each of the network levels, and a weight index value corresponding to each of the repair strategies; The performing a repair operation on a target network device corresponding to the target communication address according to the target network level and the target repair strategy table includes: According to the target network level, determining in the target repair strategy table at least one target repair strategy corresponding to the target network level; According to the weight index value corresponding to each of the target repair strategies, a first repair strategy with the largest weight index value is selected from at least one of the target repair strategies; According to the first repair strategy, obtaining a first repair script corresponding to the first repair strategy; According to the first repair script, a first repair operation is performed on the target network device.
3. The method according to claim 2, It is characterized in that After performing the first repair operation on the target network device according to the first repair script, the method further includes: Obtaining a target time point for completing the first repair operation; Obtain at least one log generated by the target network device after the target time point; Determine whether there is a log of the target fault type in at least one of the logs; When it is determined that the log of the target fault type does not exist in at least one of the logs, determining that the fault corresponding to the target fault type in the target network device has been repaired; or, When it is determined that at least one of the logs contains a log of the target fault type, a second repair strategy is selected from at least one of the target repair strategies according to the weight index value corresponding to each of the repair strategies, wherein the weight index value of the second repair strategy is less than the weight index value of the first repair strategy, and is greater than the weight index values of other repair strategies in the target repair strategy table except the first repair strategy; Adjusting the weight index value of the second repair strategy to a value greater than the weight index value of the first repair strategy, so that the weight index value of the second repair strategy is an adjustment strategy with the largest weight index value among at least one of the repair strategies; According to the second repair strategy, obtaining a second repair script corresponding to the second repair strategy; According to the second repair script, a second repair operation is performed on the target network device.
4. The method according to claim 3, It is characterized in that The method further comprises: Acquire historical repair data corresponding to the target fault type and the target network level, wherein the historical repair data includes at least one repair strategy and the number of successful repairs for each of the repair strategies; Determining whether a third repair strategy is a repair strategy among at least one of the repair strategies included in the historical repair data, wherein the third repair strategy is a strategy that successfully repairs the target network device; When it is determined that the third repair strategy is one of the at least one repair strategy included in the historical repair data, updating the number of successful repairs corresponding to the third repair strategy; Determine a weight index value of each of the repair strategies in the historical repair data according to the number of successful repairs corresponding to each of the repair strategies in the historical repair data; The target repair strategy table is updated according to the weight index value of each of the repair strategies in the historical repair data.
5. The method according to claim 4, It is characterized in that When it is determined that the third repair strategy is not any one of the at least one repair strategy included in the historical repair data, the method further includes: The third repair strategy is added to the historical repair data, and the number of successful repairs corresponding to the third repair strategy is set to one.
6. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: When a target trigger instruction is detected, obtaining current configuration information and preset configuration information of each of the network devices; Determining whether the current configuration information of the target network device is consistent with the preset configuration information; When it is determined that the current configuration information of the target network device is inconsistent with the preset configuration information, an alarm notification is generated according to the communication address of the target network device.
7. The method according to claim 3 or 4, It is characterized in that When the target repair strategy table is an initial repair strategy table used when performing an initial detection operation corresponding to the target fault type, the target fault type is a loop fault, and the target network layer is an access layer, the first repair strategy is to restart the port and the second repair strategy is to close the port.
8. A fault repair device, It is characterized in that The device is applied to a network fault detection system, wherein the network fault detection system includes a server and at least one network device, and the device includes: A detection module, configured to, when a detection instruction is obtained, perform a fault detection operation on each of the network devices according to the detection instruction, wherein the detection instruction includes a target fault type; A receiving module, configured to receive a target log generated by any network device during the fault detection operation, wherein the target log includes a target event type, a target network level, and a target communication address; A determination module, used to determine whether the target event type is the target fault type; an acquisition module, configured to acquire a target repair strategy table corresponding to the target fault type when it is determined that the target event type is the target fault type; A repair module is used to perform a repair operation on a target network device corresponding to the target communication address according to the target network level and the target repair strategy table.
9. A computer device, It is characterized in that include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the fault repair method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the fault repair method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Fault repairing method and device, computer equipment and storage medium
CN110191003A
Fault processing method and device, electronic equipment and computer readable storage medium
CN113849486A
Container repairing method and device, computer storage medium and electronic equipment
CN116541198A
Network fault automatic repair method and device, electronic equipment and medium
CN117749603A
Method, system, and program product for analyzing a fault log of a malfunctioning machine
US6725398B1
