Network device management method and apparatus, computer device and storage medium
By parsing the database files of network devices to generate logical relationship structures, the problem of low management efficiency of switches of different brands and models is solved, achieving efficient status collection and visualization, and improving user experience and monitoring service performance.
Patent Information
- Application Number
- CN202410519207.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2044-04-28
AI Technical Summary
Existing network device management methods require a lot of manual adaptation and coding work when managing a large number of switches of different brands and models, resulting in low development and monitoring efficiency and poor user experience.
By acquiring and parsing the database file of the target network device, an initial logical relationship structure based on object identifiers is generated. Monitoring tasks are determined based on user requests, the target logical relationship structure is aggregated, status collection requests are triggered, and the data is visualized, reducing the number of status collections and the time complexity of the parsing process.
It improves the efficiency of network device management and user experience, reduces the time complexity of the status resolution process, enhances the performance of monitoring services, and supports dynamic adjustment of monitoring objects.
Smart Images

Figure CN118316816B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, in particular to a network equipment management method and device, computer equipment and storage medium. BACKGROUND
[0002] Switches undertake the important work of information forwarding and switching in a network environment, so real-time monitoring of the state of the switch and ensuring that the switch is in a stable working state at all times are crucial for network stability. However, the three existing ways of obtaining the state of the switch all have various limitations and are inconvenient to use. The three ways of obtaining the state of the switch are as follows.
[0003] Rest (Representational State Transfer) interface: 1. Applicable scope is small, most of the switch device states that need to be monitored do not provide a Rest interface, and some switches do not provide any Rest interface to the outside world; 2. The Rest interface rules provided by different brands of switches, the same brand of different models of switches, and the same model of different versions of switches are not completely unified, and adaptation development needs to be done for various switches; 3. The response speed of some Rest interfaces of the switch is slow, and needs to be waited for, which is not a good experience.
[0004] CLI (Command Line Interface) command interface: 1. The CLI commands of various brands and models of switches are inconsistent, and adaptation development needs to be done for various switches; 2. Some fiber switches have restrictions on the execution frequency or total number of CLI commands, and frequent and large-scale use of CLI commands to operate the switch will affect the service life of the switch.
[0005] SNMP protocol (Simple Network Management Protocol): Since the SNMP obtains the state of the switch, the unique OID (Object Identifier) corresponding to the state needs to be manually identified in advance, and then the OID is encoded and obtained through get commands, etc. The process is cumbersome, and when the monitoring state needs to be adjusted or new switch equipment needs to be adapted, the workload is huge.
[0006] Therefore, in a complex network environment where a large number of different brands and models of switches need to be managed, the existing three ways all require a lot of manual adaptation, coding, etc. The development and monitoring efficiency will be greatly affected, and the user experience is poor.
[0007] Therefore, there is an urgent need to provide a network equipment management method and device, computer equipment and storage medium that can improve the user experience. SUMMARY
[0008] Therefore, it is necessary to provide a network device management method and device, computer equipment and storage medium capable of improving user experience in view of the above technical problems.
[0009] In one aspect, a network device management method is provided, which comprises:
[0010] acquiring and parsing a database file corresponding to a target network device to generate an initial logical relationship structure based on object identifiers;
[0011] determining a monitoring task based on a user request, the monitoring task at least including a network device state to be monitored and a monitoring frequency;
[0012] aggregating the initial logical relationship structure based on the network device state to be monitored to generate a target logical relationship structure;
[0013] triggering a state collection request according to the target logical relationship structure and the monitoring frequency, and collecting a target state of the network device based on the state collection request;
[0014] visualizing the target state of the network device to realize management of the network device.
[0015] Optionally, before acquiring and parsing the database file corresponding to the target network device, the method further comprises:
[0016] detecting whether the target network device has been added to a monitoring service program;
[0017] acquiring the database file corresponding to the target network device in response to detecting that the target network device has been added to the monitoring service program.
[0018] Optionally, the parsing of the database file corresponding to the target network device to generate the initial logical relationship structure based on object identifiers comprises:
[0019] parsing the acquired database file corresponding to the target network device by using the monitoring service program to obtain a mapping relationship between object identifiers of components of the target network device and corresponding state names of the components;
[0020] constructing a root node and a child node of the initial logical relationship structure, the child node including a first target node generated based on a network device name, a second target node generated based on a component name, and a third target node generated based on a state name corresponding to a state value;
[0021] generate a first target path to connect the root node, the first target node, the second target node and the third target node based on the mapping relationship between the object identifier and the corresponding state name;
[0022] generate an initial logical relationship structure based on the object identifier based on the plurality of first target paths, wherein the first target node is a child node of the root node, the second target node is a child node of the corresponding first target node, and the third target node is a child node of the corresponding second target node.
[0023] Optionally, the initial logical relationship structure is aggregated based on the network device state to be monitored to generate the target logical relationship structure, comprising:
[0024] traverse the initial logical relationship structure to determine a second target path corresponding to the network device state to be monitored;
[0025] mark the nodes on the second target path with a first marker, and delete the remaining unmarked child nodes to generate a second logical relationship structure;
[0026] traverse the second logical relationship structure based on a depth-first algorithm, and detect whether the number of child nodes containing the first marker in the fourth target node exceeds a first preset threshold value;
[0027] in response to detecting that the number of child nodes exceeds the first preset threshold value, mark the fourth target node with a second marker, and mark the child nodes corresponding to the fourth target node with a third marker;
[0028] generate the target logical relationship structure based on the marked nodes.
[0029] Optionally, according to the target logical relationship structure and the monitoring frequency, a state collection request is triggered, and based on the state collection request, a target state of the network device is collected, comprising:
[0030] based on the monitoring frequency, a state collection request is triggered at a time, and the state collection request includes a target node marker determined based on the target logical relationship structure;
[0031] in response to detecting that the target node marker is the first marker, a target state of the network device is collected based on the first state collection request;
[0032] in response to detecting that the target node marker is the second marker, a target state of the network device is collected based on the second state collection request.
[0033] Optionally, the method further comprises:
[0034] create a callback function chain table based on a collection task corresponding to the state collection request;
[0035] in response to detecting that the state collection request has been sent to the network device, build a callback function and add the callback function as a node to the callback function chain table;
[0036] in response to detecting that the length of the callback function chain table is less than a second preset threshold, save a key-value pair generated based on a state value of a collected target state and a corresponding object identifier.
[0037] Optionally, the visual display of the target state of the network device comprises:
[0038] analyzing the key-value pair to obtain a state value of the target state;
[0039] based on a size relationship between the state value and a third preset threshold, marking the state value with different identifiers;
[0040] based on the marking result, visually displaying the target state of the network device on a first terminal and / or pushing the target state to a second terminal in a target format.
[0041] In another aspect, a network device management apparatus is provided, and the apparatus comprises:
[0042] an initial logical relationship structure generation module configured to obtain and analyze a database file corresponding to a target network device to generate an initial logical relationship structure based on an object identifier;
[0043] a monitoring task determination module configured to determine a monitoring task based on a user request, the monitoring task at least including a network device state to be monitored and a monitoring frequency;
[0044] an aggregation module configured to aggregate the initial logical relationship structure based on the network device state to be monitored to generate a target logical relationship structure;
[0045] a collection module configured to trigger a state collection request according to the target logical relationship structure and the monitoring frequency, and collect a target state of a network device based on the state collection request;
[0046] a display module configured to visually display the target state of the network device to implement management of the network device.
[0047] In yet another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
[0048] acquire and parse a database file corresponding to the target network device to generate an initial logical relationship structure based on object identifiers;
[0049] based on a user request, determine a monitoring task, the monitoring task at least including a network device state to be monitored and a monitoring frequency;
[0050] based on the network device state to be monitored, aggregate the initial logical relationship structure to generate a target logical relationship structure;
[0051] according to the target logical relationship structure and the monitoring frequency, trigger a state collection request, and based on the state collection request, collect a target state of the network device;
[0052] visualize the target state of the network device to achieve management of the network device
[0053] In another aspect, a computer readable storage medium is provided, having stored thereon a computer program, the computer program being executed by a processor to implement the following steps:
[0054] acquire and parse a database file corresponding to the target network device to generate an initial logical relationship structure based on object identifiers;
[0055] based on a user request, determine a monitoring task, the monitoring task at least including a network device state to be monitored and a monitoring frequency;
[0056] based on the network device state to be monitored, aggregate the initial logical relationship structure to generate a target logical relationship structure;
[0057] according to the target logical relationship structure and the monitoring frequency, trigger a state collection request, and based on the state collection request, collect a target state of the network device;
[0058] visualize the target state of the network device to achieve management of the network device
[0059] The network device management method, device, computer device and storage medium, the method comprises: obtaining and analyzing a database file corresponding to a target network device to generate an initial logical relationship structure based on an object identifier; determining a monitoring task based on a user request, the monitoring task at least comprising a network device state to be monitored and a monitoring frequency; aggregating the initial logical relationship structure based on the network device state to be monitored to generate a target logical relationship structure; triggering a state collection request according to the target logical relationship structure and the monitoring frequency, and collecting a target state of the network device based on the state collection request; and visualizing the target state of the network device to realize management of the network device. The application reduces the total number of network device state collection by aggregating the logical relationship structure, reduces the time complexity of the state analysis process, improves the monitoring service performance, and based on the logical relationship structure, the monitoring object can be dynamically adjusted to adjust the monitoring state of the network device at any time, improving the user experience. BRIEF DESCRIPTION OF DRAWINGS
[0060] Figure 1 An application environment diagram of a network device management method in an embodiment;
[0061] Figure 2 A flowchart of a network device management method in an embodiment;
[0062] Figure 3 Another flowchart of a network device management method in an embodiment;
[0063] Figure 4 An OID aggregation diagram of a network device management method in an embodiment;
[0064] Figure 5 A state collection flowchart of a network device management method in an embodiment;
[0065] Figure 6 A structural block diagram of a network device management device in an embodiment;
[0066] Figure 7 Another structural block diagram of a network device management device in an embodiment;
[0067] Figure 8 An internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0068] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0069] It should be understood that in the description of the present application, unless the context clearly requires otherwise, the terms "comprise", "comprising", and the like in the specification are to be construed as inclusive or open-ended, rather than exclusive or exhaustive; that is, in the sense of "including, but not limited to".
[0070] It should also be understood that the terms "first", "second", and the like are used only for descriptive purposes and should not be construed as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise stated, the meaning of "multiple" is two or more.
[0071] It should be noted that the terms "S1", "S2", and the like are only used for the purpose of describing the steps and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only used to facilitate the description of the method of the present application and should not be construed as indicating the order of the steps. In addition, the technical solutions of various embodiments can be combined with each other, but must be based on the fact that a person of ordinary skill in the art can implement it. When the combination of technical solutions contradicts each other or cannot be implemented, it should be considered that the combination of technical solutions does not exist and is not within the protection scope claimed by the present application.
[0072] The network device management method provided by the present application can be applied to the application environment as shown in Figure 1 . Among them, the terminal 102 communicates with the data processing platform set on the server 104 through the network, wherein the terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be realized by an independent server or a server cluster composed of multiple servers.
[0073] In one embodiment, as shown in Figures 2-3 , a network device management method is provided, which is applied to the terminal in Figure 1 for example, including the following steps:
[0074] S1: Obtain and parse the database file corresponding to the target network device to generate an initial logical relationship structure based on object identifiers.
[0075] It should be noted that the database file refers to the MIB (Management Information Base) file, which is a database file used to describe the properties of each component (such as fans, power supplies, etc.) in a networked device, defines a standard structure, and is a text file. MIB files are usually created and maintained by device manufacturers, and each manufacturer may define specific MIB files for their devices. The target network device can be a switch, router, server, or other network device, which is not limited in the present application. The object identifier refers to OID (Object Identifier), which is an important concept in SNMP, used to uniquely identify the managed objects (status) in MIB. OID is a string composed of a series of numbers, similar to a path, used to locate specific managed objects in the MIB tree. Each managed object (parameter) has a unique OID, so SNMP can accurately get or set their values. Among them, SNMP (Simple Network Management Protocol) is a network management protocol used to collect and manage information of network devices. SNMP allows network administrators to remotely query and set parameters of network devices from a network management station (NMS), thereby monitoring and controlling the status and behavior of network devices. SNMP defines a set of operations such as GET (get command, used to get the value of a specific OID from the SNMP agent device, the administrator sends a GET request to the SNMP agent through the NMS (network management system), and the agent returns the corresponding OID value), GETNEXT (get next command, similar to the GET command, but gets the value of the next OID after the specified OID, which is usually used to traverse the objects in the MIB (Management Information Base)), BULKGET (bulk get command, used to get the values of multiple OIDs at a time to reduce network overhead and delay, the BULKGET command allows administrators to more efficiently get a large amount of data), used to get network device parameters (status) such as Figure 4 As shown, the logical relationship structure is a tree structure, which can be obtained by parsing the MIB file, marking the hierarchical relationship of each state attribute, and using the corresponding attribute identifier to mark and store the parsed logical relationship structure. The attribute identifier can be the model of the network device corresponding to the tree structure, to facilitate monitoring and managing network devices of the same model.
[0076] In some embodiments, before obtaining and parsing the database file corresponding to the target network device, the method further comprises:
[0077] The user adds the target network device to the monitoring service program, and detects whether the target network device is added to the monitoring service program;
[0078] In response to detecting that the target network device has been added to the monitoring service program, obtaining a database file corresponding to the target network device;
[0079] If not detected, no operation is performed.
[0080] Wherein, by adding the target network device to the monitoring service program, the MIB file of the user uploaded switch can be obtained for subsequent parsing.
[0081] In some embodiments, parsing the database file corresponding to the target network device to generate an initial logical relationship structure based on the object identifier includes:
[0082] Parsing the obtained database file corresponding to the target network device using the monitoring service program to obtain the mapping relationship between the object identifier of each component of the target network device and the corresponding state name, wherein the MIB file is a text file and is a collection of all state OID (object identifier) definitions of a device, and the monitoring service program can automatically parse the MIB file to generate an OID tree structure, and the path from the root node to each node of the tree structure is represented by the corresponding OID;
[0083] Building the root node and the child node of the initial logical relationship structure, the child node including a first target node generated based on the network device name, a second target node generated based on the component name, and a third target node generated based on the state name corresponding to the state value, wherein the nodes in the tree structure are generally of two types, one representing a specific state value, such as the third node described above, and the other representing a cluster, such as the first target node and the second target node described above, and exemplarily, the first target node can be different switch names, and the second target node can be power supply names of the switch;
[0084] Based on the mapping relationship between the object identifier and the corresponding state name, a first target path is generated, i.e., the path of each node is represented by the corresponding OID, to connect the root node, the first target node, the second target node, and the third target node, such as switch 1, power supply 1, and the state value x corresponding to the power supply, connecting the above nodes and representing the connection path by the corresponding OID;
[0085] Based on a plurality of first target paths, an initial logical relationship structure based on the object identifier is generated, wherein the first target node is a child node of the root node, the second target node is a child node corresponding to the first target node, and the third target node is a child node corresponding to the second target node, and exemplarily, as shown in Figure 4As shown, the first level is a root node, the second level 0, 1, 2 is the name of different switches, which is a child node of the root node, the third level 0, 1, 2 is the name of different switch power supplies, which is a child node under the switch 1 node, the fourth level 0, 1, 2... is the value of the state of different switch power supplies, which is a child node under the power supply 2 node, and so on. In addition, the network device has an overall state, which can include memory usage, cpu usage, etc. in addition to the power supply, which will not be illustrated one by one here.
[0086] In the above embodiment, by constructing the initial logical relationship structure, a general monitoring scheme for selecting the state of the network device for subsequent visualization configuration is facilitated, thereby reducing the operation steps of adapting and monitoring different models of network devices.
[0087] S2: Based on the user request, determine the monitoring task, which at least includes the network device state to be monitored and the monitoring frequency.
[0088] It should be noted that the user request is the user request uploaded together with the database file, which includes the monitoring parameters configured by the user according to the demand, that is, the selected network device state to be monitored and the monitoring frequency, which is used for subsequent aggregation of the initial logical relationship structure and timely acquisition of the state value of the network device.
[0089] Further, the parsed MIB file is a tree structure of an OID, and the nodes in the tree can represent a state of the network device. Adjusting the state value to be monitored is actually selecting a list of nodes to be monitored (changing the list of monitored nodes triggers aggregation of the monitoring item). Therefore, according to the user request, the state value to be monitored can be dynamically adjusted, and a separate collection task will be generated based on each network device. After dynamically adjusting the monitoring frequency and the list of monitored states, the monitoring frequency will be issued, and the next time the collection task is generated, it will take effect.
[0090] S3: Based on the network device state to be monitored, aggregate the initial logical relationship structure to generate a target logical relationship structure.
[0091] It should be noted that the aggregation of the initial logical relationship structure means that the monitoring items are aggregated according to the network device state to be monitored, and the aggregation of the monitoring item reasons includes that the SNMP only defines several standard methods for querying data, which are GET (obtaining a node value according to an OID, without including a child node), GETNEXT (obtaining a value of a node adjacent to an OID corresponding node according to an OID, without including a child node, which is not usually used), BULKGET (obtaining a value of a node and a child node according to an OID, without including a grandchild node), and WALK (obtaining a node and all node values of a subtree with the node as a root according to an OID). As described above, all query method parameters are OIDs, that is, each additional OID requires an additional interaction request, and therefore, it is necessary to aggregate all state OID lists to reduce the number of interactions.
[0092] In some embodiments, based on the network device state to be monitored, the aggregation of the initial logical relationship structure generates a target logical relationship structure, including:
[0093] Traversing the initial logical relationship structure, a second target path corresponding to the network device state to be monitored is determined, that is, a corresponding OID is selected according to the network device state to be monitored;
[0094] Using a first marker to mark the nodes on the second target path, that is, using a first marker to mark all OID corresponding nodes to be monitored, and deleting the remaining unmarked child nodes to generate a second logical relationship structure, wherein the unmarked child nodes can be all child nodes, or a subtree not containing a green node among sibling nodes, to reduce the size and level of the MIB tree. This deletion can be temporary deletion, which is valid only when the aggregation is effective, or permanent deletion, which is selected according to the need. The first marker can be a certain color (such as green), or can be marked by different lines (such as diagonal lines), for example, as shown in Figure 4 ;
[0095] Based on a depth-first algorithm, the second logical relationship structure is traversed, and it is detected whether the number of child nodes containing the first marker in the fourth target node exceeds a first preset threshold, that is, the number of marked nodes in the fourth target node is detected, wherein the first preset threshold can be set according to actual needs, such as whether the number of marked child nodes exceeds half of the number of all child nodes. The depth-first algorithm (Depth-first Search, DFS) refers to an algorithm for traversing or searching a tree or a graph. When the tree is searched, all nodes in the current level are not traversed, but each time a layer is deepened, until the bottom layer of the current tree is searched.
[0096] In response to detecting that the number of child nodes exceeds the first preset threshold, the fourth target node is marked with a second marker, and the child nodes corresponding to the fourth target node are marked with a third marker, wherein the second marker is a marker different from the first marker, such as blue or a curve, the third marker is a marker different from the first marker and the second marker, such as gray or a dashed line, and if a node that needs to be marked with the third marker has been marked with the second marker, the node is still marked with the second marker and is not changed;
[0097] After all the nodes are marked, the aggregation of the monitoring state OID is completed, and the aggregation result is a set of OIDs corresponding to all the nodes with the marker. Based on the marked nodes, the target logical relationship structure is generated, for example, as shown in Figure 4 The set of OIDs to be collected after aggregation is [root-1-0 (in the SNMP protocol, the defined OID is the path from the root node to the specified node, and the parent and child nodes are connected by a string), root-1-2-0, and root-1-2-1], which is 2 OIDs less than before aggregation (reducing twice the data interaction of the switch).
[0098] In the above embodiments, by aggregating the OIDs, the total number of network device state collection is reduced, the time complexity of the state analysis process is reduced, and the monitoring service performance is improved.
[0099] S4: Trigger a state collection request according to the target logical relationship structure and the monitoring frequency, and collect the target state of the network device based on the state collection request.
[0100] It should be noted that after triggering the state collection request, a corresponding monitoring task is generated, and the target state of the network device is collected based on the monitoring task.
[0101] In some specific embodiments, according to the target logical relationship structure and the monitoring frequency, a state collection request is triggered, and the target state of the network device is collected based on the state collection request, which includes:
[0102] Based on the monitoring frequency, a state collection request is triggered at a time, and the state collection request includes a target node marker determined based on the target logical relationship structure. The monitoring frequency can be set according to requirements, such as once every 10 minutes.
[0103] In response to detecting that the target node marker is the first marker, the target state of the network device is collected based on the first state collection request, wherein the first state collection request is a GET command.
[0104] In response to detecting that the target node marker is the second marker, the target state of the network device is collected based on a second state collection request, where the second state collection request is a GETNEXT command.
[0105] The reason for not directly using the WALK command to collect the subtree or the MIB tree once is that, in addition to storing a state value by itself, the node can also have n child nodes, and the child nodes also have their own child nodes, so the WALK cannot be used to obtain the state of the subtree (too much bandwidth and network traffic), and the same reason also applies to the BULKGET for collecting all monitoring states (or aggregated OID).
[0106] In some embodiments, as shown in FIG. 1, the method further includes: Figure 5
[0107] Based on the collection task corresponding to the state collection request, a callback function chain table is created;
[0108] In response to detecting that the state collection request has been sent to the network device, a callback function is constructed, and the callback function is added to the callback function chain table as a node;
[0109] In response to detecting that the length of the callback function chain table is less than a second preset threshold, a key-value pair generated based on the collected target state and the object identifier corresponding to the state value is saved, where the second preset value can be set according to actual needs.
[0110] Specifically, a separate callback function chain table is created for each collection task, so when the length of a callback function chain table becomes 0, it means that the collection task corresponding to the chain table is completed, at this time, the collected OID and the corresponding state value (key-value pair) can be reported to the analysis module for analysis, that is, after sending an SNMP GET request to the network device, the switch response is not waited for, only the callback function is generated (the callback function is added to the callback function chain table as a node), and the serial SNMP GET request limited by the number of threads in the scenario of a large number of network devices is all converted into an asynchronous request, the time complexity of the collection process is reduced, the total collection time is shortened, the state delay is reduced, and the user experience is improved. Since the callback function is generated and the resources are released immediately, other SNMP GET requests are executed, so the system resources can be further saved, only a few threads are needed to process a large number of switches and a large number of aggregated OID collections at the same time, and the resource utilization rate of the monitoring service is improved.
[0111] Further, based on the above coloring method, the collection result is analyzed to each monitoring state (the analysis result is analyzed to each marked node), and compared with the traditional traversal MIB tree method, the marking method can reduce the time complexity (the MIB tree is cut and reduced in the marking stage, and the level and branch number of the MIB tree are simplified).
[0112] S5: visualizing the target state of the network device to realize management of the network device.
[0113] It should be noted that the visualized client can include a current internal client, and can also include a third-party monitoring platform. The third-party monitoring platform queries all real-time states of the network devices in the monitoring service program through an inquiry interface provided by an extended support module.
[0114] In some specific embodiments, visualizing the target state of the network device includes:
[0115] The key-value pair is analyzed to obtain a state value of the target state. The key value refers to a numerical value of a K-V structure, V is a corresponding state value, and K is an OID. The meaning of the OID is known through analysis;
[0116] Based on a size relationship between the state value and a third preset threshold value, the state value is marked by using different identifiers. The third preset threshold value can be set according to actual needs. Specifically, the real-time state of the network device after analysis is marked by using different colors (marked as red if the threshold value is exceeded, marked as green if the threshold value is not exceeded, and marked as gray if no valid value is collected) according to the threshold value (a default value, which can be adjusted), so as to facilitate intuitive viewing of a user. Meanwhile, historical state values of each time node of the network device are stored, which are used for comparison and display of a running state change trend, analysis of a network device load peak interval, and the like;
[0117] Based on the marking result, the target state of the network device is visualized on a first terminal and / or the target state is pushed to a second terminal in a target format. The first terminal is the internal client described above, and the second terminal is the third-party monitoring platform described above. Specifically, an inquiry interface is provided to the outside, and all real-time states of the network devices in the monitoring service can be inquired. According to configuration platform configuration information, the network device state can be actively pushed to other third-party monitoring platforms (information such as an account, a password, and a reporting interface address of the third-party monitoring platform needs to be configured) in a JSON format, so as to facilitate integration of the monitoring service program as an intermediate service into an existing monitoring service of a user or a system.
[0118] In the above embodiment, by visualizing the real-time state, the user can intuitively view the specific real-time state of the network device, and through the configurable extension support, the user's existing monitoring service program or third-party platform can be quickly accessed, and the system compatibility is improved.
[0119] In some specific embodiments, according to the visualization result, a running state change trend graph of the network device in a target time period is obtained, wherein the target time period includes a plurality of time nodes, each time node is taken as an abscissa value in the graph, and a state quantity corresponding to each node is taken as an ordinate value of the running state change trend graph. The ordinate values corresponding to the plurality of time points are connected to obtain the running state change trend graph. The state quantity value can be assigned according to the color of the label by expert experience, for example, the label is red, the value is 2, the label is green, the value is 1, and the label is gray, the value is 0.
[0120] The sum of the slopes of the running state change trend graph in the target time period is calculated, wherein when the slope of a straight line from one time node to another time node is negative, the absolute value is taken to calculate the sum of the slopes.
[0121] When it is detected that the sum of the slopes is less than a fourth preset threshold, the target time period and the nodes in the logical relationship structure in the time period that are marked with the identifier are recorded and stored.
[0122] In response to detecting that the recorded number of times is greater than a fifth preset threshold, when state monitoring collection needs to be performed in the next target time period, the marker is automatically filled into the initial logical relationship structure to monitor and collect the response state.
[0123] The fourth preset threshold and the fifth preset threshold can be set according to actual needs, and the recorded number of times refers to the number of times recorded in the same time period, for example, from 12:00 to 13:00 today and from 12:00 to 13:00 tomorrow belong to the same time period. When the sum of the slopes is less than the fourth preset threshold, it indicates that the values collected in the time period are all valid values.
[0124] In the above embodiment, based on the running state change trend graph, the node that needs to be automatically filled with the marker is determined, which is used to automatically collect the corresponding state value in a specific time period, avoiding incomplete state value collection caused by manual input request, thereby reducing the problem of network device running performance.
[0125] The network device management method comprises the following steps: after adding a network device into a monitoring service program, the monitoring service program parses a corresponding MIB file to complete mapping of an OID and a state name (a state KEY), a user selects a state of the network device to be monitored and a monitoring frequency in the monitoring service program, the monitoring service program aggregates all state OIDs of the switch to be monitored, triggers a collection task according to an aggregation result, automatically selects a corresponding SNMP operation method to complete asynchronous collection when the task is executed, automatically maps a collection result to a corresponding state value after the collection result is parsed, and then feeds back to a display module or forwards to other third-party monitoring programs to complete an overall management process. The MIB file is parsed, the network device monitoring item is visualized, the operation steps of adapting and monitoring different types of network devices are reduced, the total number of network device state collection is reduced through OID aggregation, the time complexity of the state parsing process is reduced, the monitoring service performance is improved, the number of concurrent requests during collection is increased through the monitoring callback function, the collection efficiency is improved, the real-time state delay is reduced, the system resource consumption is reduced, the monitoring state of the network device can be adjusted at any time through dynamic configuration, and the user experience is improved. The system compatibility is improved through the support of the configurable extension.
[0126] It should be understood that, although Figures 2-3 the steps in the flowcharts are shown in sequence according to the arrows, the steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified in this article, the execution of the steps has no strict sequence limitation, and the steps can be executed in other sequences. Moreover, Figures 2-3 at least part of the steps in the flowcharts can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of the sub-steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or sub-steps or stages of other steps.
[0127] In one embodiment, as shown in Figures 6-7 , a network device management apparatus is provided, comprising: an initial logical relationship structure generation module, a monitoring task determination module, an aggregation module, a collection module and a display module, wherein:
[0128] The initial logical relationship structure generation module is configured to obtain and parse a database file corresponding to a target network device to generate an initial logical relationship structure based on an object identifier;
[0129] The monitoring task determination module is configured to determine a monitoring task based on a user request, the monitoring task at least including a network device state to be monitored and a monitoring frequency;
[0130] aggregating the initial logical relationship structure based on the network device state to be monitored, to generate a target logical relationship structure;
[0131] The collecting module is configured to trigger a state collection request according to the target logical relationship structure and the monitoring frequency, and collect a target state of the network device based on the state collection request.
[0132] The display module is configured to visually display the target state of the network device, so as to realize management of the network device.
[0133] As a preferred embodiment, the device further comprises a configuration module, which is specifically configured to:
[0134] detect whether the target network device is added to a monitoring service program;
[0135] In response to detecting that the target network device has been added to the monitoring service program, obtain a database file corresponding to the target network device.
[0136] As a preferred embodiment, the initial logical relationship structure generating module is specifically configured to:
[0137] parse the obtained database file corresponding to the target network device by using the monitoring service program, to obtain a mapping relationship between an object identifier of each component of the target network device and a corresponding state name;
[0138] construct a root node and a child node of the initial logical relationship structure, wherein the child node comprises a first target node generated based on a network device name, a second target node generated based on a component name, and a third target node generated based on a state name corresponding to a state value;
[0139] generate a first target path based on the mapping relationship between the object identifier and the corresponding state name, to connect the root node, the first target node, the second target node, and the third target node;
[0140] generate an initial logical relationship structure based on the object identifier based on a plurality of first target paths, wherein the first target node is a child node of the root node, the second target node is a child node corresponding to the first target node, and the third target node is a child node corresponding to the second target node.
[0141] As a preferred embodiment, the aggregation module is specifically configured to:
[0142] traverse the initial logical relationship structure to determine a second target path corresponding to the network device state to be monitored;
[0143] marking the nodes on the second target path with the first marker and deleting the remaining unmarked child nodes to generate a second logical relationship structure;
[0144] based on a depth-first algorithm, traversing the second logical relationship structure and detecting whether the number of child nodes containing the first marker in the fourth target node exceeds a first preset threshold;
[0145] in response to detecting that the number of child nodes exceeds the first preset threshold, marking the fourth target node with a second marker and marking the child nodes corresponding to the fourth target node with a third marker;
[0146] generating the target logical relationship structure based on the marked nodes.
[0147] As a more optimal implementation, in the embodiment of the application, the collection module is specifically configured to:
[0148] based on the monitoring frequency and the task module, triggering a state collection request at a time, the state collection request including a target node marker determined based on the target logical relationship structure;
[0149] in response to detecting that the target node marker is the first marker, collecting the target state of the network device based on the first state collection request;
[0150] in response to detecting that the target node marker is the second marker, collecting the target state of the network device based on the second state collection request.
[0151] As a more optimal implementation, in the embodiment of the application, the collection module is specifically further configured to:
[0152] based on the collection task corresponding to the state collection request, creating a callback function linked list;
[0153] in response to detecting that the state collection request has been sent to the network device, constructing a callback function and adding the callback function as a node to the callback function linked list;
[0154] in response to detecting that the length of the callback function linked list is less than a second preset threshold, saving the key-value pair generated based on the collected target state and the object identifier corresponding thereto.
[0155] As a more optimal implementation, in the embodiment of the application, the display module is specifically configured to:
[0156] using the analysis module to analyze the key-value pair to obtain the state value of the target state;
[0157] marking the state value with different identifiers based on a size relationship between the state value and a third preset threshold value;
[0158] based on the marking result, visualizing the target state of the network device on the first terminal and / or pushing the target state to the second terminal in a target format.
[0159] The specific limitations of the network device management apparatus can be referred to the limitations of the network device management method, which will not be repeated here. Each module in the network device management apparatus can be realized by software, hardware and combinations thereof, in whole or in part. Each module can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each module.
[0160] In one embodiment, a computer device is provided, which can be a terminal, and its internal structure diagram can be as shown in Figure 8 The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is used to communicate with external terminals through network connection. The computer program is executed by the processor to implement a network device management method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0161] Those skilled in the art can understand that Figure 8 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0162] In one embodiment, a computer device is provided, which includes a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0163] S1: obtaining and parsing a database file corresponding to a target network device to generate an initial logical relationship structure based on object identifiers;
[0164] S2: determining a monitoring task based on a user request, the monitoring task including at least a network device state to be monitored and a monitoring frequency;
[0165] S3: aggregating the initial logical relationship structure based on the network device state to be monitored, to generate a target logical relationship structure;
[0166] S4: triggering a state collection request according to the target logical relationship structure and the monitoring frequency, and collecting a target state of the network device based on the state collection request;
[0167] S5: visualizing the target state of the network device to realize management of the network device.
[0168] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0169] detecting whether the target network device is added to a monitoring service program;
[0170] in response to detecting that the target network device has been added to the monitoring service program, obtaining a database file corresponding to the target network device.
[0171] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0172] parsing the obtained database file corresponding to the target network device using the monitoring service program to obtain a mapping relationship between an object identifier of each component of the target network device and a corresponding state name;
[0173] constructing a root node and a child node of the initial logical relationship structure, the child node including a first target node generated based on a network device name, a second target node generated based on a component name, and a third target node generated based on a state name corresponding to a state value;
[0174] generating a first target path based on the mapping relationship between the object identifier and the corresponding state name, to connect the root node, the first target node, the second target node, and the third target node;
[0175] generating an initial logical relationship structure based on the object identifier based on a plurality of first target paths, wherein the first target node is a child node of the root node, the second target node is a child node corresponding to the first target node, and the third target node is a child node corresponding to the second target node.
[0176] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0177] Traverse the initial logical relationship structure to determine a second target path corresponding to the network device state to be monitored;
[0178] Mark the nodes on the second target path with a first marker, and delete the remaining unmarked child nodes to generate a second logical relationship structure;
[0179] Based on a depth-first algorithm, traverse the second logical relationship structure, and detect whether the number of child nodes containing the first marker in a fourth target node exceeds a first preset threshold value;
[0180] In response to detecting that the number of child nodes exceeds the first preset threshold value, mark the fourth target node with a second marker, and mark the child nodes corresponding to the fourth target node with a third marker;
[0181] Based on the marked nodes, generate the target logical relationship structure.
[0182] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0183] Based on the monitoring frequency, trigger a state collection request at a time, and the state collection request includes a target node marker determined based on the target logical relationship structure;
[0184] In response to detecting that the target node marker is the first marker, collect the target state of the network device based on the first state collection request;
[0185] In response to detecting that the target node marker is the second marker, collect the target state of the network device based on the second state collection request.
[0186] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0187] Based on the collection task corresponding to the state collection request, create a callback function linked list;
[0188] In response to detecting that the state collection request has been sent to the network device, build a callback function, and add the callback function as a node to the callback function linked list;
[0189] In response to detecting that the length of the callback function linked list is less than a second preset threshold value, save the key-value pairs generated based on the collected target state and the object identifiers corresponding thereto.
[0190] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0191] Parse the key-value pairs to obtain the state value of the target state;
[0192] based on a size relationship between the state value and a third preset threshold, marking the state value with different identifiers;
[0193] based on the marking result, visualizing the target state of the network device on a first terminal and / or pushing the target state to a second terminal in a target format.
[0194] In one embodiment, a computer-readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the following steps:
[0195] S1: obtaining and parsing a database file corresponding to a target network device to generate an initial logical relationship structure based on object identifiers;
[0196] S2: determining a monitoring task based on a user request, the monitoring task at least including a network device state to be monitored and a monitoring frequency;
[0197] S3: aggregating the initial logical relationship structure based on the network device state to be monitored to generate a target logical relationship structure;
[0198] S4: triggering a state collection request according to the target logical relationship structure and the monitoring frequency, and collecting a target state of the network device based on the state collection request;
[0199] S5: visualizing the target state of the network device to realize management of the network device.
[0200] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0201] detecting whether the target network device is added to a monitoring service program;
[0202] in response to detecting that the target network device has been added to the monitoring service program, obtaining a database file corresponding to the target network device.
[0203] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0204] parsing the obtained database file corresponding to the target network device using the monitoring service program to obtain a mapping relationship between object identifiers of components of the target network device and corresponding state names;
[0205] constructing a root node and a child node of the initial logical relationship structure, the child node including a first target node generated based on a network device name, a second target node generated based on a component name, and a third target node generated based on a state name corresponding to a state value.
[0206] generate a first target path based on the mapping relationship between the object identifier and the corresponding state name, to connect the root node, the first target node, the second target node and the third target node;
[0207] generate an initial logical relationship structure based on object identifiers based on a plurality of first target paths, wherein the first target node is a child node of the root node, the second target node is a child node corresponding to the first target node, and the third target node is a child node corresponding to the second target node.
[0208] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0209] traverse the initial logical relationship structure to determine a second target path corresponding to the network device state to be monitored;
[0210] mark the nodes on the second target path with a first marker, and delete the remaining unmarked child nodes to generate a second logical relationship structure;
[0211] traverse the second logical relationship structure based on a depth-first algorithm, and detect whether the number of child nodes containing the first marker in the fourth target node exceeds a first preset threshold;
[0212] In response to detecting that the number of child nodes exceeds the first preset threshold, mark the fourth target node with a second marker, and mark the child nodes corresponding to the fourth target node with a third marker;
[0213] generate the target logical relationship structure based on the marked nodes.
[0214] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0215] trigger a state collection request at a time based on the monitoring frequency, wherein the state collection request includes a target node marker determined based on the target logical relationship structure;
[0216] In response to detecting that the target node marker is the first marker, collect the target state of the network device based on the first state collection request;
[0217] In response to detecting that the target node marker is the second marker, collect the target state of the network device based on the second state collection request.
[0218] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0219] create a callback function chain table based on the collection task corresponding to the state collection request;
[0220] in response to detecting that the state collection request has been sent to the network device, build a callback function, and add the callback function as a node to the callback function chain table;
[0221] in response to detecting that the length of the callback function chain table is less than a second preset threshold, save a key-value pair generated based on the collected target state value and the corresponding object identifier.
[0222] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0223] parse the key-value pair to obtain the state value of the target state;
[0224] based on the size relationship between the state value and a third preset threshold, mark the state value with different identifiers;
[0225] based on the marking result, visually display the target state of the network device on a first terminal and / or push the target state to a second terminal in a target format.
[0226] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When executed, the computer program can include the processes of the above-mentioned embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0227] Any combination of the technical features in the above embodiments can be made, and for the sake of brevity, not all possible combinations are described above, however, as long as the combination of the technical features does not exist in contradiction, it shall be considered within the scope of the present disclosure.
[0228] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it shall not be understood as a limitation on the patent scope of the present application. It shall be pointed out that, for ordinary skilled persons in the art, several modifications and improvements can be made without departing from the concept of the present application, and these shall be within the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.
Claims
1. A network device management method characterized by comprising: The method comprises: acquiring and parsing a database file corresponding to a target network device to generate an initial logical relationship structure based on object identifiers, the initial logical relationship structure comprising a root node and a child node, the child node comprising a first target node generated based on a network device name, a second target node generated based on a component name, and a third target node generated based on a state name corresponding to a state value, wherein the first target node is a child node of the root node, the second target node is a child node corresponding to the first target node, the third target node is a child node corresponding to the second target node, and a fourth target node is a child node corresponding to the third target node; based on a user request, determining a monitoring task, the monitoring task at least comprising a network device state to be monitored and a monitoring frequency; based on the network device state to be monitored, aggregating the initial logical relationship structure to generate a target logical relationship structure; according to the target logical relationship structure and the monitoring frequency, triggering a state collection request, and based on the state collection request, collecting a target state of the network device; visualizing the target state of the network device to achieve management of the network device; based on the network device state to be monitored, aggregating the initial logical relationship structure to generate a target logical relationship structure comprises: traversing the initial logical relationship structure to determine a second target path corresponding to the network device state to be monitored; using a first marker to mark the nodes on the second target path, and deleting the remaining unmarked child nodes to generate a second logical relationship structure; based on a depth-first algorithm, traversing the second logical relationship structure, and detecting whether the number of child nodes containing the first marker in the fourth target node exceeds a first preset threshold value; in response to detecting that the number of child nodes exceeds the first preset threshold value, using a second marker to mark the fourth target node, and using a third marker to mark the child nodes corresponding to the fourth target node; based on the marked nodes, generating the target logical relationship structure.
2. The network equipment management method of claim 1, wherein, Before acquiring and parsing the database file corresponding to the target network device, the method further comprises: detecting whether the target network device has been added to a monitoring service program; in response to detecting that the target network device has been added to the monitoring service program, acquiring the database file corresponding to the target network device.
3. The network equipment management method of claim 2, wherein, The parsing of the database file corresponding to the target network device to generate the initial logical relationship structure based on object identifiers comprises: using the monitoring service program to parse the acquired database file corresponding to the target network device to obtain a mapping relationship between object identifiers of components of the target network device and corresponding state names; constructing a root node and a child node of the initial logical relationship structure; based on the mapping relationship between the object identifiers and the corresponding state names, generating a first target path to connect the root node, the first target node, the second target node, and the third target node; based on a plurality of first target paths, generating the initial logical relationship structure based on object identifiers.
4. The network device management method of claim 1, wherein According to the target logical relationship structure and the monitoring frequency, a state collection request is triggered, and a target state of the network device is collected based on the state collection request, including: According to the monitoring frequency, a state collection request is triggered at a time, and the target node marker determined based on the target logical relationship structure is included in the state collection request; In response to detecting that the target node marker is a first marker, a target state of the network device is collected based on a first state collection request; In response to detecting that the target node marker is a second marker, a target state of the network device is collected based on a second state collection request.
5. The network equipment management method of claim 4, wherein, The method further includes: Based on the collection task corresponding to the state collection request, a callback function chain table is created; In response to detecting that the state collection request has been sent to the network device, a callback function is constructed, and the callback function is added to the callback function chain table as a node; In response to detecting that the length of the callback function chain table is less than a second preset threshold, a key-value pair generated based on the state value of the collected target state and the object identifier corresponding thereto is saved.
6. The network equipment management method of claim 5, wherein, Visualizing the target state of the network device includes: The key-value pair is parsed to obtain the state value of the target state; Based on the size relationship between the state value and a third preset threshold, the state value is marked with different identifiers; Based on the marking result, the target state of the network device is visualized on a first terminal and / or the target state is pushed to a second terminal in a target format.
7. A network device management apparatus for implementing the network device management method according to claim 1, characterized by comprising: The apparatus includes: An initial logical relationship structure generation module configured to obtain and parse a database file corresponding to a target network device to generate an initial logical relationship structure based on an object identifier; A monitoring task determination module configured to determine a monitoring task based on a user request, the monitoring task including at least a network device state to be monitored and a monitoring frequency; An aggregation module configured to aggregate the initial logical relationship structure based on the network device state to be monitored to generate a target logical relationship structure; A collection module configured to trigger a state collection request according to the target logical relationship structure and the monitoring frequency, and collect a target state of the network device based on the state collection request; A display module configured to visualize the target state of the network device to implement management of the network device.
8. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method of any one of claims 1 to 6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Distributed data storage method and system based on multilayer consistent hashing
CN110169040A
Network fault positioning method and device, computer equipment and storage medium
CN112291075A