Simple network management protocol data parsing method and device, equipment and medium
By parsing SNMP messages and establishing a target data format dictionary, SNMP messages are converted into an easy-to-read and parse format, solving the problem of difficulty in quickly locating resource attributes in existing technologies and improving the management efficiency of network devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2023-04-12
- Publication Date
- 2026-06-26
Smart Images

Figure CN116436749B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more specifically to a method, apparatus, device, and medium for parsing Simple Network Management Protocol (SMLP) data. Background Technology
[0002] The basic components of the Simple Network Management Protocol (SNMP) include a Network Management System (NMS), an Agent, and a Management Information Base (MIB). NMS is deployed on a management station to manage network devices. When the management station queries or configures network devices, it typically uses SNMP messages to provide resource information. The corresponding MIB file needs to be loaded and parsed to view the device's resources. However, current SNMP messages only list all resource information for the managed network devices, making it difficult for maintenance personnel to quickly locate resource attributes, thus impacting network device management efficiency. Therefore, converting SNMP messages into other data formats that allow for rapid querying and comparison is a pressing issue. Summary of the Invention
[0003] In view of this, the present invention provides a simple network management protocol data parsing method, apparatus, device and medium to solve the problem in related technologies that SNMP messages can only list and expand all resource information of network devices, making it difficult to quickly locate the attribute information of resources from the messages, thus affecting the management efficiency of network devices.
[0004] In a first aspect, the present invention provides a simple network management protocol data parsing method, the method comprising:
[0005] Obtain the management information database file corresponding to each managed network device;
[0006] Decode the management information database files and establish a dictionary of target data formats corresponding to resources and attributes;
[0007] The target data format dictionary is used to parse the Simple Network Management Protocol (SMLP) messages to be processed, and the target data format data is obtained.
[0008] This method establishes a target data format dictionary corresponding to resources and attributes by decoding the management information base file. This dictionary is then used to parse the simple network management protocol messages to be processed to obtain the target data format data. This transforms the simple network management protocol messages, which are not conducive to quickly locating resource attribute information, into target data formats that are easy to read and parse. This makes them easy for both humans and machines to parse, thus improving the efficiency of network device management.
[0009] In one optional implementation, the management information base file is decoded to establish a target data format dictionary corresponding to resources and attributes, including:
[0010] Based on the tree structure of the management information base file, starting from the root node, the resources and attributes corresponding to each node are sequentially converted into data objects in the target data format.
[0011] Based on the tree structure of the management information database file, the hierarchical relationship between data objects is established, and the data object query path of each data object is formed.
[0012] Based on the correspondence between nodes and data objects, establish a mapping relationship between each node and the query path of the data object;
[0013] Generate a dictionary of target data formats corresponding to resources and attributes based on data objects, data object query paths, and mapping relationships.
[0014] By utilizing the tree structure of the management information base file, the resources and attributes corresponding to the nodes are sequentially converted into data objects in the target data format, and a data object query path is established. Based on the relationship between data objects and nodes, a mapping relationship between the data object query path and the nodes is established, thereby creating a target data format dictionary. This dictionary can then be used to realize the query path from the node to the data object and the query of the data object, providing a data foundation for the parsing of Simple Network Management Protocol (SMLP) messages and ensuring the efficiency and accuracy of SMLP message parsing.
[0015] In one optional implementation, the Simple Network Management Protocol (SRM) message to be processed is parsed using a target data format dictionary to obtain target data format data, including:
[0016] Extract the target node and its corresponding attribute values from the Simple Network Management Protocol (SRM) message to be processed;
[0017] By searching the target data format dictionary according to the target node, the query path of the target data object corresponding to the target node is obtained;
[0018] The target data object is obtained by searching the target data format dictionary according to the target data object query path.
[0019] The target data object and attribute values are combined to obtain the target data format data.
[0020] By using a target data format dictionary to query the target data object corresponding to the target node in the Simple Network Management Protocol (SMMP) message, and combining the attribute values contained in the message with the target data object, a new target data format is formed. This target data format has the same meaning as the target node and its corresponding attribute values in the SMMP message. Because the target data format is easy to read and parse, the attribute information of the resource can be quickly located by querying the target data format, thus improving the efficiency of network device management.
[0021] In an optional implementation, when the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device, the SMMP message to be processed is parsed using a target data format dictionary to obtain target data format data, and the implementation further includes:
[0022] Event types from which message time and corresponding event information are extracted from Simple Network Management Protocol (SMLP) messages to be processed;
[0023] Add the message time and event type to the target data format.
[0024] By extracting the message time and event type from Simple Network Management Protocol (SMLP) messages containing event information of managed network devices during message parsing and adding them to the corresponding target data format, the message information contained in the target data format becomes more complete. This helps maintenance personnel understand the event information of network devices and further improves the efficiency of network device management.
[0025] In one alternative implementation, the method further includes:
[0026] Store the target data format.
[0027] By storing target data in a specific format, maintenance personnel can easily compare and query the resources and attributes of network devices, thereby further improving the efficiency of network device management.
[0028] In one alternative implementation, storing the target data format data includes:
[0029] When the Simple Network Management Protocol (SMAP) message to be processed contains attribute information of the managed network device resources, the target data format data is divided into one or more files for storage based on the data volume of the target data format data;
[0030] When the Simple Network Management Protocol (SMLP) message to be processed contains event information of the managed network device, the target data format data is stored according to the time period.
[0031] By using different storage methods according to the different contents of the Simple Network Management Protocol (SMLP) messages to be processed, it is easier for maintenance personnel to accurately and quickly find the required network device resources and attribute information, improve data query speed, and further improve the efficiency of network device management.
[0032] In one alternative implementation, the Simple Network Management Protocol (SMLP) message to be processed is obtained as follows:
[0033] The agent process obtains a first Simple Network Management Protocol (SMLP) message containing attribute information of the managed network device resources, or receives a second Simple Network Management Protocol (SMLP) message containing event information of the managed network device reported by the agent process.
[0034] The first Simple Network Management Protocol (SMLP) message or the second Simple Network Management Protocol (SMLP) message is identified as the SMLP message to be processed.
[0035] This allows for the acquisition of simple network management protocol messages that need to be processed through both active collection and passive monitoring. This enables maintenance personnel to gain a more comprehensive understanding of the resource and attribute information of network devices, thereby further improving the efficiency of network device management.
[0036] Secondly, the present invention provides a simple network management protocol data parsing device, the device comprising:
[0037] The acquisition module is used to acquire the management information database file corresponding to each managed network device;
[0038] The first processing module is used to decode the management information database file and establish a dictionary of target data formats corresponding to resources and attributes;
[0039] The second processing module is used to parse the Simple Network Management Protocol (SMLP) messages to be processed using a target data format dictionary to obtain the target data format data.
[0040] In one optional implementation, the first processing module includes:
[0041] The first processing unit is used to convert the resources and attributes of each node into data objects in the target data format, starting from the root node, based on the tree structure of the management information database file.
[0042] The second processing unit is used to establish the hierarchical relationship between data objects based on the tree structure of the management information database file, and to form the data object query path for each data object.
[0043] The third processing unit is used to establish a mapping relationship between each node and the query path of the data object based on the correspondence between the node and the data object.
[0044] The fourth processing unit is used to generate a dictionary of target data formats corresponding to resources and attributes based on data objects, data object query paths, and mapping relationships.
[0045] In one optional implementation, the second processing module includes:
[0046] The fifth processing unit is used to extract the target node and its corresponding attribute values from the Simple Network Management Protocol (SRM) message to be processed;
[0047] The sixth processing unit is used to look up the target data format dictionary according to the target node to obtain the target data object query path corresponding to the target node;
[0048] The seventh processing unit is used to search the target data format dictionary according to the target data object query path to obtain the target data object;
[0049] The eighth processing unit is used to combine the target data object and attribute values to obtain the target data format data.
[0050] In an optional implementation, when the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device, the second processing unit further includes:
[0051] The ninth processing unit is used to extract the message time and corresponding event type from the Simple Network Management Protocol (SMLP) message to be processed.
[0052] The tenth processing unit is used to add the message time and event type to the target data format data.
[0053] In one alternative embodiment, the apparatus further includes:
[0054] The third processing module is used to store the target data format.
[0055] In one optional implementation, the third processing module includes:
[0056] The first storage unit is used to divide the target data format data into one or more files for storage based on the data volume of the target data format data when the Simple Network Management Protocol message to be processed contains attribute information of the managed network device resources;
[0057] The second storage unit is used to store target data in a time-based format when the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device.
[0058] In one alternative embodiment, the apparatus further includes:
[0059] The fourth processing module is used to obtain a first Simple Network Management Protocol (SMLP) message containing attribute information of the managed network device resources through the agent process, or to receive a second Simple Network Management Protocol (SMLP) message containing event information of the managed network device reported by the agent process.
[0060] The fifth processing module is used to identify either the first Simple Network Management Protocol (SMMP) message or the second SMMP message as the SMMP message to be processed.
[0061] Thirdly, 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 computer instructions to perform the method described in the first aspect or any corresponding embodiment thereof.
[0062] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0063] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0064] Figure 1 This is a flowchart illustrating a simple network management protocol data parsing method according to an embodiment of the present invention;
[0065] Figure 2 This is a flowchart illustrating another simple network management protocol data parsing method according to an embodiment of the present invention;
[0066] Figure 3 This is a flowchart illustrating another simple network management protocol data parsing method according to an embodiment of the present invention;
[0067] Figure 4 This is a structural block diagram of a simple network management protocol data parsing tool according to an embodiment of the present invention;
[0068] Figure 5 This is a structural block diagram of a simple network management protocol data parsing device according to an embodiment of the present invention;
[0069] Figure 6 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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.
[0071] Server clusters typically consist of numerous server devices, and NMS (Network Management System) enables intelligent management of these clusters. SNMP defines a unified interface for different types of devices, devices from different manufacturers, and devices of different models, allowing the management station to manage these devices using a consistent interface. Through the network, the management station can perform query and configuration operations (GET / SET) on the managed devices. Simultaneously, it can report the occurrence of events (Trap) when significant changes occur on the managed devices. When querying and configuring network devices, the management station needs to load the corresponding MIB file and parse it to view the resources associated with the device.
[0072] SNMP adopts a "simplicity-as-is" design philosophy, emphasizing simplicity and low operating costs. The software / hardware added to the device, the types of messages, and the message formats are all kept as simple as possible, thus minimizing the impact and cost of running SNMP on the device. However, this also makes data analysis of the managed devices by the management station difficult. Currently, SNMP messages typically provide a "simple and crude" list of resource information for the managed device, making it difficult for maintenance personnel to quickly locate resource attributes from the messages, which is detrimental to automated maintenance.
[0073] This invention primarily utilizes computer equipment, such as a network management system deployed on a management station, to parse SNMP messages into target data formats, such as JSON, making them easy for both humans and machines to parse, thereby improving the efficiency of network management.
[0074] According to an embodiment of the present invention, a simple network management protocol data parsing method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0075] This embodiment provides a simple network management protocol data parsing method, which can be used in the aforementioned computer devices, such as the network management system terminal deployed on a management station. Figure 1 This is a flowchart of a simple network management protocol data parsing method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:
[0076] Step S101: Obtain the management information database file corresponding to each managed network device.
[0077] Specifically, the Management Information Base (MIB) file is a database that specifies the variables maintained by the managed network devices and is information that can be queried and set by the agent. The MIB defines a series of attributes for the managed network devices in the database. These managed network devices can be routers, access servers, switches, bridges, etc.
[0078] Step S102: Decode the management information database file and establish a target data format dictionary corresponding to resources and attributes.
[0079] The target data format is one that is easy to read and query, such as JSON or XML. Mature plugins exist for these data formats, enabling rapid data location and querying. The specific implementation methods are existing technologies and will not be elaborated upon here.
[0080] Step S103: Use the target data format dictionary to parse the Simple Network Management Protocol (SMLP) message to be processed to obtain the target data format data.
[0081] For example, when the target data format is JSON, the corresponding target data format dictionary is a JSON dictionary, and the target data format data obtained by parsing the Simple Network Management Protocol (SMMP) message to be processed using the JSON dictionary is JSON format data; when the target data format is XML, the corresponding target data format dictionary is an XML dictionary, and the target data format data obtained by parsing the Simple Network Management Protocol (SMMP) message to be processed using the XML dictionary is XML format data.
[0082] The Simple Network Management Protocol (SMMP) data parsing method provided in this embodiment establishes a target data format dictionary corresponding to resources and attributes by decoding the management information base file. This dictionary is then used to parse the SMMP messages to be processed to obtain the target data format data. This transforms SMMP messages, which are not conducive to quickly locating resource attribute information, into target data formats that are easy to read and parse. This makes them easy for both humans and machines to parse, thereby improving the efficiency of network device management.
[0083] This embodiment provides a simple network management protocol data parsing method, which can be used in the aforementioned computer equipment. Figure 2 This is a flowchart of a simple network management protocol data parsing method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0084] Step S201: Obtain the management information database file corresponding to each managed network device. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0085] Step S202: Decode the management information database file and establish a dictionary of target data formats corresponding to resources and attributes.
[0086] Specifically, step S202 includes:
[0087] Step S2021: Based on the tree structure of the management information database file, starting from the root node, convert the resources and attributes corresponding to each node into data objects in the target data format.
[0088] Specifically, because the MIB file is stored in a tree structure, SNMP messages access devices in the network by traversing the nodes in the MIB tree directory. Each characteristic of the device is uniquely specified by an Object Identifier (OID), meaning that each storage node in the MIB file corresponds to a unique OID. For example, this is achieved by converting the resources and attributes corresponding to the OID into JSON format data objects, i.e., the "keys" in JSON format.
[0089] Step S2022: Based on the tree structure of the management information database file, establish the hierarchical relationship between data objects and form the data object query path for each data object.
[0090] For example, based on the connections between nodes in the tree structure, all child nodes under each node are combined into a new JSON object, which serves as the "value" of the parent node. This yields the data object query path for each data object. This data object query path corresponds to the node path in the tree structure from the root node to the target node.
[0091] Step S2023: Based on the correspondence between nodes and data objects, establish the mapping relationship between each node and the query path of the data object.
[0092] Step S2024: Generate a dictionary of target data formats corresponding to resources and attributes based on data objects, data object query paths, and mapping relationships.
[0093] For example, taking JSON as the target data format, the MIB file is parsed according to its directory structure. Each node is converted into a "key" in JSON format, and all child nodes under each node constitute a new JSON object, which serves as the "value" of the parent node. This process is repeated recursively, starting from the root node of the MIB file, parsing layer by layer to obtain the mapping relationship between each node (OID) and the path of the "key" in JSON, generating a JSON format dictionary.
[0094] For example, taking XML as the target data format, the MIB file is parsed according to its directory structure, and each node is converted into an "element" in XML format. All child nodes under each node constitute a new element, which serves as the "next-level element" of the parent node. This process is repeated recursively, starting from the root node of the MIB file, parsing layer by layer to obtain the mapping relationship between each node (OID) and the path of the "element" in XML, generating an XML format dictionary.
[0095] The Simple Network Management Protocol (SMMP) data parsing method provided in this embodiment utilizes the tree structure of the management information base file to sequentially convert the resources and attributes corresponding to nodes into data objects in the target data format, establishes a data object query path, and establishes a mapping relationship between the data object query path and nodes based on the relationship between data objects and nodes. This results in the creation of a target data format dictionary, which can then be used to realize the query path from nodes to data objects and the query of data objects. This provides a data foundation for the parsing of SMMP messages, ensuring the efficiency and accuracy of SMMP message parsing.
[0096] Step S203: Use the target data format dictionary to parse the Simple Network Management Protocol (SMLP) message to be processed to obtain the target data format data.
[0097] Specifically, step S202 includes:
[0098] Step S2031: Extract the target node and its corresponding attribute values from the Simple Network Management Protocol (SMLP) message to be processed.
[0099] In a Simple Network Management Protocol (SNMP) message, the number of protected target nodes can be one or more, depending on the content of the SNMP message. For example, if the SNMP message to be processed is a query by an Agent to retrieve the memory values of multiple memory modules in a server, the target nodes are the multiple nodes corresponding to the memory modules, and the attribute value is the memory value corresponding to each memory module. Furthermore, when the SNMP message to be processed is an Agent actively reporting alarm information from a server, the target node is the node corresponding to that server, and the attribute value is the alarm information.
[0100] Step S2032: Search the target data format dictionary according to the target node to obtain the target data object query path corresponding to the target node.
[0101] Step S2033: Search the target data format dictionary according to the target data object query path to obtain the target data object.
[0102] Step S2034: Combine the target data object and attribute values to obtain the target data format data.
[0103] For example, when the target data object is the data object corresponding to a memory bar on the server, the target data format can be the memory value of the memory bar in JSON format, or the memory value of the memory bar in XML format, etc.
[0104] By using a target data format dictionary to query the target data object corresponding to the target node in the Simple Network Management Protocol (SMMP) message, and combining the attribute values contained in the message with the target data object, a new target data format is formed. This target data format has the same meaning as the target node and its corresponding attribute values in the SMMP message. Because the target data format is easy to read and parse, the attribute information of the resource can be quickly located by querying the target data format, thus improving the efficiency of network device management.
[0105] Furthermore, when the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device, step S203 further includes:
[0106] Event types that extract message time and corresponding event information from Simple Network Management Protocol (SMLP) messages to be processed.
[0107] Specifically, the message time is the time corresponding to the message timestamp of the Simple Network Management Protocol message reported by the Agent, and the event type is the type of event in the message reported by the Agent, such as classification according to alarm type or classification according to the network device type corresponding to the alarm information, etc. This invention is not limited thereto.
[0108] Add the message time and event type to the target data format.
[0109] Specifically, when network devices undergo significant changes, they will report the event to the management station via an agent. In order to facilitate timely understanding and handling of events by maintenance personnel, it is necessary to record the type and message time of the event to improve the efficiency of maintenance work.
[0110] By extracting the message time and event type from Simple Network Management Protocol (SMLP) messages containing event information of managed network devices during message parsing and adding them to the corresponding target data format, the message information contained in the target data format becomes more complete. This helps maintenance personnel understand the event information of network devices and further improves the efficiency of network device management.
[0111] This embodiment provides a simple network management protocol data parsing method, which can be used in the aforementioned computer equipment. Figure 3 This is a flowchart of a simple network management protocol data parsing method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps:
[0112] Step S301: Obtain the management information database file corresponding to each managed network device. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0113] Step S302: Decode the management information base file to establish a dictionary of target data formats corresponding to resources and attributes. For details, please refer to [link to relevant documentation]. Figure 1 Step S302 of the illustrated embodiment will not be described again here.
[0114] Step S305: Obtain a first Simple Network Management Protocol (SMLP) message containing attribute information of the managed network device resources through the agent process, or receive a second SMLP message containing event information of the managed network device reported by the agent process.
[0115] Specifically, Simple Network Management Protocol (SNMP) messages contain two data sources: active acquisition and passive monitoring. Active acquisition uses the GET method in SNMP to directly obtain attribute information of a specified resource from the Agent, primarily including the basic attributes of the managed object. Passive monitoring involves the Agent proactively reporting important events to the management station, mainly device alarm information. When configuring the SNMP service management station, Trap information can be redirected to a specified file. The data acquisition module monitors and collects Trap messages by reading this file in real time. These two types of information are stored in different files as data sources for the SNMP messages to be processed.
[0116] Step S306: Determine the first Simple Network Management Protocol (SMMP) message or the second Simple Network Management Protocol (SMMP) message as the SMMP message to be processed.
[0117] This allows for the acquisition of simple network management protocol messages that need to be processed through both active collection and passive monitoring. This enables maintenance personnel to gain a more comprehensive understanding of the resource and attribute information of network devices, thereby further improving the efficiency of network device management.
[0118] Step S303: The Simple Network Management Protocol (SMLP) message to be processed is parsed using a target data format dictionary to obtain the target data format data. For details, please refer to [link to relevant documentation]. Figure 1 Step S103 of the illustrated embodiment will not be described again here.
[0119] Step S304: Store the target data format.
[0120] Specifically, the target data format data can be transferred to the corresponding target data format folder and uploaded to the cloud for storage, so that maintenance personnel can obtain the relevant data.
[0121] By storing target data in a specific format, maintenance personnel can easily compare and query the resources and attributes of network devices, thereby further improving the efficiency of network device management.
[0122] Specifically, step S304 includes:
[0123] Step S3041: When the Simple Network Management Protocol (SMMP) message to be processed contains attribute information of the managed network device resources, the target data format data is divided into one or more files for storage based on the data volume of the target data format data.
[0124] Specifically, for information obtained via GET, the data from a single query is saved as a single file; while for information with a large amount of data, by comparing the size of the data bytes, when the number of data bytes exceeds a preset threshold, the data can be truncated according to different nodes at the same level and stored separately to avoid the problem of a single folder being too large, and to facilitate subsequent fast data queries.
[0125] Step S3042: When the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device, store the target data format data according to the time period.
[0126] Specifically, since the timing of network device alarms and other event information is crucial for maintenance personnel to perform maintenance, this type of information can be stored within time periods to facilitate their reading, quick processing, and improved efficiency in network device management.
[0127] By using different storage methods according to the different contents of the Simple Network Management Protocol (SMLP) messages to be processed, it is easier for maintenance personnel to accurately and quickly find the required network device resources and attribute information, improve data query speed, and further improve the efficiency of network device management.
[0128] The following section will provide a detailed explanation of the specific implementation process of the simple network management protocol data parsing method provided in this embodiment of the invention, using specific application examples.
[0129] For example, taking JSON as the target data format, a tool that implements a simple network management protocol data parsing method is run on the network management system side, such as... Figure 4 Specifically, it may include four parts: MIB decoding, data acquisition, data conversion, and data dumping.
[0130] The system includes: MIB decoding, which decodes MIB files to generate a JSON dictionary corresponding to resources and attributes; a data acquisition module, which sends GET requests to query resource information from the Agent and monitors Trap information sent by the Agent; a data conversion module, which converts the collected data into JSON format based on the JSON dictionary; and a data dumping module, which stores the converted JSON data in a specified directory or file.
[0131] Specifically, the MIB is a tree structure. SNMP messages access devices in the network by traversing the nodes in the MIB tree directory. Each characteristic of a device is uniquely specified by an Object Identifier (OID). MIB decoding converts each node in the MIB file into a "key" in JSON format according to its directory structure. All child nodes under each node constitute a new JSON object, which serves as the "value" of the parent node. This process is repeated recursively, starting from the root node of the MIB file, parsing layer by layer to obtain the mapping relationship between each node (OID) and the "key" in the JSON, generating a JSON format dictionary.
[0132] Data acquisition includes two data sources: active acquisition and passive monitoring. Active data acquisition uses the GET method in SNMP to directly obtain attribute information of a specified resource from the Agent, mainly including the basic attributes of the managed object. Passive monitoring involves the Agent proactively reporting important events to the management station, primarily device alarm information. When configuring the SNMP service management station, Trap information can be redirected to a specified file. The data acquisition module monitors and collects Trap messages by reading this file in real time. These two types of information are stored in different files and serve as input to the data conversion module.
[0133] Data conversion differs between GET and Trap messages. For GET messages, the data conversion module parses each message individually, looks up its OID in a JSON dictionary to obtain the JSON key path, and combines the attribute values from the message with the key to form key-value pairs, generating a complete JSON element. Furthermore, for multiple resources of the same type, an array is used for storage in JSON, with all attributes of each resource forming a JSON object as an element of the array, facilitating queries for resources of the same type and improving query efficiency. For Trap messages, due to their time-sensitive nature, while parsing the key-value pairs, it is necessary to record their type and message time to form a complete JSON element.
[0134] Data dumping involves transferring the converted JSON data to a JSON file and uploading it to the cloud for storage. For GET requests, data from a single query is saved as a single file; for larger datasets, data can be extracted and stored separately according to different nodes at the same level. For Trap data, it is stored by time period for easy comparison and querying.
[0135] By decoding the MIB, a JSON dictionary corresponding to resources and attributes is generated. Different types of messages obtained from the Agent are converted to generate more readable and parsable JSON data, which is then saved to different files and stored in the cloud, improving network management efficiency.
[0136] This embodiment also provides a Simple Network Management Protocol (SMMP) data parsing device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0137] This embodiment provides a simple network management protocol data parsing device, such as... Figure 5 As shown, it includes:
[0138] The acquisition module 501 is used to acquire the management information database file corresponding to each managed network device.
[0139] The first processing module 502 is used to decode the management information database file and establish a dictionary of target data formats corresponding to resources and attributes.
[0140] The second processing module 503 is used to parse the Simple Network Management Protocol (SMRM) message to be processed using a target data format dictionary to obtain the target data format data.
[0141] In some optional implementations, the first processing module 502 includes:
[0142] The first processing unit is used to convert the resources and attributes corresponding to each node into data objects in the target data format, starting from the root node, based on the tree structure of the management information database file.
[0143] The second processing unit is used to establish the hierarchical relationship between data objects based on the tree structure of the management information database file, and to form the data object query path for each data object.
[0144] The third processing unit is used to establish a mapping relationship between each node and the query path of the data object based on the correspondence between nodes and data objects.
[0145] The fourth processing unit is used to generate a dictionary of target data formats corresponding to resources and attributes based on data objects, data object query paths, and mapping relationships.
[0146] In some optional implementations, the second processing module 503 includes:
[0147] The fifth processing unit is used to extract the target node and its corresponding attribute value from the Simple Network Management Protocol (SMLP) message to be processed.
[0148] The sixth processing unit is used to look up the target data format dictionary according to the target node and obtain the target data object query path corresponding to the target node.
[0149] The seventh processing unit is used to search the target data format dictionary according to the target data object query path to obtain the target data object.
[0150] The eighth processing unit is used to combine the target data object and attribute values to obtain the target data format data.
[0151] In some optional implementations, when the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device, the second processing module 503 further includes:
[0152] The ninth processing unit is used to extract the message time and corresponding event information from the Simple Network Management Protocol (SMLP) messages to be processed.
[0153] The tenth processing unit is used to add the message time and event type to the target data format data.
[0154] In some optional implementations, the simple network management protocol data parsing device provided in this embodiment further includes:
[0155] The third processing module is used to store the target data format.
[0156] In some alternative implementations, the third processing module includes:
[0157] The first storage unit is used to divide the target data format data into one or more files for storage based on the data volume of the target data format data when the simple network management protocol message to be processed contains attribute information of the managed network device resources.
[0158] The second storage unit is used to store target data in a time-based format when the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device.
[0159] In some alternative implementations, the Simple Network Management Protocol (SMLP) data parsing apparatus further includes:
[0160] The fourth processing module is used to obtain a first Simple Network Management Protocol (SMLP) message containing attribute information of the managed network device resources through the agent process, or to receive a second SMLP message containing event information of the managed network device reported by the agent process.
[0161] The fifth processing module is used to identify either the first Simple Network Management Protocol (SMMP) message or the second SMMP message as the SMMP message to be processed.
[0162] In this embodiment, the simple network management protocol data parsing device is presented in the form of a functional unit. Here, a unit refers to an ASIC circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0163] The further functional descriptions of the above modules and units are the same as those in the corresponding method embodiments described above, and will not be repeated here.
[0164] This invention also provides a computer device having the above-described features. Figure 5 The diagram shows a simple network management protocol data parsing device.
[0165] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 6As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 6 Take a processor 10 as an example.
[0166] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GPA), or any combination thereof.
[0167] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.
[0168] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device as shown by a landing page for an app. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, which can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0169] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0170] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.
[0171] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0172] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A simple method for parsing network management protocol data, characterized in that, The method includes: Obtain the management information database file corresponding to each managed network device; The management information database file is decoded to establish a dictionary of target data formats corresponding to resources and attributes; The target data format dictionary is used to parse the Simple Network Management Protocol (SMMP) message to be processed to obtain the target data format data. Decoding the management information database file and establishing a target data format dictionary corresponding to resources and attributes includes: Based on the tree structure of the management information database file, starting from the root node, the resources and attributes corresponding to each node are sequentially converted into data objects in the target data format. Based on the data objects, the hierarchical relationships between data objects, and the correspondence between nodes and data objects, a target data format dictionary corresponding to resources and attributes is generated. The step of parsing the Simple Network Management Protocol (SMLP) message to be processed using the target data format dictionary to obtain target data format data includes: Extract the target node and its corresponding attribute values from the Simple Network Management Protocol (SMMP) message to be processed; The target data format dictionary is searched according to the target node to obtain the target data format data.
2. The method according to claim 1, characterized in that, The step of generating a target data format dictionary corresponding to resources and attributes based on the data objects, the hierarchical relationships between data objects, and the correspondence between nodes and data objects includes: Based on the tree structure of the management information database file, the hierarchical relationship between data objects is established, and the data object query path of each data object is formed. Based on the correspondence between nodes and data objects, establish a mapping relationship between each node and the query path of the data object; A dictionary of target data formats corresponding to resources and attributes is generated based on the data object, the data object query path, and the mapping relationship.
3. The method according to claim 2, characterized in that, The step of searching the target data format dictionary according to the target node to obtain the target data format data includes: The target data object query path corresponding to the target node is obtained by searching the target data format dictionary according to the target node. The target data object is obtained by searching the target data format dictionary according to the target data object query path. The target data object and the attribute value are combined to obtain the target data format data.
4. The method according to claim 3, characterized in that, When the Simple Network Management Protocol (SMMP) message to be processed contains event information of the managed network device, the step of parsing the SMMP message to be processed using the target data format dictionary to obtain target data format data further includes: The event type from which the message time and corresponding event information are extracted from the Simple Network Management Protocol (SRM) message to be processed; Add the message time and the event type to the target data format data.
5. The method according to claim 1, characterized in that, Also includes: The target data format data is stored.
6. The method according to claim 5, characterized in that, The storage of the target data format includes: When the Simple Network Management Protocol (SMMP) message to be processed contains attribute information of the managed network device resources, the target data format data is divided into one or more files for storage based on the data volume of the target data format data; When the Simple Network Management Protocol (SMLP) message to be processed contains event information of the managed network device, the target data format data is stored according to time periods.
7. The method according to claim 1, characterized in that, The Simple Network Management Protocol (SMMP) message to be processed is obtained in the following way: The agent process obtains a first Simple Network Management Protocol (SMLP) message containing attribute information of the managed network device resources, or receives a second Simple Network Management Protocol (SMLP) message containing event information of the managed network device reported by the agent process. The first Simple Network Management Protocol (SMLP) message or the second Simple Network Management Protocol (SMLP) message is identified as the SMLP message to be processed.
8. A simple network management protocol data parsing device, characterized in that, The device includes: The acquisition module is used to acquire the management information database file corresponding to each managed network device; The first processing module is used to decode the management information database file and establish a dictionary of target data formats corresponding to resources and attributes. Decoding the management information database file and establishing the dictionary of target data formats corresponding to resources and attributes includes: based on the tree structure of the management information database file, sequentially converting the resources and attributes corresponding to each node into data objects of the target data format, starting from the root node; and generating a dictionary of target data formats corresponding to resources and attributes based on the data objects, the hierarchical relationships between data objects, and the correspondence between nodes and data objects. The second processing module is used to parse the Simple Network Management Protocol (SMMP) message to be processed using the target data format dictionary to obtain target data format data. The step of parsing the SMMP message to be processed using the target data format dictionary to obtain target data format data includes: extracting the target node and its corresponding attribute value from the SMMP message to be processed; and searching the target data format dictionary according to the target node to obtain the target data format data.
9. A computer device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method of any one of claims 1 to 7.