Method and system for locating and analyzing network management data of repeater equipment
Through regular expressions, the network management data of repeater equipment is solved, and the problems of messy data and low analysis efficiency are realized, intuitive data extraction and problem positioning are achieved, and analysis efficiency is improved.
Patent Information
- Application Number
- CN202411152404.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-08-21
AI Technical Summary
The data captured by the repeater station equipment is large and messy, and it is impossible to intuitively eliminate the management messages that are not interacting with the network management, resulting in low analysis efficiency and it is difficult for users to troubleshoot and locate problems.
The captured message data is preprocessed using regular expressions, remove the beginning and end spaces, add time marks, divide data units, match the message occurrence time, IP address information and original data packets, and analyze according to the repeater network management protocol. Then write to the EXCEL table for user analysis.
By extracting and analyzing network management data from repeater station equipment, users can quickly locate problems, improve analysis efficiency, and simplify data understanding and problem investigation process.
Smart Images

Figure CN118677971B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network management, and in particular to a method and system for locating and analyzing network management data of repeater equipment. Background Art
[0002] During the interaction between the repeater network management system and the repeater equipment, if there is a problem, the repeater equipment often needs to enter the system to capture packets through commands. However, since the captured packets are presented to the user in a mixed manner of numbers, English characters, and other symbols, the user cannot intuitively analyze the corresponding packet information.
[0003] The invention patent with application number CN202410822888.0 provides a method for processing repeater network management protocol data, which mentions that the packet is captured for the repeater device and then the message is parsed. However, since the captured data is very messy and contains many non-repeater management protocol messages, general testers cannot directly find the corresponding message, which is not convenient for troubleshooting and locating the problem.
[0004] The existing technical solutions have the following problems:
[0005] 1. The data captured by the repeater equipment is large in volume and it is not possible to directly exclude the management messages that are not related to the interaction between the repeater and the network management, making it inconvenient to analyze.
[0006] 2. For different packet capture instructions, the information carried in the generated messages is also different. It is inefficient to extract specific messages for analysis by manual copying. Summary of the invention
[0007] The technical problem to be solved by the embodiments of the present invention is to provide a method and system for locating and analyzing network management data of a repeater device, so as to facilitate users to troubleshoot and locate data problems.
[0008] In order to solve the above technical problems, an embodiment of the present invention proposes a method for locating and analyzing network management data of a repeater device, comprising:
[0009] Step 1: Capture the message data of the repeater device and store the captured message data as a txt file;
[0010] Step 2: traverse the file, remove the leading and trailing spaces of each line of content data in the file in turn, and obtain the corresponding new data lines; use regular expressions to determine whether each line of new data contains the message generation time in accordance with the preset matching rules; if not, add a space before the new data line and add it to the new data set; if yes, add \r\n before the new data line and add it to the new data set;
[0011] Step 3: Split the new data set by \r\n to form a new data unit set;
[0012] Step 4: traverse the new data unit set, and capture the message occurrence time, IP address information of the repeater device and the network management system, and the original data message of the repeater device in each data unit in the data unit set through regular expression matching;
[0013] Step 5: Parse the original data message according to the preset repeater network management protocol to obtain the parsed information;
[0014] Step 6: Associate the message generation time, IP address information, original data message and parsed information into an EXCEL data table and display it to the user.
[0015] Accordingly, an embodiment of the present invention further provides a network management data positioning and analysis system for a repeater device, comprising:
[0016] Capture module: Capture the message data of the repeater equipment and store the captured message data as a file in txt format;
[0017] Preprocessing module: traverse the file, remove the leading and trailing spaces of each line of content data in the file in turn, and obtain the corresponding several lines of new data; use regular expressions to determine whether each line of new data contains the message generation time in accordance with the preset matching rules; if not, add a space before the line of new data and add it to the new data set; if yes, add \r\n before the line of new data and add it to the new data set;
[0018] Splitting module: splits the new data set into \r\n to form a new data unit set;
[0019] Matching module: traverses the new data unit set, and through regular expression matching, captures the message occurrence time, IP address information of the repeater device and the network management system, and the original data message of the repeater device in each data unit in the data unit set;
[0020] Parsing module: parses the original data message according to the preset repeater network management protocol to obtain the parsed information;
[0021] Display module: write the message generation time, IP address information, original data message and parsed information together into an EXCEL data table and display it to the user.
[0022] The beneficial effects of the present invention are as follows: the present invention uses regular expressions to present the captured message start time, IP address information, original repeater management data and parsed data in correspondence, which is convenient for users to understand and locate problems; compared with using packet capture software for packet capture and parsing, the present invention can filter and present the information that users are concerned about more quickly and with higher efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a flow chart of a method for locating and analyzing network management data of a repeater device according to an embodiment of the present invention.
[0024] Figure 2 This is a schematic diagram of captured message data in Example 2 of the present invention. DETAILED DESCRIPTION
[0025] It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present invention is further described in detail below in conjunction with the drawings and specific embodiments.
[0026] In the embodiments of the present invention, if there are directional indications (such as up, down, left, right, front, back, etc.), they are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0027] In addition, in the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0028] Please refer to Figure 1 The network management data positioning and analysis method of the repeater device in the embodiment of the present invention includes steps 1 to 6.
[0029] Step 1: Capture the message data of the repeater device and store the captured message data as a txt file.
[0030] In the specific implementation of Example 1, the packet capture can be performed according to the following steps:
[0031] Log in to the repeater device via SSH or Telnet and enter the Linux system;
[0032] Use the tcpdump command to capture packets from the network card that communicates between the repeater device and the network management system, and record the captured packets into a txt file with a custom name. For example:
[0033] tcpdump -nx -i ppp0 'tcp
[13] ==0x18'> Tcp_Log01.txt
[0034] The above command indicates that the tcpdump command is used to capture packets from the port named ppp0 network card, and the captured packets are saved in a file named Tcp_Log01.txt.
[0035] Since the subsequent parameters of the tcpdump packet capture command can be based on user habits, the content of the captured message will also be different. The above example is only a simple packet capture form.
[0036] Step 2: traverse the file, remove the leading and trailing spaces of each line of content data in the file in turn, and obtain several corresponding lines of new data; use regular expressions to determine whether each line of new data contains the message generation time in accordance with the preset matching rules; if not, add a space before the line of new data and add it to the new data set; if so, add \r\n before the line of new data and add it to the new data set.
[0037] That is, in step 2, the content data of line i of the txt file is Line i Perform the following preprocessing:
[0038] 2.1 Set the i-th line content data Line i Remove the leading and trailing spaces to form the new data NL in row i i ;
[0039] 2.2 Use regular expressions to determine the new data NL in row i according to the matching rule of '\d{2}:\d{2}:\d{2}' i Whether to include the message generation time:
[0040] If no, replace with space + NL i Add to the new data set TotalLine;
[0041] If yes, replace with "\r\n" + NL i Add to the new data collection TotalLine.
[0042] Preferably, if TotalLine = empty, when it is added to the new data set TotalLine, it is directly added as NL i When adding it, there is no need to add a space or "\r\n" in front. That is, there is no need to add a space or "\r\n" in front of the first new data in the new data set TotalLine.
[0043] Step 3: Split the new data set by \r\n to form a new data unit set . Where m is the number of data units in the data unit set, SL j is the data unit at position j in the new set, and j is the position of the data unit in the set in the data unit set.
[0044] Embodiment 2: After the repeater device captures the corresponding message, it stores it into a txt file. This embodiment introduces how to pre-process it. Figure 2 This is an example of a message captured in a txt file.
[0045] from Figure 2 It can be seen that a complete message contains time, IP address information and hexadecimal raw data. Among them, the hexadecimal raw data contains ASCII characters, and these data are divided into multiple lines for display, which causes great trouble for ordinary users to identify. The present invention just solves this problem.
[0046] First, traverse Figure 2 The data in , remove the leading and trailing spaces, to form a new data set, which is composed of NL i The NL i Remove leading and trailing spaces from the data in row i.
[0047] For example: NL1 = “13:32:10.580705 IP (tos 0x0, ttl 64, id 15291, offset 0, flags [DF], proto TCP (6), length 75)” is the first line of processed data.
[0048] And so on, NL7 = “0x0040: 01ff 0641 0100 0007 f233 7e ...A.....3~”, which is the data after processing in the seventh line.
[0049] Secondly, use regular expressions to determine NL according to the matching rule of '\d{2}:\d{2}:\d{2}' i Whether to include the message generation time. If not, use space + NL i Add to the new data set TotalLine; if yes, replace with "\r\n" + NL i Add to the new data set TotalLine;
[0050] NL1 = Take "13:32:10.580705 IP (tos 0x0, ttl 64, id 15291, offset 0, flags [DF], proto TCP (6), length 75)" as an example. According to the matching rule of '\d{2}:\d{2}:\d{2}', the string header "13:32:10" meets the judgment. When it is added to TotalLine, since it is the first string added to TotalLine, there is no content in TotalLine at this time (TotalLine = empty). So NL1 is directly added to TotalLine, that is, TotalLine = NL1. Then, the other NL i Add to TotalLine. When NL7 is added to TotalLine, it is judged according to the matching rule of '\d{2}:\d{2}:\d{2}'. If it is judged as no, TotalLine = TotalLine + " " + NL7.
[0051] Again, split TotalLine with "\r\n" to form a new set .
[0052] Figure 2 The data in the form a row of data in TotalLine, so that in subsequent processing, the data starting with time contains a whole packet capture data. Figure 2 After the data in is processed, TotalLine = = "13:32:10.580705 IP (tos 0x0, ttl 64, id 15291, offset 0, flags [DF], proto TCP(6), length 75)
[0053] 10.36.186.219.34879 > 36.152.17.78.42202: Flags [P.], cksum 0xe273(correct), seq 3070175325:3070175348, ack 3564849596, win 4006, options [nop,nop,TS val 3990389491 ecr 4027518989], length 23
[0054] 0x0000: 4500 004b 3bbb 4000 4006 040d 0a24 badb E..K;.@.@....$..
[0055] 0x0010: 2498 114e 883f a4da b6ff 285d d47b 49bc $..N.?....(].{I.
[0056] 0x0020: 8018 0fa6 e273 0000 0101 080a edd8 82f3 .....s.....
[0057] 0x0030: f00f 100d 7e03 0104 0600 0000 6f80 8003 ....~.....o...
[0058] 0x0040: 01ff 0641 0100 0007 f233 7e...A....3~".
[0059] It should be noted that the characters processed by TotalLine above are actually just one line of data. Due to the limitation of text display conditions, multiple lines are displayed.
[0060] Step 4: Traverse the new data unit collection , extract SL through regular expression matching j The message generation time T j , IP address information of repeater equipment and network management system IPInfo j , Repeater equipment original data message OrgDate j .
[0061] As an implementation method, T j and IPInfo j The regular expression matching rule used is RuleTIP j =
[0062] '(\d{2}:\d{2}:\d{2})\.\d+.* (\d+\.\d+\.\d+\.\d+)\.\d+ > (\d+\.\d+\.\d+\.\d+)'. The first matching method in the bracket is the message generation time T j The corresponding matching rules, the inner matching mode of the second bracket and the third bracket is IPInfo j Corresponding IP address information.
[0063] Repeater original data message OrgDate j The regular expression matching rule is
[0064] RuleDate j = ' 7e0[1-3].*7e', the first character in this rule must be a space.
[0065] As an implementation method, SL j Before matching regular expressions, special processing is required to remove interfering characters. The method is:
[0066] (1) Remove SL j A string that starts with a "0x" character and ends with a space.
[0067] (2) Remove SL j A string connected by the "." symbol in the string, with spaces before and after the string.
[0068] Step 5: Parse the original data message OrgDate according to the preset repeater network management protocol j , get the parsed information.
[0069] Step 6: Set the message generation time T j 、IP address information IPInfo j 、Original data message OrgDate j The parsed information is written into an EXCEL data table and displayed to the user. The user can analyze and locate the management data of the repeater equipment through the data in the EXCEL table.
[0070] Example 3: This example describes how to find the key data in the remaining messages after preprocessing. Including: message generation time T j , IP address information of repeater and network management system IPInfo j , Repeater original data message OrgDate j processing process.
[0071] Step 41, use regular expression rules RuleTIP j =
[0072] '(\d{2}:\d{2}:\d{2})\.\d+.* (\d+\.\d+\.\d+\.\d+)\.\d+ > (\d+\.\d+\.\d+\.\d+)', perform regular expression matching on the preprocessed data in Example 2. Find
[0073] T j = 13:32:10, IPInfoj = 10.36.186.219 + 36.152.17.78. At this time, j = 1.
[0074] Step 42: the original data packet SL j Before performing regular expression matching (TotalLine in Example 2), special processing is required to remove interfering characters. The method is:
[0075] Step 42.1, remove SL j A string that starts with a "0x" character and ends with a space.
[0076] Step 42.2, remove SL j A string connected by the "." symbol in the string, with spaces before and after the string. Processed string = "13:32:10.580705 IP (tos 0x0, ttl 64, id 15291, offset 0, flags [DF], proto TCP (6), length 75) 10.36.186.219.34879 >36.152.17.78.42202: Flags [P.], cksum 0xe273 (correct), seq 3070175325:3070175348, ack 3564849596, win 4006, options [nop,nop,TS val 3990389491 ecr4027518989], length 23 4500 004b 3bbb 4000 4006 040d" "0a24 2498 114e 883f a4dab6ff 285d d47b 49bc 8018 0fa6 e273 0000 0101 080a edd8 82f3 f00f 100d 7e030104 0600 0000 6f80 8003 01ff 0641 0100 0007 f233 7e". It should be noted that the above processed characters are actually only one line of data. Due to the limitations of text display conditions, multiple lines of display appear.
[0077] Step 43, regular expression matching is performed on the processed characters, and the matching rule is:
[0078] RuleDate j =' 7e0[1-3].*7e', the first character in this rule must be a space. This rule indicates that the match starts with a space, followed by the 7e0 character, followed by the number 1, 2 or 3, and then any character, and finally ends with the 7e character. This matching method fully meets the requirements of the repeater management protocol, which requires the protocol characters to start and end with the 7e character. Moreover, the '0[1-3]' rule further limits the protocol type to a protocol between 01 and 03, eliminating interference data. Therefore, after the characters processed in this step are matched with the regular expression, the obtained OrgDate j = "7e03 0104 0600 0000 6f80 8003 01ff 0641 0100 0007 f233 7e".
[0079] Step 44, OrgDate j The data is parsed according to the repeater management protocol, and the results are shown in Table 1.
[0080] Table 1
[0081]
[0082] The network management data positioning and analysis system of the repeater equipment according to the embodiment of the present invention comprises:
[0083] Capture module: Capture the message data of the repeater equipment and store the captured message data as a file in txt format;
[0084] Preprocessing module: traverse the file, remove the leading and trailing spaces of each line of content data in the file in turn, and obtain the corresponding several lines of new data; use regular expressions to determine whether each line of new data contains the message generation time in accordance with the preset matching rules; if not, add a space before the line of new data and add it to the new data set; if yes, add \r\n before the line of new data and add it to the new data set;
[0085] Splitting module: splits the new data set into \r\n to form a new data unit set;
[0086] Matching module: traverses the new data unit set, and through regular expression matching, captures the message occurrence time, IP address information of the repeater device and the network management system, and the original data message of the repeater device in each data unit in the data unit set;
[0087] Parsing module: parses the original data message according to the preset repeater network management protocol to obtain the parsed information;
[0088] Display module: write the message generation time, IP address information, original data message and parsed information together into an EXCEL data table and display it to the user.
[0089] As an implementation method, the preset matching rule adopted by the preprocessing module is \d{2}:\d{2}:\d{2}.
[0090] As an implementation method, the regular expression matching rule used by the matching module to capture the message occurrence time and IP address information is:
[0091] '(\d{2}:\d{2}:\d{2})\.\d+.* (\d+\.\d+\.\d+\.\d+)\.\d+ > (\d+\.\d+\.\d+\.\d+)';
[0092] The matching method in the first bracket in the rule is the matching rule corresponding to the message generation time, and the matching methods in the second bracket and the third bracket are the matching rules corresponding to the IP address information.
[0093] As an implementation method, the regular expression matching rule for the original data message of the repeater device captured by the matching module is:
[0094] '7e0[1-3].*7e';
[0095] The first character in this rule must be a space.
[0096] As an implementation mode, before the matching module performs regular expression matching on each data unit in the data unit set, the matching module first performs interference character removal processing on each data unit in the data unit set:
[0097] Remove the string starting with 0x and ending with a space in each data unit;
[0098] Remove the character strings connected by the . symbol in each data unit.
[0099] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for locating and analyzing network management data of a repeater device, characterized in that: include: Step 1: Capture the message data of the repeater device and store the captured message data as a txt file; Step 2: traverse the file, remove the leading and trailing spaces of each line of content data in the file in turn, and obtain the corresponding new data lines; use regular expressions to determine whether each line of new data contains the message generation time in accordance with the preset matching rules; if not, add a space before the new data line and add it to the new data set; if yes, add \r\n before the new data line and add it to the new data set; Step 3: Split the new data set by \r\n to form a new data unit set; Step 4: traverse the new data unit set, and capture the message occurrence time, IP address information of the repeater device and the network management system, and the original data message of the repeater device in each data unit in the data unit set through regular expression matching; Step 5: Parse the original data message according to the preset repeater network management protocol to obtain the parsed information; Step 6: Associate the message generation time, IP address information, original data message and parsed information into an EXCEL data table and display it to the user.
2. The method for locating and analyzing network management data of a repeater device according to claim 1, characterized in that: In step 2, the preset matching rule is \d{2}:\d{2}:\d{2}.
3. The method for locating and analyzing network management data of a repeater device as claimed in claim 2, characterized in that: In step 4, the regular expression matching rule used to capture the message occurrence time and IP address information is: '(\d{2}:\d{2}:\d{2})\.\d+.* (\d+\.\d+\.\d+\.\d+)\.\d+ > (\d+\.\d+\.\d+\.\d+)'; The matching method in the first bracket in the rule is the matching rule corresponding to the message generation time, and the matching methods in the second bracket and the third bracket are the matching rules corresponding to the IP address information.
4. The method for locating and analyzing network management data of a repeater device as claimed in claim 2, characterized in that: In step 4, the regular expression matching rule for capturing the original data message of the repeater device is: '7e0[1-3].*7e'; The first character in this rule must be a space.
5. The method for locating and analyzing network management data of a repeater device according to claim 1, characterized in that: In step 4, before performing regular expression matching on each data unit in the data unit set, first perform interference character removal processing on each data unit in the data unit set: Remove the string starting with 0x and ending with a space in each data unit; Remove the character strings connected by the . symbol in each data unit.
6. A network management data positioning and analysis system for repeater equipment, characterized in that: include: Capture module: Capture the message data of the repeater equipment and store the captured message data as a file in txt format; Preprocessing module: traverse the file, remove the leading and trailing spaces of each line of content data in the file in turn, and obtain the corresponding new data in several lines; use regular expressions to determine whether each line of new data contains the message generation time in accordance with the preset matching rules; if not, add a space before the new data in the line and add it to the new data set; if yes, add \r\n before the new data in the line and add it to the new data set; Splitting module: splits the new data set into \r\n to form a new data unit set; Matching module: traverses the new data unit set, and through regular expression matching, captures the message occurrence time, IP address information of the repeater device and the network management system, and the original data message of the repeater device in each data unit in the data unit set; Parsing module: parses the original data message according to the preset repeater network management protocol to obtain the parsed information; Display module: write the message generation time, IP address information, original data message and parsed information together into an EXCEL data table and display it to the user.
7. The network management data location analysis system for repeater equipment according to claim 6, characterized in that: The preset matching rule used by the preprocessing module is \d{2}:\d{2}:\d{2}.
8. The network management data location analysis system for repeater equipment according to claim 7, characterized in that: The matching module captures the message occurrence time and IP address information using the regular expression matching rules: '(\d{2}:\d{2}:\d{2})\.\d+.* (\d+\.\d+\.\d+\.\d+)\.\d+ > (\d+\.\d+\.\d+\.\d+)'; The matching method in the first bracket in the rule is the matching rule corresponding to the message generation time, and the matching methods in the second bracket and the third bracket are the matching rules corresponding to the IP address information.
9. The network management data location analysis system for repeater equipment according to claim 7, characterized in that: The regular expression matching rules for the matching module to capture the original data message of the repeater equipment are: '7e0[1-3].*7e'; The first character in this rule must be a space.
10. The network management data location analysis system for repeater equipment according to claim 6, characterized in that: Before matching each data unit in the data unit set with a regular expression, the matching module first removes interference characters from each data unit in the data unit set: Remove the string starting with 0x and ending with a space in each data unit; Remove the character strings connected by the . symbol in each data unit.
