CN116319627A - Data acquisition method and device, storage medium and electronic device - Google Patents

Data acquisition method and device, storage medium and electronic device Download PDF

Info

Publication number
CN116319627A
CN116319627A CN202310264836.1A CN202310264836A CN116319627A CN 116319627 A CN116319627 A CN 116319627A CN 202310264836 A CN202310264836 A CN 202310264836A CN 116319627 A CN116319627 A CN 116319627A
Authority
CN
China
Prior art keywords
target
data
time
request
data set
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310264836.1A
Other languages
Chinese (zh)
Inventor
宗栋瑞
郭巍松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202310264836.1A priority Critical patent/CN116319627A/en
Publication of CN116319627A publication Critical patent/CN116319627A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9005Buffering arrangements using dynamic buffer space allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a data acquisition method and device, a storage medium and an electronic device, wherein the data acquisition method comprises the following steps: acquiring a first request parameter according to each request time in a target time queue under the condition that the time length of data of a target data set in a target switch which is not requested to be acquired is greater than or equal to a first threshold value, wherein the request time is the time of requesting the target switch to acquire the data of the target data set, and the first request parameter is used for indicating the frequency of requesting the target switch to acquire the data of the target data set; and under the condition that the first request parameter and the preset reference request parameter meet the preset target matching condition, caching the data of the target data set in the target switch. Through the embodiment of the application, the problem that the storage space occupied by the data in the switch is more is solved, and the effect of reducing the storage space occupied by the data in the switch is achieved.

Description

Data acquisition method and device, storage medium and electronic device
Technical Field
The embodiment of the application relates to the field of switches, in particular to a data acquisition method and device, a storage medium and an electronic device.
Background
In the prior art, when data of an exchanger are acquired, corresponding data are often acquired from the exchanger under the condition that a data acquisition request is received; or the data is collected in advance in the switch and is cached in the switch, when a data collection request is received, the data is directly read from the cached data, the reading efficiency of the first mode is low, more storage space in the switch is required to be occupied in the second mode, some data can not be frequently required to be obtained, the storage space of the switch is less, and the normal function of the switch can be influenced due to the fact that the stored data is more.
Aiming at the technical problem that the storage space occupied by data in a switch in the related art is more, no effective solution is proposed yet.
Disclosure of Invention
The embodiment of the application provides a data acquisition method and device, a storage medium and an electronic device, which are used for at least solving the problem that more storage space is occupied by data in a switch in the related technology.
According to one embodiment of the present application, there is provided a data acquisition method including: acquiring a first request parameter according to each request time in a target time queue when the time length of data of a target data set in a target switch is not required to be acquired is greater than or equal to a first threshold value, wherein the request time is the time of requesting the target switch to acquire the data of the target data set, and the first request parameter is used for indicating the frequency of requesting the target switch to acquire the data of the target data set; and under the condition that the first request parameter and the preset reference request parameter meet the preset target matching condition, caching the data of the target data set in the target switch.
In an exemplary embodiment, the obtaining the first request parameter according to each request time in the target time queue includes: obtaining time intervals between a first request time and a second request time which are adjacent in time in the target time queue to obtain a group of time intervals, wherein the request time in the target time queue is arranged according to the time sequence of requesting the target switch to obtain the data of the target data set, and the first request time is earlier than the second request time; and acquiring the first request parameter according to the group of time intervals.
In an exemplary embodiment, the obtaining the first request parameter according to the set of time intervals includes: and according to each time interval in the group of time intervals, acquiring the average difference of each time interval as the first request parameter.
In an exemplary embodiment, before the obtaining the first request parameter according to each request time in the target time queue, the method further includes: acquiring a first difference value between a current detection time and the last request time in the target time queue, wherein the last request time is ordered according to time, the current detection time is the time for detecting whether the data of the target data set is determined to be cached in the target switch, and the current detection time is later than the last request time; and determining that the duration of the data of the target data set, which is not requested to be acquired, is greater than or equal to the first threshold value under the condition that the first difference value is greater than or equal to the first threshold value.
In an exemplary embodiment, said caching data of said target data set in said target switch comprises: invoking a set of objective functions corresponding to the objective data set, wherein each data of the objective data set has a corresponding function, and each function in the set of objective functions is used for collecting a plurality of data of the objective data set in the objective switch; and caching the calling result of each function in the group of target functions in the target switch.
In an exemplary embodiment, after said caching of the data of the target data set in the target switch, the method further comprises: acquiring a target data request at a target request time, wherein the target data request is used for requesting the target switch to acquire target data, and the target data request carries a data identifier of the target data; responding to the target data request, and determining a data set to which data corresponding to the data identifier of the target data belongs as the target data set; and acquiring the target data from the data of the target data set cached in the target switch.
In an exemplary embodiment, after the target data is acquired from the data of the target data set cached in the target switch, the method further includes: and recording the target request time in the target time queue according to the time sequence of requesting the target switch to acquire the data of the target data set, wherein the last request time in the target time queue is the target request time.
According to another embodiment of the present application, there is provided a data acquisition apparatus including: a first obtaining module, configured to obtain a first request parameter according to each request time in a target time queue when a duration of data of a target data set in a target switch that is not requested to be obtained is greater than or equal to a first threshold, where the request time is a time when the target switch is requested to obtain the data of the target data set, and the first request parameter is used to indicate a frequency of requesting the target switch to obtain the data of the target data set; and the caching module is used for caching the data of the target data set in the target switch under the condition that the first request parameter and the preset reference request parameter meet the preset target matching condition.
According to a further embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
According to a further embodiment of the present application, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to the embodiment of the application, under the condition that the data in the data set in the switch is not requested to be acquired for a long time, whether the data in the data set is to be cached in the switch can be determined according to the historical time of requesting the switch to acquire the data in the data set.
Drawings
Fig. 1 is a hardware block diagram of a mobile terminal according to a data acquisition method in an embodiment of the present application;
FIG. 2 is a flow chart of a method of acquiring data according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a method of acquiring data according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a data acquisition process according to an embodiment of the present application;
fig. 5 is a block diagram of a data acquisition apparatus according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and the claims of the embodiments of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of the mobile terminal according to an embodiment of the present application. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a data acquisition method in the embodiment of the present application, and the processor 102 executes the computer program stored in the memory 104, thereby performing various functional applications and data processing, that is, implementing the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
Nouns involved in the embodiments of the present application are explained as follows:
SONiC (Software for Open Networking in the Cloud): SONiC and SAI (Switch Abstraction Interface) associated therewith are two open source projects in the open cloud network area that have been dominant in recent years by Microsoft (Microsoft). The traditional network equipment can not meet the requirements of a cloud computing age cloud management platform on an open interface, software definition, modularized construction, rapid iteration and the like of a network due to the sealing, black box and locking of the traditional network equipment, microsoft dominance establishes a SONIC/SAI open source project, and aims to reconstruct open network system software based on a standard Linux kernel aiming at the requirements of Azure on the network. In order to comply with the historical trend of cloud computing, software definition and open source, microsoft does not make this system closed, private, but operates in an open, open source, community mode.
SNMP (Simple Network Management Protocol ): network devices are of a wide variety, and management interfaces (e.g., command line interfaces) provided by different device manufacturers are different, which makes network management more complex. To solve this problem, SNMP has been developed. SNMP provides a unified interface as a network management standard protocol widely used in TCP (Transmission Control Protocol )/IP (Internet Protocol, internet protocol) networks, thereby achieving unified management between heterogeneous and vendor network devices. SNMP is a standard protocol specifically designed for managing network nodes (servers, workstations, routers, switches) 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. The network management system knows that the network has problems by receiving random messages (and event reports) through SNMP.
MIB (Management Information Base) in SNMP: MIB in SNMP is a tree-like database, and objects managed by MIB are end nodes of a tree, each node having a unique location and a unique name. The IETF specifies that the management information base object identifier (OID, object Identifier) is uniquely specified, with the naming convention that the name of the parent node is prefixed to the name of the child node.
SNMP Agent: the SNMP Agent is an Agent process in the managed device for maintaining information data of the managed device and reporting the management data to the NMS that sent the request in response to the request from NMS (Network Management System).
In this embodiment, a method for acquiring data running on the mobile terminal is provided, and fig. 2 is a flowchart of a method for acquiring data according to an embodiment of the present application, as shown in fig. 2, where the flowchart includes the following steps:
step S202, acquiring a first request parameter according to each request time in a target time queue when the duration of data of a target data set in a target switch is not required to be acquired is greater than or equal to a first threshold, wherein the request time is the time of requesting the target switch to acquire the data of the target data set, and the first request parameter is used for indicating the frequency of requesting the target switch to acquire the data of the target data set;
Step S204, in the case that the first request parameter and the preset reference request parameter meet a preset target matching condition, caching data of the target data set in the target switch.
Fig. 3 is a schematic diagram of a data acquisition method according to an embodiment of the present application, as shown in fig. 3, a storage space 202-1 in a target switch 202 is cached with a time queue 1 (t 1, t2, t3, t 4) corresponding to the data set 1, a time queue 2 (t 5, t6, t7, t 8) corresponding to the data set 2 and a time queue 3 (t 10, t11, t12, t 13) corresponding to the data set 3 and the data set 3. The process of acquiring data in the embodiment of the present application may be explained by using the data set 3 as the target data set, but may be applied to the embodiment of the present application by not being limited thereto.
In the case where the duration of data acquisition of the data set 3 (i.e., the target data set) in the target switch 202 is not requested to be acquired is greater than or equal to the first threshold, according to each request time (t 10, t11, t12, t 13) in the time queue 3 (i.e., the target time queue), acquiring a first request parameter, and in the case where the first request parameter meets a preset target matching condition with a preset reference request parameter, caching the data of the data set 3 in the storage space 202-1 of the target switch 202.
By the steps, under the condition that the data in the data set in the switch is not requested to be acquired for a long time, whether the data in the data set is to be cached in the switch can be determined according to the historical time of requesting the switch to acquire the data in the data set.
The main execution body of the above steps may be a terminal, but is not limited thereto.
The execution order of step S202 and step S204 may be interchanged, i.e. step S204 may be executed first and then step S202 may be executed.
In the technical solution provided in step S202, the target switch may include, but is not limited to include, a plurality of data sets, and the data in the target switch may be divided into a plurality of data sets according to the type of the data, or the data with higher correlation, for example: divided into CPU-related data sets, memory-related data sets, and the like.
Alternatively, in this embodiment, in a case where the length of time that the data of the target data set in the target switch is not requested to be acquired is greater than or equal to the first threshold value, it may be indicated that the data in the target data set has not been requested to be acquired for a longer time, and in such a case, a first request parameter indicating the frequency of requesting the target switch to acquire the data in the target data set may be acquired, thereby determining whether or not to cache the data in the target data set in the target switch.
Optionally, in this embodiment, each data set in the target switch has a corresponding time queue for recording a time when the target switch requests to acquire data in the data set, where the time queue may be, but is not limited to, a FIFO (first in first out, first-in-first-out) queue, and the time queue may be, but is not limited to, 10, or 8, or 20, or the like, and the time queue can record at most a request time.
In one exemplary embodiment, the first request parameter may be obtained from each request time in the target time queue, but is not limited to, by: obtaining time intervals between a first request time and a second request time which are adjacent in time in the target time queue to obtain a group of time intervals, wherein the request time in the target time queue is arranged according to the time sequence of requesting the target switch to obtain the data of the target data set, and the first request time is earlier than the second request time; and acquiring the first request parameter according to the group of time intervals.
Alternatively, in this embodiment, the time interval between the first request time and the second request time that are adjacent in time in the target time queue may be acquired, for example: for the time queues 3 (t 10, t11, t12, t 13) of the data set 3, the time queues 3 may be, but are not limited to, FIFO (first in first out, first-in first-out) queues, that is, t10 is earlier than t11, t11 is earlier than t12, t12 is earlier than t13, and t13 is the last request time recorded in the time queues 3. In such a case, a set of time intervals may be obtained, but is not limited to, the difference of t11 minus t10, the difference of t12 minus t11, and the difference of t13 minus t 12.
In one exemplary embodiment, the first request parameter may be obtained from the set of time intervals by, but not limited to: and according to each time interval in the group of time intervals, acquiring the average difference of each time interval as the first request parameter.
Alternatively, in the present embodiment, the average difference between the time intervals may be acquired as the first request parameter, but is not limited to, in which case the frequency of requesting the target switch to acquire the data in the target data set may be represented by requesting the target switch to acquire the average difference between the time intervals of the data in the target data set.
Alternatively, in this embodiment, the average difference of the time intervals may be, but is not limited to, inversely proportional to the frequency of requesting the target switch to acquire the data in the target data set, that is, the greater the average difference between the intervals of the request time in the target time queue, the lower the frequency of requesting the target switch to acquire the data of the target data set, that is, the data in the target data set is not frequently requested to be acquired.
Alternatively, in this embodiment, it may be determined, but not limited to, that the first request parameter and the preset reference request parameter meet the preset target matching condition when the average difference of the respective time intervals is less than or equal to the second threshold (such as 30, or 20, or 10, etc., which is not limited in the present application).
In one exemplary embodiment, it may be determined, but is not limited to, whether data of a target data set in a target switch is frequently requested to be acquired by: acquiring a first difference value between a current detection time and the last request time in the target time queue, wherein the last request time is ordered according to time, the current detection time is the time for detecting whether the data of the target data set is determined to be cached in the target switch, and the current detection time is later than the last request time; and determining that the duration of the data of the target data set, which is not requested to be acquired, is greater than or equal to the first threshold value under the condition that the first difference value is greater than or equal to the first threshold value.
Alternatively, in this embodiment, in the case where the first difference is greater than or equal to the first threshold, it is determined that the duration in which the data of the target data set is not requested to be acquired is greater than or equal to the first threshold, and in this case, it may be indicated that the data in the target data set in the target switch has not been requested to be acquired for a longer time. In the case where the first difference is smaller than the first threshold, it is determined that the duration of time that the data of the target data set is not requested to be acquired is smaller than the first threshold, and in such a case, it may be indicated that the data in the target data set in the target switch is still frequently requested to be acquired.
Alternatively, in this embodiment, the above-mentioned data set 3 may be taken as a target data set, and the time queue 3 corresponding to the data set 3 is taken as a target time queue as an example, and the process of determining whether the data of the target data set in the target switch is frequently requested to be acquired in the embodiment of the present application may be explained and illustrated, which is not limited to be applicable to the embodiment of the present application.
The time queue 3 (t 10, t11, t12, t 13) of the data set 3, the time queue 3 may be, but is not limited to, a FIFO (first in first out, first-in first-out) queue, t10 is earlier than t11, t11 is earlier than t12, t12 is earlier than t13, t13 is the last request time recorded in the time queue 3, and in the case that the difference (i.e., the first difference) between the current detection time and t13 is greater than or equal to a first threshold (may be, but is not limited to, 600s, or 700s, or 500s, etc.), it is determined that the duration of the data set 3 that is not requested to be acquired is greater than or equal to the first threshold.
In case the difference between the current detection time and t13, i.e. the first difference, is smaller than a first threshold value (which may be, but not limited to, 600s, or 700s, or 500s, etc., without being limited in this application), it is determined that the duration of the data set 3 not being requested to be acquired is smaller than the first threshold value.
In the technical solution provided in step S204, in the case that the first request parameter and the preset reference request parameter meet the preset target matching condition, it may indicate that the data of the target data set in the target switch is frequently requested to be acquired, in this case, but not limited to, the data of the target data set may be cached in the target switch in advance, so that in the case that the data of the target data set is requested to be acquired, the required data may be directly read from the cached data of the target data set, thereby improving the data acquisition efficiency.
Optionally, in this embodiment, by pre-caching the data of the data sets that are frequently requested to be acquired in the target switch, on one hand, caching the data of all the data sets (for example, data of some data sets that are frequently not accessed or even not accessed) in the target switch is avoided, and in this way, the utilization rate of the storage space in the target switch is improved. On the other hand, the data of the data set which is frequently requested to be acquired is cached in the target switch in advance, so that the data which is frequently requested to be acquired can be ensured to be frequently updated, and the updating efficiency of the data is improved.
In one exemplary embodiment, the data of the target data set may be, but is not limited to, cached in the target switch by: invoking a set of objective functions corresponding to the objective data set, wherein each data of the objective data set has a corresponding function, and each function in the set of objective functions is used for collecting a plurality of data of the objective data set in the objective switch; and caching the calling result of each function in the group of target functions in the target switch.
Optionally, in this embodiment, each data of the target data set may, but is not limited to, have different acquisition manners, and may, but is not limited to, implement acquisition of each data in the target data set by calling a set of update functions corresponding to the target data set, where each data of the target data set has a corresponding update function; the results of the call to each update function in the set of updates may be, but are not limited to, cached in the target switch.
In one exemplary embodiment, the data of the target data set may be acquired, but is not limited to, by: acquiring a target data request at a target request time, wherein the target data request is used for requesting the target switch to acquire target data, and the target data request carries a data identifier of the target data; responding to the target data request, and determining a data set to which data corresponding to the data identifier of the target data belongs as the target data set; and acquiring the target data from the data of the target data set cached in the target switch.
Optionally, in this embodiment, in the case that the target data request is acquired at the target request time, it may indicate that it is desired to request the target data from the target switch, and in such a case, it may be, but is not limited to, in response to the target data request, determine, as the target data set, a data set to which data corresponding to the data identifier of the target data belongs, and acquire the target data from the data of the target data set cached in the target switch. By the method, target data which is expected to be acquired are directly read from the data of the target data set cached in the target switch, the situation that the data which is expected to be acquired are acquired in real time under the condition that the target data request is acquired is avoided, and the data acquisition efficiency is greatly improved.
In one exemplary embodiment, the time at which the target request was obtained may be, but is not limited to, recorded in a target time queue by: and recording the target request time in the target time queue according to the time sequence of requesting the target switch to acquire the data of the target data set, wherein the last request time in the target time queue is the target request time.
Alternatively, in this embodiment, the target time queue may be, but not limited to, a FIFO (first in first out, first-in first-out) queue, and the target request time may be, but not limited to, recorded in the target time queue according to the chronological order of the requests to the target switch for the data of the target data set. So that a request parameter indicating a frequency of requesting the target switch to acquire the data of the target data set can be acquired in a case where it is required to determine whether or not to cache the data of the target data set in the target switch next time according to the respective request times recorded in the target time queue.
In order to better understand the above process of reading the data in the target switch cache and recording the time of obtaining the request, the method for obtaining the data in the embodiment of the present application is explained and illustrated below with reference to an alternative embodiment, which may be, but not limited to, applied to the embodiment of the present application.
Fig. 4 is a schematic diagram of a data acquisition process according to an embodiment of the present application, as shown in fig. 4, in which data of a plurality of data sets and a time queue corresponding to each data set are stored in a storage space 202-1 of a target switch 202, it may be explained and illustrated by taking a data set 3 as a target data set and a time queue 3 corresponding to the data set 3 as a target time queue, for example.
The time queue 3 originally records (t 10, t11, t12, t 13), t10 is earlier than t11, t11 is earlier than t12, t12 is earlier than t13, and the target switch 202 acquires a target data request at a target request time t14, where the target data request is used for requesting the target switch 202 to acquire data 3 (i.e., target data), and the target data request carries a data identifier of the data 3; in such a case, the switch may determine, in response to the target data request, a data set 3 to which the data corresponding to the data identifier of the data 3 belongs as a target data set; the data 3 is acquired from the data of the data set 3 cached in the storage space 202-1 of the target switch 202, the acquired data 3 is returned, and the target request time t14 is recorded in the time queue 3 according to the time sequence of requesting the target switch 202 to acquire the data of the data set 3, wherein the last request time in the time queue 3 is the target request time t14.
In order to better understand the above process of reading the data in the cache of the target switch and recording the time of acquiring the request, the target switch may be, but is not limited to, a target switch running with the SONiC (Software for Open Networking in the Cloud) system, the target switch is managed through SNMP protocol, the target switch needs to be accessed after a period of time, the target switch is periodically requested to acquire the data for management, the NMS requests the target switch to acquire the data, the SNMP Agent responds to the request of the NMS and returns the data requested by the NMS to explain and explain the method of acquiring the data in the embodiments of the present application, which may be, but is not limited to, applied to the embodiments of the present application. The method for acquiring data in the embodiment of the present application may be implemented, but is not limited to, by the following steps:
Step 1: a mix_base class includes an update function, a length 10 timestamp FIFO queue, a flag start_update, default to False, which indicates that no data is collected.
Step 2: creating a class for each MIB, inheriting the class in step 1, that is, after inheriting the class in step 1, each class created in step 2 has the same flag bit (default is False) as the mib_base class generated in step 1, the same length of time stamp FIFO queue and update function, and realizes the update function according to the requirement of the MIB, and updates the data required by the MIB when the update function is called.
It should be noted that, a mib corresponds to a data set (e.g., a memory-related data set, a CPU-related data set, etc.), each mib has a mib instance object, each mib instance object corresponds to a FIFO time queue (the queue is used to record a time for requesting to obtain data corresponding to the instance object from the switch), and each mib instance object corresponds to a manner of collecting all data in the data set.
Step 3: a set of tab instances is used to store all tab instance objects.
Step 4: a factory, according to the OID of MIB, using class in step 2 to produce a correspondent instance object for all MIBs, and adding it into the collection of step 3.
Step 5: a data updating thread traverses the set of the step 3, creates a thread for each instance MIB object, periodically checks the start_update flag bit, calls an update function under the condition that the start_update flag bit is True, and collects the data of the data set in the switch; in the case where the start_update flag bit is False, the MIB instance is skipped.
Step 6: in the case that the SNMP agent in the switch (i.e., the target switch) receives the get or get_next request (i.e., the target data request described above), the collection in step 3 is traversed, the corresponding MIB instance object (i.e., the target data collection described above) is found according to the OID (i.e., the data identifier of the target data described above), and the time when the get or get_next request is received is added to the timestamp queue (i.e., the target time queue described above).
Step 7: a thread traverses the set of step 3 to periodically check the time stamp queue in the MIB instance object, if the difference between the last time request time in the time stamp queue and the current detection time is more than 600 seconds (namely the first threshold value), the time stamp postamble in the queue is subtracted from the antecedent (namely the time interval between the first request time and the second request time which are adjacent in time) to obtain all time intervals (namely a group of time intervals), then the average difference is calculated, if the average difference is not more than 30, the MIB instance object is considered to have periodic access, and the start_update flag bit is set as True; otherwise set to False. If the difference between the last request time in the timestamp queue and the current detection time is less than 600 seconds, the MIB instance object may be indicated to have periodic access, and the start_update flag bit is set to True.
Through the above embodiment, if one MIB instance object has no get or get_next request for a period of time, the operation of updating the data of the MIB instance object in the switch is stopped, thereby saving system resources of the switch. In addition, the data of the data set in the switch is updated based on the MIBs, a thread is created for each MIB, when a user uses SNMP to manage equipment, some MIBs are usually accessed in a targeted and periodic mode, other MIBs are not concerned, and fine-grained allocation of switch resources is realized based on the MIB updated data.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or portions contributing to the prior art may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the embodiments of the present application.
The embodiment also provides a device for acquiring data, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 5 is a block diagram of a data acquisition device according to an embodiment of the present application, as shown in fig. 5, the device includes:
a first obtaining module 502, configured to obtain a first request parameter according to each request time in a target time queue when a duration of data of a target data set in a target switch that is not requested to be obtained is greater than or equal to a first threshold, where the request time is a time when the target switch is requested to obtain the data of the target data set, and the first request parameter is used to indicate a frequency of requesting the target switch to obtain the data of the target data set;
a caching module 504, configured to cache, in the target switch, data of the target data set if the first request parameter and a preset reference request parameter meet a preset target matching condition.
According to the embodiment of the application, under the condition that the data in the data set in the switch is not requested to be acquired for a long time, whether the data in the data set is to be cached in the switch can be determined according to the historical time of requesting the switch to acquire the data in the data set, and the data in the data set which is frequently requested to be acquired is cached in the switch is realized by the mode, so that the problem that more storage space is occupied by the data in the switch is solved, and the effect of reducing the storage space occupied by the data in the switch is achieved
In one exemplary embodiment, the first acquisition module includes:
a first obtaining unit, configured to obtain a set of time intervals from time intervals between a first request time and a second request time that are adjacent in time in the target time queue, where each request time in the target time queue is arranged according to a time sequence of requesting to the target switch for obtaining data of the target data set, and the first request time is earlier than the second request time;
and the second acquisition unit is used for acquiring the first request parameters according to the group of time intervals.
In an exemplary embodiment, the second obtaining unit is configured to:
and according to each time interval in the group of time intervals, acquiring the average difference of each time interval as the first request parameter.
In one exemplary embodiment, the apparatus further comprises:
the second obtaining module is configured to obtain, before obtaining the first request parameter according to each request time in the target time queue, a first difference between a current detection time and a last request time in the target time queue, where the last request time is ordered according to time, and the current detection time is a time for detecting whether to determine to cache data of the target data set in the target switch, and the current detection time is later than the last request time;
and the first determining module is used for determining that the duration of the data of the target data set which is not required to be acquired is greater than or equal to the first threshold value under the condition that the first difference value is greater than or equal to the first threshold value.
In one exemplary embodiment, the buffer module includes:
a calling unit, configured to call a set of objective functions corresponding to the objective data set, where each data of the objective data set has a corresponding function, and each function in the set of objective functions is configured to collect a plurality of data of the objective data set in the objective switch;
And the caching unit is used for caching the calling result of each function in the group of target functions in the target switch.
In one exemplary embodiment, the apparatus further comprises:
a third obtaining module, configured to obtain a target data request at a target request time after the data of the target data set is cached in the target switch, where the target data request is used to request the target switch to obtain target data, and the target data request carries a data identifier of the target data;
the second determining module is used for responding to the target data request and determining a data set to which the data corresponding to the data identifier of the target data belongs as the target data set;
and a fourth obtaining module, configured to obtain the target data from the data of the target data set cached in the target switch.
In one exemplary embodiment, the apparatus further comprises:
the recording module is configured to record, in the target time queue, the target request time according to a time sequence of requesting the target switch to acquire data of the target data set after acquiring the target data from the data of the target data set cached in the target switch, where a last request time in the target time queue is the target request time.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Embodiments of the present application also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the embodiments of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than what is shown or described, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the embodiments of the present application, but rather, various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.

Claims (10)

1. A method of obtaining data, comprising:
acquiring a first request parameter according to each request time in a target time queue when the time length of data of a target data set in a target switch is not required to be acquired is greater than or equal to a first threshold value, wherein the request time is the time of requesting the target switch to acquire the data of the target data set, and the first request parameter is used for indicating the frequency of requesting the target switch to acquire the data of the target data set;
and under the condition that the first request parameter and the preset reference request parameter meet the preset target matching condition, caching the data of the target data set in the target switch.
2. The method of claim 1, wherein the obtaining the first request parameter according to each request time in the target time queue comprises:
Obtaining time intervals between a first request time and a second request time which are adjacent in time in the target time queue to obtain a group of time intervals, wherein the request time in the target time queue is arranged according to the time sequence of requesting the target switch to obtain the data of the target data set, and the first request time is earlier than the second request time;
and acquiring the first request parameter according to the group of time intervals.
3. The method of claim 2, wherein the obtaining the first request parameter according to the set of time intervals comprises:
and according to each time interval in the group of time intervals, acquiring the average difference of each time interval as the first request parameter.
4. The method of claim 1, wherein prior to said obtaining the first request parameter based on each request time in the target time queue, the method further comprises:
acquiring a first difference value between a current detection time and the last request time in the target time queue, wherein the last request time is ordered according to time, the current detection time is the time for detecting whether the data of the target data set is determined to be cached in the target switch, and the current detection time is later than the last request time;
And determining that the duration of the data of the target data set, which is not requested to be acquired, is greater than or equal to the first threshold value under the condition that the first difference value is greater than or equal to the first threshold value.
5. The method of claim 1, wherein said caching data of said target data set in said target switch comprises:
invoking a set of objective functions corresponding to the objective data set, wherein each data of the objective data set has a corresponding function, and each function in the set of objective functions is used for collecting a plurality of data of the objective data set in the objective switch;
and caching the calling result of each function in the group of target functions in the target switch.
6. The method of claim 1, wherein after said caching data of said target data set in said target switch, said method further comprises:
acquiring a target data request at a target request time, wherein the target data request is used for requesting the target switch to acquire target data, and the target data request carries a data identifier of the target data;
Responding to the target data request, and determining a data set to which data corresponding to the data identifier of the target data belongs as the target data set;
and acquiring the target data from the data of the target data set cached in the target switch.
7. The method of claim 6, wherein after obtaining the target data from the data of the target data set cached in the target switch, the method further comprises:
and recording the target request time in the target time queue according to the time sequence of requesting the target switch to acquire the data of the target data set, wherein the last request time in the target time queue is the target request time.
8. A data acquisition apparatus, comprising:
a first obtaining module, configured to obtain a first request parameter according to each request time in a target time queue when a duration of data of a target data set in a target switch that is not requested to be obtained is greater than or equal to a first threshold, where the request time is a time when the target switch is requested to obtain the data of the target data set, and the first request parameter is used to indicate a frequency of requesting the target switch to obtain the data of the target data set;
And the caching module is used for caching the data of the target data set in the target switch under the condition that the first request parameter and the preset reference request parameter meet the preset target matching condition.
9. A computer readable storage medium, characterized in that a computer program is stored in the computer readable storage medium, wherein the computer program, when being executed by a processor, implements the steps of the method according to any of the claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any one of claims 1 to 7 when the computer program is executed.
CN202310264836.1A 2023-03-17 2023-03-17 Data acquisition method and device, storage medium and electronic device Pending CN116319627A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310264836.1A CN116319627A (en) 2023-03-17 2023-03-17 Data acquisition method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310264836.1A CN116319627A (en) 2023-03-17 2023-03-17 Data acquisition method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN116319627A true CN116319627A (en) 2023-06-23

Family

ID=86792136

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310264836.1A Pending CN116319627A (en) 2023-03-17 2023-03-17 Data acquisition method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN116319627A (en)

Similar Documents

Publication Publication Date Title
Waldbusser Remote network monitoring management information base version 2 using SMIv2
US5706508A (en) System and method for monitoring SNMP tables
JP2001043158A (en) Management data processor and computer-readable recording medium recorded with management data processing program
CN114979158B (en) Resource monitoring method, system, equipment and computer readable storage medium
CN113037771B (en) Method and device for controlling device shadow, storage medium and electronic device
CN102215132A (en) Embedded SNMP (Simple Network Management Protocol) management end data collecting device, system and method based on database
US8387068B2 (en) Method and device for managing object instance label
CN111585815B (en) Port data acquisition method and device
CN101860454B (en) Network performance data processing method and device thereof
CN114039892A (en) Network jitter analysis and visualization method and system
US10102286B2 (en) Local object instance discovery for metric collection on network elements
WO2015184850A1 (en) Method, apparatus and system for collecting stale data
CN116319627A (en) Data acquisition method and device, storage medium and electronic device
US6883024B2 (en) Method and apparatus for defining application scope and for ensuring finite growth of scaled distributed applications
Waldbusser RFC1757: Remote Network Monitoring Management Information Base
US11880419B2 (en) Systems and methods for implementing soft locking in a stateless microservice environment
Waldbusser RFC2819: Remote Network Monitoring Management Information Base
US6847996B2 (en) Method for managing an open computer system
KR100621596B1 (en) Mehod for monitoring in network system
CN112148508A (en) Information processing method and related device
KR100612254B1 (en) Apparatus and method of manage performance data in network management system using snmp
JP3877557B2 (en) Hierarchical network management system
KR100455871B1 (en) Method for managing network using high speed packet data network in network management system
Kazaz et al. One approach to the development of custom SNMP agents and integration with management systems
KR100474358B1 (en) Method and apparatus for implementation function of remote network monitoring in high speed router, and storage medium for recording program thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination