Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a convention should be interpreted in accordance with the meaning of one of skill in the art having generally understood the convention (e.g., "a system having at least one of A, B and C" would include, but not be limited to, systems having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
It should be noted that, in the embodiments of the present application, some existing solutions in the industry such as software, components, models, etc. may be mentioned, and they should be regarded as exemplary, only for illustrating the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or must not use the solution.
In the technical solution of the present disclosure, information (including, but not limited to, hardware information of the target network, software information of the target network, configuration information of the target network, address information of the target network, etc.) and data (including, but not limited to, data for analysis, stored data, presented data, etc.) of the target network involved are information and data authorized by the owner of the target network or sufficiently authorized by each party, and the collection, storage, use, processing, transmission, provision, disclosure, application, etc. of related data all comply with relevant legal regulations and standards, necessary security measures are taken, no prejudice to the public conventions are provided, and corresponding operation entries are provided for the owner of the target network to select authorization or rejection.
In the process of collecting or finding network equipment resources, in the prior art, under the condition of multiple instances, a database is queried simultaneously, so that the same state is queried, data repetition is generated, and the technical problems of synchronous blocking, inconsistent data and the like are caused, wherein the synchronous blocking comprises the steps that all logics participating in the transaction operation are in a blocking state in the process of waiting for the response of other participants, and all the participants cannot perform any other operation in the process of waiting for the response of the other participants. In practical application, the problem is solved by a timeout judging mechanism, but the problem of synchronous blocking, deadlock and database locking cannot be completely solved, wherein data are inconsistent, if the data are received at the same time in the query stage. And the updating is completed, the data is queried at the same time point, the row lock of the table is unlocked, and the data redundancy is caused due to the same query result as the consistency, the atomicity and the durability of the database.
Fig. 1 schematically illustrates an application scenario diagram of a method for collecting network device resources according to an embodiment of the present disclosure.
As shown in fig. 1, an application scenario 100 according to this embodiment may include information security and big data technology fields. The network 104 is a medium used to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages etc. Various communication client applications, such as a shopping class application, a web browser application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only) may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
The first terminal device 101, the second terminal device 102, the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that, the method for collecting network device resources provided in the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, the collection device of network equipment resources provided in the embodiments of the present disclosure may be generally disposed in the server 105. The method for collecting network device resources provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105. Accordingly, the collection apparatus of network device resources provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The method for collecting network equipment resources according to the disclosed embodiment will be described in detail with reference to fig. 2 to 6 based on the scenario described in fig. 1.
Fig. 2 schematically illustrates a flowchart of a method of collecting network device resources according to an embodiment of the disclosure.
As shown in fig. 2, the method for collecting network equipment resources in this embodiment includes operations S210 to S250.
In operation S210, the device resources in the target network are multithreaded collected, and the collection of device resources that can be collected in the target network is transmitted to the working node.
The target network may be a local area network in the same geographic location, may be a local area network distributed in different geographic locations, or may be a wide area network with trusted authority.
Prior to operation S210, authorization of the target network manager needs to be acquired. The collectable device resource set includes shared device resources, externally visible device resources, and device resources that are visible through the target network manager authority.
The device resource includes software and hardware resources of the device, for example, CPU resource information, hard disk resource information, motherboard resource information, display card resource information, and the like of the device. The person skilled in the art can set the device resources to be collected according to the actual management requirements.
For example, before operation S210, a request to acquire information acquisition may be issued to a target network manager. The operations are performed in the event that the target network manager agrees or authorizes that the device resources are available.
In the embodiment of the disclosure, a corresponding operation entry can be provided for the target network manager, so that the target network manager can choose to agree or reject the automated decision result. That is, before the device resource is collected, an instruction to perform the collection may be obtained that the target network manager inputs approval or rejection through the corresponding operation portal. If the target network manager agrees to collect, the device resource is collected, that is, step S210 is performed. If the target network manager refuses to collect, the expert decision flow is entered.
In operation S220, a resource task table is created and the collectable device resource set received by the working node is classified and saved using the resource task table.
The resource task table is used for storing the ID of the device resource, the status information of the device resource, and the like. Those skilled in the art can set the device information to be saved according to the actual management requirements.
In operation S230, the resource task table is scanned by a single thread using the master work node, and the resource discovery message queue is issued to the slave work node if the scanning result satisfies a preset condition.
One worker node may be randomly designated from among a plurality of distributed worker nodes as a master worker node. For controlling periodic resource acquisition of master working node
In operation S240, periodic resource acquisition of the target network from the working node is controlled using the resource discovery message queue based on the preset resource threshold and acquisition interval.
The resource threshold may be, for example, a threshold temperature of the CPU, a threshold rotational speed of the hard disk, a threshold temperature, a threshold storage capacity, a read/write peak value, or the like. The above-mentioned resource threshold may be set by those skilled in the art according to actual management needs. In addition, the person skilled in the art can set the acquisition interval according to the actual management requirement.
In operation S250, the resource task table is dynamically updated with the collectable device resource set obtained from the periodic resource collection of the working node.
In the real-time operation process of the target network, the equipment resources are dynamically changed, so that the collectable equipment resources in the target network need to be dynamically updated. And the device resource after dynamic updating can provide real-time device resource data for relevant operation and maintenance personnel, thereby facilitating subsequent operation and maintenance, further reducing operation and maintenance cost and improving operation and maintenance efficiency.
The method for collecting the network equipment resources improves the collection efficiency of the network equipment resources by collecting the multithreaded resources of the target network and storing the collected equipment resources through the resource task list, simultaneously utilizes the master working node to carry out single-thread scanning on the resource task list, and uses the generated resource discovery message queue to control the slave working node to periodically collect the collectable equipment resources in the target network, thereby avoiding the technical problems of synchronous blocking, inconsistent data and the like.
According to the embodiment of the disclosure, the multithreading collection of the equipment resources in the target network comprises the steps of carrying out connectivity test on the target network, issuing equipment information to be collected and a predefined resource discovery formula to a distributed collector, and based on the equipment information to be collected and the predefined resource discovery formula, scanning the target network by the distributed collector, and carrying out multithreading collection on the equipment resources which can be collected in the target network to obtain an collectable equipment resource set.
The device information to be collected includes hardware information and device software information of the device, such as CPU information, hard disk information, and the like of the device. The collected equipment resources can be used for subsequent operation and maintenance personnel to manage the target network.
The predefined resource discovery formula may be, for example, setting importance weights of the above information according to types, positions, numbers, states, etc. of the device resources, and ranking the device resources with the scores higher than a threshold value by calculating scores of the device resources, and then listing the device resources with the scores higher than the threshold value on a list of the device resources to be acquired.
Before equipment resource acquisition, connectivity test is required, so that the network smoothness of the subsequent acquisition process is ensured, the acquisition efficiency is improved, and the data error rate is reduced.
According to the embodiment of the disclosure, the connectivity test on the target network comprises the steps of performing the connectivity test on the equipment in the target network and performing the connectivity test on the network protocol used in the scanning and collecting process.
Connectivity testing is the process of evaluating whether efficient communication can be performed between different devices in a target network. Such testing is critical to ensure stability and reliability of the network.
Those skilled in the art may employ appropriate network protocols depending on the actual regulatory requirements.
In the disclosed embodiment, the optional network protocol is the SNMP protocol. The SNMP connectivity test is an important network performance detection method, and is mainly used for detecting the connectivity and communication speed of an SNMP protocol between a host and SNMP AGENT. This test procedure may be performed on the basis of UDP messages, by sending and receiving messages to evaluate network performance. The implementation principle of SNMP test involves sending request message and calculating the time difference between receiving response message and sending request message, thus reflecting the connectivity and performance status of network SNMP protocol. The connectivity test for the SNMP protocol generally comprises the key steps of sending SNMP request messages, receiving response messages, calculating communication time and the like.
The connectivity test ensures the smoothness of the information transmission of the target network, and facilitates the rapid transfer of the acquired equipment resources to the working node.
According to the embodiment of the disclosure, the method for acquiring the device resource set based on the device information to be acquired and the predefined resource discovery formula comprises the steps of utilizing a distributed acquisition device to scan a target network and performing multi-thread acquisition on the device resource which can be acquired in the target network to obtain the device resource set which can be acquired, wherein the distributed acquisition device is used for sending a request based on an SNMP protocol to the target network so as to realize access to the target network; based on SNMP protocol, the distributed collector is utilized to scan the target network to determine the collectable equipment resources in the target network, and based on SNMP protocol, the distributed collector is utilized to perform multi-thread collection on the collectable equipment resources in the target network to obtain the collectable equipment resource set.
SNMP (Simple Network Management Protocol, SNMP: simple network management protocol) is a standard protocol specifically designed for managing network nodes (servers, workstations, HUBS, etc.) in an IP network, which is an application layer protocol.
SNMP enables network administrators to manage network performance, discover and solve network problems, and plan network growth, and the network management system learns of the network problems by SNMP receiving random messages.
The network protocol used can be set by the person skilled in the art according to the actual acquisition needs.
The distributed collector can carry out multi-thread equipment resource collection, so that the efficiency of resource collection can be greatly improved. The distributed collector can be arranged in a distributed system, and the distributed system is used for deploying different service modules in a plurality of different servers and providing services to the outside through remote call cooperative work. The distributed system can form a cluster, wherein the cluster refers to that the same application or service module is deployed in a plurality of different servers to form a cluster, and services are provided to the outside through load balancing equipment.
According to the embodiment of the disclosure, the method for creating the resource task table and classifying and storing the collectable equipment resource set received by the working node by utilizing the resource task table comprises the steps of classifying equipment resources in the collectable equipment resource set by utilizing the working node based on the object identifier, creating the resource task table for each type of equipment resource based on the classification result, storing the identifier of each type of equipment resource in the resource task table, creating a resource task sub-table, and storing message information returned in the creation process of the resource task table by utilizing the resource task sub-table.
The resource task table and the resource task sub-table can be created through a database. Databases have many advantages, and are suitable for mass data storage, especially in the case of a large number of device resources in the target network that can be acquired. The resource task list and the resource task sub-list based on the database can intensively store a large amount of data, and can conveniently organize, update, inquire and delete the data at the same time, thereby avoiding data dispersion and repetition. And the consistency and the integrity of the data are ensured by utilizing the consistency and the integrity of the data of the database. For example, primary keys (i.e., task identifiers), foreign keys, unique constraints, etc., may be defined to avoid data redundancy and inconsistencies. Since the database provides a strict security mechanism, including user authentication and rights management, it is ensured that only authorized users can access and manipulate the data. This can protect the security and privacy of the data. The database is provided with an efficient index structure, so that data can be quickly searched and queried. In addition, in terms of data backup and recovery, utilizing the database allows periodic data backup and provides a corresponding recovery mechanism to prevent data loss or corruption. This is an important means of ensuring data reliability and business continuity.
The resource task table (task table, the same applies below) provided by the present disclosure can be used not only for saving the collected device resources, but also for controlling the periodic resource collection process in real time.
The resource task sub-table (item table, the same shall apply hereinafter) can store message information for displaying whether the related equipment resource is successfully stored. The relevant operation and maintenance personnel can check whether the device resource is successfully saved or not by looking at the item table.
According to the embodiment of the disclosure, the resource task table comprises a task identifier, a device resource identifier, the number of currently received resources and the total number of resources, wherein the resource task sub-table comprises a task sub-table identifier, the task identifier of the resource task table and message information.
The resource task table and the resource task sub-table can be created by using a data table in a database, and are distinguished by a task identifier and a task sub-table identifier.
Wherein the device resource identifier is used as a unique identifier of the collected device for distinguishing from other devices. The total number of resources represents the total number of equipment resources acquired in a plurality of acquisition periods, and the currently received number of resources represents the equipment resources acquired in the current acquisition period.
The resource task list can realize the efficient control of the periodic resource acquisition process, and can form a cross reference with the resource task list together for verifying whether the related equipment resources are successfully stored or acquired.
The above-described attribute or information to be saved in the resource task table and the resource task sub-table are exemplary, and those skilled in the art may set other attribute information or information to be saved according to actual test requirements.
According to the embodiment of the disclosure, the single-thread scanning is performed on the resource task table by using the master working node, and the resource discovery message queue is issued to the slave working node under the condition that the scanning result meets the preset condition.
In the field of network equipment resource management, a deadlock problem can be caused by a plurality of distributed working nodes simultaneously reading certain information or information tables. Therefore, the related resources need to be locked, and only one working node is allowed to read and write related information or information tables at the same time. The system comprises a data base, a data management system and a data management system, wherein the locks are classified into pessimistic locks and optimistic locks, all data conflicts are prevented based on a pessimistic attitude class, the data is locked before being modified by a preventive attitude, then the data is read and written, no one can operate the data until the data is released by the pessimistic locks, the data can be operated until the next personal data is locked after the lock is released by the previous person, the data can be operated, the mechanism of the data base is generally realized based on the pessimistic locks, the optimistic locks maintain an optimistic attitude for the data conflicts, the operated data cannot be locked (a plurality of tasks can operate the data in parallel), and whether the conflicts exist in the data is verified by a mechanism only when the data is submitted (the data is generally realized by a version number adding and then version number comparing mode).
The method and the device can realize single-thread control by utilizing the resource discovery message queue, thereby avoiding the problems of deadlock and the like caused by the fact that a plurality of distributed slave working nodes occupy resources and simultaneously read the resource task list.
According to the embodiment of the disclosure, the periodic resource acquisition of the target network from the working node is controlled by utilizing the resource discovery message queue based on the preset resource threshold and the acquisition interval, wherein the periodic resource acquisition of the target network from the working node comprises the steps of screening target equipment resources which meet the preset resource threshold from an acquirable equipment resource set, determining a scanning period based on the acquisition interval, utilizing the resource discovery message queue to control a plurality of distributed slave working nodes to acquire the resource discovery message in a distributed lock mode, and controlling an acquirer to acquire the periodic resource of the target equipment resources from the working node based on the scanning period under the condition that the resource discovery message is acquired.
For example, in the periodic equipment resource collection process, a user (such as an operation and maintenance personnel) can set in a collection interval to collect the temperature resource of the CPU, when the temperature of the CPU exceeds a specified threshold value in a certain collection period, alarm information is sent to the operation and maintenance personnel, and then the operation and maintenance personnel can timely find and process the information.
The periodic resource acquisition can ensure that operation and maintenance personnel monitor the state of related equipment resources in real time and timely process the equipment resources in abnormal states (namely, exceeding a preset resource threshold).
The method for collecting the network equipment resources provided by the invention is further described in detail through specific implementation and attached drawings.
Fig. 3 schematically illustrates a flow chart in a multiple instance scenario, according to an embodiment of the disclosure.
As shown in fig. 3, in the case of processing multiple instances, the prior art solution queries the database simultaneously, resulting in the same state being queried, resulting in data duplication and data inconsistency. In distributed systems, however, CPA principle constraints, i.e., consistency (consistency), availability, partition tolerance (partition fault tolerance), are often faced, and the three cannot be combined.
Wherein, consistency (C) is whether all data in the distributed system are backed up and have the same value at the same time. (equivalent to all nodes accessing the same copy of the latest data), wherein the availability (A) ensures that each request responds regardless of success or failure, and wherein the partition fault tolerance (P) is that the loss or failure of any information in the system does not affect the continued operation of the system.
The above-mentioned consistency is classified into strong consistency, weak consistency, and final consistency.
Wherein strong consistency is that after the update operation is completed, any subsequent process or thread accesses return the latest updated value until this data is updated by other data. However, this implementation has a large impact on performance, since it means that the user cannot read the data as long as the last operation has not been completed.
Wherein, the system does not guarantee that the access of the process or the thread returns the latest updated value. The system does not promise to read the latest written value immediately after the data is written successfully, nor does it specify how long after the promise. Even without ensuring access.
The final consistency is also a kind of weak consistency, and it cannot guarantee that after data is updated, all subsequent accesses can see the latest value, but a time is needed, after which this point can be guaranteed (that is, after a period of time, the data between nodes can finally reach a consistent state), during which the data may be inconsistent, and a time segment where the system cannot guarantee strong consistency is called an "inconsistent window". The length of the non-uniform window depends on many factors, such as the number of backup data, the network transmission delay speed, the system load, etc.
The availability refers to the corresponding time that the service is always available and normal. The good availability mainly means that the system can serve the user well, and the situation that the user experience is poor, such as user operation failure or access timeout, does not occur.
The above-mentioned partition fault tolerance means that when a distributed system encounters a network fault, it can still provide services satisfying consistency and availability to the outside unless the entire network environment fails.
Fig. 4 schematically illustrates a multi-instance or single-instance data processing flow according to an embodiment of the present disclosure.
As shown in fig. 4, the multiple/single instance process utilizes database table locks. The task table (i.e. the resource task table) is ensured to be inserted and updated, the task table is queued for execution, the count (the current resource number) is equal to total (total resource tree), and the subsequent business flow is triggered. Firstly, a table is locked, the count number is updated, an atom+1 operation is performed, the table lock is unlocked, the count number is queried, if the count is equal to the total, a subsequent operation is performed, a task is created, and a threshold value and an acquisition interval are set.
Fig. 5 is a diagram schematically illustrating a network device resource discovery process according to an embodiment of the present disclosure.
As shown in FIG. 5, the present disclosure firstly receives the message in a multithreading way, updates the current state to 1 after saving the equipment resource, and secondly scans the state in a single thread way, reaches the state threshold point, and changes the current state to 2 after updating. And then, the slave node receives the queue task sent by the master node, ensures that only one slave node preempts the task and updates to the state 3. After the following tasks are performed, the status is updated to 4. And finally, when the process encounters a condition that a plurality of slave nodes are required to ensure that only one node is processed, repeating the single-thread scanning operation and the task preemption operation.
Taking a wireless access point (Access Point Cluster, AP Cluster) in a distributed system as an example, the above network device resource discovery and acquisition method provided in the present disclosure is further described in detail with reference to fig. 6.
Fig. 6 schematically illustrates a flowchart of discovery and acquisition of network device resources by an AP cluster according to an embodiment of the present disclosure.
Firstly, a target network where a distributed system is located performs connectivity tests, such as device nano-tubes, device connectivity tests, SNMP protocol connectivity tests and the like, under the condition that the connectivity tests have no problem, equipment information and discovery formulas are issued, secondly, as shown in fig. 6, a collector in an AP cluster sends a SNMP request, a collectable resource element oid (object identity) in the target network is returned, an AP or a distributed working node receives the collected equipment resource information and stores/updates a resource task table, and simultaneously stores a return Message to a resource task sub-table, a master node scans the resource task table, under the condition that count=total is reached, issues resource discovery information (Message Queue, MQ), a working node receives a Message, creates a resource record to the resource table, creates a task to the task table, updates threshold information and collection interval information in the task table, and issues the resource record to a corresponding collector, and the collector generates a periodic task. The resource task table and the resource task sub-table can be set by a person skilled in the art according to actual management requirements. The collector accesses the collected equipment and returns the collected resource set through the snmp protocol. The collector sends the information to the work node, the work node collects each type of resource set, the resource set is stored in the task table, and the returned message information is stored in the item sub-table. And the Master node scans and meets the condition task, issues the work node and continues to do the subsequent business flow.
As can be seen from fig. 6, the method for collecting network equipment resources provided by the present disclosure eliminates the database for update operation, so as to fundamentally eliminate the database waiting problem and avoid the database deadlock condition. Meanwhile, in the multi-instance disclosed by the invention, the master node polls and accesses the database, takes out the record that the 'state' reaches the next operation, and sends the record to the work working node, so that the business process after the completion is finished, the consistency of data is ensured, and the data redundancy is reduced.
Fig. 7 schematically illustrates a structural diagram of a network device resource acquisition apparatus according to an embodiment of the present disclosure.
As shown in fig. 7, the above-mentioned network device resource acquisition apparatus 700 includes a multithreading acquisition module 710, a task table creation module 720, a single-threaded scanning module 730, a periodic resource acquisition module 740, and a task table dynamic update module 750.
The multithreading collection module 710 is configured to perform multithreading collection on device resources in the target network and send a set of device resources that can be collected in the target network to the working node, and in an embodiment, the multithreading collection module 710 may be configured to perform the operation S210 described above, which is not described herein.
In embodiments of the present disclosure, the multithreaded collection module 710 may provide a corresponding operation portal for the target network manager to choose to agree or reject the automated decision result. That is, before the device resource is collected, an instruction to perform the collection may be obtained that the target network manager inputs approval or rejection through the corresponding operation portal. And if the target network manager agrees to acquire, acquiring the equipment resources. If the target network manager refuses to collect, the expert decision flow is entered.
The task table creating module 720 is configured to create a resource task table and store the collectable device resource set received by the working node by using the resource task table in a classified manner, and in an embodiment, the task table creating module 720 may be configured to execute the operation S220 described above, which is not described herein.
The single-thread scanning module 730 is configured to perform single-thread scanning on the resource task table by using the master working node, and issue the resource discovery message queue to the slave working node if the scanning result meets the preset condition, and in an embodiment, the single-thread scanning module 730 may be configured to perform the operation S230 described above, which is not described herein again.
The periodic resource acquisition module 740 is configured to control, based on a preset resource threshold and an acquisition interval, periodic resource acquisition of the target network from the working node by using the resource discovery message queue, and in an embodiment, the periodic resource acquisition module 740 may be configured to perform the operation S240 described above, which is not described herein.
The task table dynamic update module 750 is configured to dynamically update the resource task table with the collectable device resource set obtained from the periodic scan of the working node. In an embodiment, the task table dynamic update module 750 may be used to perform the operation S250 described above, which is not described herein.
Any of the multiple modules of the multithreaded acquisition module 710, the task table creation module 720, the single-threaded scanning module 730, the periodic resource acquisition module 740, and the task table dynamic update module 750 may be combined in one module or any of the modules may be split into multiple modules according to embodiments of the present disclosure. Or at least some of the functionality of one or more of the modules may be combined with, and implemented in, at least some of the functionality of other modules. According to embodiments of the present disclosure, at least one of the multithreading collection module 710, the task table creation module 720, the single-threaded scanning module 730, the periodic resource collection module 740, and the task table dynamic update module 750 may be implemented, at least in part, as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or as hardware or firmware in any other reasonable manner of integrating or packaging circuitry, or as any one of, or a suitable combination of any of, software, hardware, and firmware. Or at least one of the multithreading collection module 710, the task table creation module 720, the single threaded scanning module 730, the periodic resource collection module 740, and the task table dynamic update module 750 may be implemented at least in part as computer program modules that, when executed, perform the corresponding functions.
The multithreaded acquisition module 710 described above includes a connectivity test sub-module and a scan and acquisition sub-module, according to embodiments of the present disclosure.
And the connectivity test sub-module is used for performing connectivity test on the target network and issuing the equipment information to be acquired and a predefined resource discovery formula to the distributed acquisition device.
The scanning and acquisition sub-module is used for scanning the target network by using the distributed acquisition device based on the equipment information to be acquired and a predefined resource discovery formula, and performing multi-thread acquisition on the equipment resources which can be acquired in the target network to obtain an equipment resource set which can be acquired.
According to an embodiment of the present disclosure, the connectivity test submodule includes a network and a protocol test unit.
The network and protocol testing unit is used for carrying out connectivity test on equipment in the target network and carrying out connectivity test on network protocols used in the scanning and collecting processes.
According to an embodiment of the present disclosure, the scanning and collecting submodule includes an access unit, a scanning unit and a collecting unit.
And the access unit is used for sending a request based on the SNMP protocol to the target network by using the distributed collector so as to realize the access to the target network.
And the scanning unit is used for scanning the target network by using the distributed collector based on the SNMP protocol so as to determine the equipment resources which can be collected in the target network.
The acquisition unit is used for performing multithread acquisition on the equipment resources which can be acquired in the target network by utilizing the distributed acquisition unit based on the SNMP protocol to obtain an acquired equipment resource set.
According to an embodiment of the present disclosure, the task table creation module 720 includes a classification sub-module, a save sub-module, and a sub-table creation sub-module.
And the classification sub-module is used for classifying the equipment resources in the collectable equipment resource set by using the working node based on the object identifier.
And the storage sub-module is used for creating a resource task table for each type of equipment resource based on the classification result and storing the identifier of each type of equipment resource in the resource task table.
The sub-table creation sub-module is used for creating a resource task sub-table, and the resource task sub-table is utilized to store the message information returned in the resource task table creation process.
The single-threaded scan module 730 includes a discrimination sub-module according to an embodiment of the present disclosure.
And the judging sub-module is used for carrying out single-thread scanning on the currently received resource number and the total number of resources in the resource task list by utilizing the master working node, and issuing the resource discovery message queue to the slave working node under the condition that the currently received resource number and the total number of resources are equal.
According to an embodiment of the present disclosure, the periodic resource acquisition module 740 includes a screening and determination sub-module, a resource acquisition sub-module, and a periodic acquisition sub-module.
And the screening and determining submodule is used for screening target equipment resources which meet a preset resource threshold from the collectable equipment resource set and determining a scanning period based on the collection interval.
And the resource acquisition sub-module is used for controlling a plurality of distributed slave working nodes to acquire the resource discovery messages in a distributed lock mode by utilizing the resource discovery message queue.
And the periodic acquisition sub-module is used for periodically acquiring the resources of the target equipment through the slave working node control acquirer based on the scanning period under the condition that the resource discovery message is acquired.
Fig. 8 schematically illustrates a block diagram of an electronic device adapted to implement a method of collecting network device resources according to an embodiment of the disclosure.
As shown in fig. 8, an electronic device 800 according to an embodiment of the present disclosure includes a processor 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. The processor 801 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. The processor 801 may also include on-board memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the disclosure.
In the RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. The processor 801 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 802 and/or the RAM 803. Note that the program may be stored in one or more memories other than the ROM 802 and the RAM 803. The processor 801 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the electronic device 800 may also include an input/output (I/O) interface 805, the input/output (I/O) interface 805 also being connected to the bus 804. The electronic device 800 may also include one or more of an input portion 806 including a keyboard, a mouse, etc., an output portion 807 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), etc., and a speaker, etc., a storage portion 808 including a hard disk, etc., and a communication portion 809 including a network interface card such as a LAN card, a modem, etc., connected to an input/output (I/O) interface 805. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to an input/output (I/O) interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
The present disclosure also provides a computer-readable storage medium that may be included in the apparatus/device/system described in the above embodiments, or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 802 and/or RAM 803 and/or one or more memories other than ROM 802 and RAM 803 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. The program code, when executed in a computer system, causes the computer system to implement the method for collecting network device resources provided by embodiments of the present disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 801. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed, and downloaded and installed in the form of a signal on a network medium, and/or from a removable medium 811 via a communication portion 809. The computer program may comprise program code that is transmitted using any appropriate network medium, including but not limited to wireless, wireline, etc., or any suitable combination of the preceding.
In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 801. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure may be combined and/or combined in various combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, features recited in various embodiments of the present disclosure may be combined and/or combined in various ways without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. These examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.