A flow monitoring method, device and medium thereof
By receiving and converting traffic monitoring rules in a distributed routing scenario, and delivering them to the router namespaces of computing nodes and network nodes, custom statistics and monitoring of north-south traffic on the cloud platform are realized, solving the problem of traffic monitoring in existing technologies. It provides accurate traffic accounting data and supports the stable operation of the cloud platform.
Patent Information
- Application Number
- CN202211034608.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-26
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-08-26
AI Technical Summary
Existing traffic monitoring technology lacks effective statistics and monitoring capabilities in distributed scenarios and cannot meet the cloud platform's customized statistical requirements for external network traffic, resulting in inaccurate and unreliable traffic billing data.
By receiving traffic monitoring rules from the client, converting them into iptables rules, and issuing them to the router namespaces of computing nodes and network nodes, the statistics and monitoring of north-south traffic can be realized, and filtering rules and normal matching rules can be used to filter traffic. and statistics, periodically collecting traffic data to achieve real-time monitoring.
It implements custom rule statistics for the north-south traffic of the cloud platform in a distributed routing scenario, fills the gap in traffic monitoring functions, provides accurate traffic billing data, and supports the continuous and smooth operation of the cloud platform.
Smart Images

Figure CN115412466B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of flow monitoring, and in particular to a flow monitoring method, device and medium thereof. Background Art
[0002] As cloud computing technology matures, more and more companies choose to build their own cloud environments as the basis for internal office platforms. Businesses running on cloud platforms not only need to connect to external networks to obtain relevant information to provide services to internal users, but also need to communicate with external networks for remote offices and cloud environments that need to cross wide area networks. For cloud platform operators, when it comes to external network communications, traffic billing is an unavoidable issue. Cloud service providers charge users based on their external network traffic usage. This requires cloud platforms to have the function of counting external network traffic.
[0003] Currently, for the openstack (an open source cloud computing management platform project) environment, the network component neutron (openstack community project, providing virtual network functions for the openstack cloud platform) provides a neutron-metering plug-in for counting external traffic in and out of the cloud platform, also known as north-south traffic. The working principle of this plug-in is to add traffic statistics rules on the virtual router connecting the external network and the internal network. The traffic matched by the rules will be synchronized to the monitoring module for storage and display at regular intervals. However, the community currently only supports centralized external traffic collection, and does not support distributed scenarios.
[0004] Therefore, technicians in this field are in urgent need of a traffic monitoring method to solve the current problem of lack of traffic monitoring in distributed scenarios. Summary of the invention
[0005] The purpose of this application is to provide a flow monitoring method, device and medium thereof to solve the problem that there is currently a lack of flow monitoring in distributed scenarios.
[0006] In order to solve the above technical problems, the present application provides a flow monitoring method, comprising:
[0007] Receiving traffic monitoring rules sent by the user end;
[0008] Convert traffic monitoring rules into iptables rules that can be recognized by the underlying structure, and send them to the router namespaces in each computing node and network node that are connected to the external network;
[0009] Run the monitoring components in each computing node and network node, and obtain the traffic monitoring data collected by the monitoring components; the traffic monitoring data is obtained by performing traffic statistics on north-south traffic in each router namespace according to iptables rules.
[0010] Preferably, the traffic monitoring rules include: filtering rules and normal matching rules;
[0011] Among them, the filtering rule is used to filter the north-south traffic, and the filtered north-south traffic does not participate in the traffic statistics; the normal matching rule is used to match the north-south traffic, and the successfully matched north-south traffic participates in the traffic statistics.
[0012] Preferably, the priority of the filtering rule is greater than that of the normal matching rule, and there are multiple normal matching rules.
[0013] Preferably, converting the traffic monitoring rules into iptables rules that can be recognized by the underlying structure and sending them to the router namespaces in each computing node and network node connected to the external network includes:
[0014] Query the nodes containing L3_agent in the current environment, and send the traffic monitoring rules to the traffic monitoring agent in the node containing L3_agent;
[0015] The traffic monitoring agent converts the traffic monitoring rules into iptables rules and sends them to the router namespace of the node.
[0016] Preferably, the filtering rules and normal matching rules include: any one or several of the message processing port, source IP prefix, destination IP prefix, and message direction.
[0017] Preferably, the monitoring component periodically executes a data collection script to obtain traffic monitoring data.
[0018] Preferably, the traffic monitoring data is grouped according to matching traffic monitoring rules, and each group of traffic monitoring data includes: router namespace name, traffic direction, whether it is a filtering rule, source IP prefix, destination IP prefix, number of packets, and number of bytes.
[0019] In order to solve the above technical problems, the present application also provides a flow monitoring device, comprising:
[0020] A rule receiving module, used for receiving the traffic monitoring rules sent by the user end;
[0021] The node distribution module is used to convert traffic monitoring rules into iptables rules that can be recognized by the underlying structure, and distribute them to the router namespaces in each computing node and network node that are connected to the external network;
[0022] The traffic monitoring module is used to run the monitoring components in each computing node and network node, and obtain the traffic monitoring data collected by the monitoring components; the traffic monitoring data is obtained by performing traffic statistics on north-south traffic in each router namespace according to iptables rules.
[0023] In order to solve the above technical problems, the present application also provides a flow monitoring device, comprising:
[0024] Memory for storing computer programs;
[0025] The processor is used to implement the steps of the above-mentioned flow monitoring method when executing a computer program.
[0026] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned traffic monitoring method are implemented.
[0027] A traffic monitoring method provided by the present application is based on the principle that in a distributed scenario, two paths of communication between a virtual machine and an external network are respectively implemented through ports of the router namespace of a network node and a computing node. Traffic monitoring rules are deployed in the router namespace of the computing node and the network node to count north-south traffic according to user requirements, and monitoring agents are added at corresponding nodes to collect and upload the above-stated traffic monitoring data, thereby realizing traffic monitoring. This method fills the current gap in traffic monitoring in distributed scenarios and is beneficial to the deployment and use of cloud platforms.
[0028] The flow monitoring device and computer-readable storage medium provided in the present application correspond to the above method and have the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0030] Figure 1 A flow chart of a flow monitoring method provided by the present invention;
[0031] Figure 2 A flow monitoring method provided by the present invention and its principle and example diagram;
[0032] Figure 3 A structural diagram of a flow monitoring device provided by the present invention;
[0033] Figure 4A structural diagram of another flow monitoring device provided by the present invention. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] The core of this application is to provide a flow monitoring method, device and medium thereof.
[0036] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0037] For the current cloud platform construction, a mainstream way is the OpenStack environment. In this application environment, the network component Neutron of OpenStack provides a neutron-metering plug-in to count the external traffic in and out of the cloud platform according to preset rules.
[0038] Therefore, for centralized scenarios, that is, the application scenarios where the virtual router connecting the internal network and the external network works on the network node, all traffic of the virtual machines in the computing node for cross-subnet communication needs to pass through the router of the network node before reaching the destination. That is, in the application scenario of centralized routing, all north-south traffic will pass through the network node. In this case, you only need to deploy the neutron-metering plug-in in the network node to achieve the effect of counting north-south traffic according to user needs.
[0039] However, for cloud platforms with high bandwidth requirements, centralized routing will become a bottleneck of network bandwidth, so distributed routing is also needed in some application scenarios. In this application scenario, distributed routing, as another routing architecture of openstack, disperses virtual routers in computing nodes to share the bandwidth pressure of network nodes, thus solving the bottleneck problem of network bandwidth caused by centralized routing. However, this deployment architecture will bring new problems, that is, the north-south traffic generated by the communication between virtual machines and external networks not only flows through network nodes, but also reaches virtual machines through computing nodes. Therefore, simply deploying the neutron-metering plug-in in the network node cannot meet the requirements of traffic statistics, and there are deficiencies in the deployment of this part of the traffic monitoring function.
[0040] In order to solve the above-mentioned problem that traffic monitoring is insufficient in the distributed routing scenario, the present application provides a traffic monitoring method, such as Figure 1 As shown, including:
[0041] S11: receiving the traffic monitoring rules sent by the user terminal.
[0042] It should be noted that the traffic monitoring rules sent by the user end are written in a high-level language in a rule form that is easy for users to understand, which is different from the iptables rules described below.
[0043] iptables: A management tool for Linux system firewalls that works in user space.
[0044] S12: Convert the traffic monitoring rules into iptables rules that can be recognized by the underlying structure, and send them to the router namespaces in each computing node and network node that are connected to the external network.
[0045] The traffic monitoring rules that are easy for users to view are converted into iptables rules that can be recognized by the underlying structure, so that the router namespaces of each computing node and network node can use iptables rules to perform north-south traffic statistics. The above conversion process is essentially equivalent to the process of converting a computer high-level language into a machine language that can be recognized by the hardware structure. Since there is currently a solution for performing targeted statistics on traffic according to the rules pre-set by the user in the centralized routing distribution scenario, that is, the process of converting the traffic monitoring rules that are easy for users to understand into iptables rules that can be recognized by the underlying structure is known, and those in the field of this technology know how to implement it, so this embodiment will not be repeated here.
[0046] S13: Run the monitoring components in each computing node and network node, and obtain the traffic monitoring data collected by the monitoring components.
[0047] The traffic monitoring data is obtained by counting the north-south traffic in each router namespace according to the iptables rules; the monitoring component is the neutron component mentioned above. The specific implementation principle and architecture of the above traffic monitoring method are as follows: Figure 2 As shown:
[0048] The user end starts the neutron service (neutron-server) by sending instructions to the control node, and establishes a traffic metering agent (neutron-metering-agent) in the network node and the computing node. When the user end sends the traffic monitoring rules to the control node, the neutron service of the control node sends them to the traffic metering agents of the computing nodes and network nodes connected to the external network. The traffic metering agents of each node then convert the traffic monitoring rules into iptables rules that can be recognized by the router namespace and send them down (i.e. Figure 2 The rule delivery process in the ... Figure 2 The data in the data) is collected and uploaded to the monitor (i.e. Figure 2 In the monitor) in the system, the traffic monitoring data can be monitored and displayed in real time to meet the user's traffic monitoring and statistical needs.
[0049] The implementation principle of the above-mentioned flow monitoring method is also as follows Figure 2 As shown in the example, in a distributed routing scenario, there are two communication paths for a virtual machine (VM) to communicate with an external network. One is through a floating IP address (i.e. Figure 2 The FIP bidirectional curve segment in the figure) directly accesses the external network through the rfp port of the router namespace in the computing node and the fg port of the floating ip namespace; the other is to achieve it through SNAT (i.e. Figure 2 The SNAT bidirectional curve segment in the figure accesses the external network through the qg port in the network node router namespace.
[0050] From the above two communication paths, it can be seen that in the distributed routing scenario, data communication between the cloud environment and the external network must pass through the router namespace of the network node or computing node. Therefore, no matter which port the north-south traffic enters or flows out from, deploying traffic monitoring rules in the router namespace of the computing node and the network node can effectively count and monitor the north-south traffic.
[0051] It should be noted that the traffic monitoring performed by this application is not a simple statistics and monitoring of all north-south traffic, but is performed according to certain preset rules, namely the above-mentioned traffic monitoring rules. If only all north-south traffic in and out of the cloud platform is counted, it can be achieved through the statistics function of the port (the above-mentioned rfp port, qg port, etc.). Users can configure traffic monitoring rules as needed to customize the type of traffic to be monitored. Specifically, the processing port, source IP prefix, destination IP prefix, message direction, etc. of the traffic message can be set.
[0052] The present application provides a traffic monitoring method. Since in the distributed routing scenario, the communication between the virtual machine and the external network needs to pass through the port in the router namespace of the computing node or the network node, the method acts on the router namespace of each node by issuing user-defined traffic monitoring rules to each computing node and network node that has a communication relationship with the external network in the distributed routing scenario, so as to count all the north-south traffic flowing through according to the preset traffic monitoring rules, thereby filling the deficiency of realizing the function of counting north-south traffic according to custom rules in the distributed routing scenario, expanding the scope of use of the function of counting north-south traffic entering and leaving the cloud platform according to preset rules, providing reliable data for cloud platform traffic billing, and facilitating the continuous and stable operation of the cloud platform.
[0053] It can be seen from the above embodiments that the main technical problem solved by the traffic monitoring method provided in this application is how to realize north-south traffic statistics according to user-defined rules in a distributed routing situation. Therefore, the setting of traffic monitoring rules is also an important part of this method.
[0054] To further clearly illustrate a flow monitoring method provided by the present application, this embodiment provides a preferred implementation scheme for flow monitoring rules:
[0055] Traffic monitoring rules include: filtering rules and normal matching rules.
[0056] Among them, the filtering rule is used to filter the north-south traffic, and the filtered north-south traffic does not participate in the traffic statistics; the normal matching rule is used to match the north-south traffic, and the successfully matched north-south traffic participates in the traffic statistics.
[0057] It is easy to understand that the normal matching rules are the traffic that the user needs to count. For example, in a possible setting method of the above-mentioned traffic monitoring rules, the normal matching rules can be any of the above-mentioned message processing port, source IP prefix, destination IP prefix, and message direction, that is, the messages that meet the normal matching rules participate in the traffic statistics.
[0058] ip: IP address (Internet Protocol Address) refers to the Internet Protocol address, also translated as Internet Protocol address.
[0059] Similarly, filtering rules are rules that users do not need. Traffic that meets the filtering rules does not participate in subsequent traffic statistics. The filtering rules are equivalent to an initial screening of all north-south traffic before performing traffic statistics, eliminating a portion of the north-south traffic that definitely does not meet user needs, and avoiding the problem of all being matched by normal matching rules, which affects the efficiency of traffic statistics.
[0060] It should be noted that this embodiment is not limited to the number of filtering rules and normal matching rules, that is, if any one of the processing port, source IP prefix, destination IP prefix, and message direction of the above-mentioned message is used as a rule constraint, then there may be one or more filtering rules or normal matching rules.
[0061] Furthermore, in actual applications, there are usually multiple normal matching rules, and the priority of the filtering rule is higher than that of the normal matching rule.
[0062] That is, before matching the normal matching rules, the filtering rules are matched first. The successfully matched north-south traffic is the traffic that needs to be filtered, and this part of the traffic is not allowed to participate in the subsequent normal matching rule matching; and there are multiple normal matching rules. After the initial screening of the filtering rules, the north-south traffic matches each normal matching rule respectively. The message that matches a normal matching rule (that is, the manifestation of the north-south traffic) can also participate in the matching of other normal matching rules, that is, one message can match multiple normal matching rules.
[0063] If there are multiple filtering rules, the north-south traffic that meets the conditions of any filtering rule will not participate in the subsequent process, so the north-south traffic that matches any filtering rule does not need to match other filtering rules.
[0064] It can be seen from the above embodiments that the traffic monitoring rules for users are mostly configured from the aspects of message processing port, source IP prefix, destination IP prefix, and message direction, that is, the above filtering rules and normal matching rules should include any one or several of the above constraints.
[0065] The filtering rules are easy to understand. The north-south traffic that meets the constraints in the filtering rules does not participate in the traffic statistics, which reflects the user's need for some traffic that does not need to be counted. The normal matching rules reflect the user's need for some traffic that needs to be counted. The above two rules reflect the user's needs from different aspects.
[0066] Therefore, in the traffic monitoring data obtained by statistics, a preferred method is that there should be corresponding content according to the possible constraints of the above-mentioned filtering rules and normal matching rules, that is, the traffic monitoring data should be distinguished according to the matched traffic monitoring rules and include the following contents:
[0067] Router namespace name, traffic direction, whether it is a filtering rule, source IP prefix, destination IP prefix, number of packets and number of bytes.
[0068] Among them, the number of messages and the number of bytes are data contents that directly reflect the amount of traffic monitored by the traffic monitoring data, and the remaining data contents are mostly used to reflect the traffic monitoring rules matched by the traffic monitoring data, that is, to distinguish each traffic monitoring data.
[0069] Furthermore, it can be seen from the above embodiments that a traffic monitoring method provided by the present application is to perform statistics and monitoring of north-south traffic by sending traffic monitoring rules to computing nodes and network nodes that may interact with external network data in a distributed routing scenario. Therefore, this embodiment provides a preferred implementation scheme for accurately sending traffic monitoring rules to computing nodes and network nodes that communicate with external networks among numerous nodes in the cloud platform.
[0070] In the application scenario of starting the neutron service in the openstack environment, all external network traffic is generated in the node containing L3_agent. L3_agent is the agent in the neutron component responsible for receiving and issuing routing forwarding configurations. Therefore, by querying the node including L3_agent, obtaining the node name, and specifying the above-obtained node name to issue traffic monitoring rules, it is possible to accurately issue traffic monitoring rules to computing nodes and network nodes that have communication with external networks. Specifically, the traffic monitoring rules are issued to the traffic monitoring agent (neutron-metering-agent) of the node containing L3_agent, acting on the router namespace of the node.
[0071] Based on the above principle, the preferred solution provided in this embodiment is to further explain the above step S12, and step S12 is specifically:
[0072] S121: Query the node containing L3_agent in the current environment, and send the traffic monitoring rule to the traffic monitoring agent in the node containing L3_agent.
[0073] S122: The traffic monitoring agent converts the traffic monitoring rules into iptables rules and sends them to the router namespace of the node.
[0074] A preferred solution provided in this embodiment provides a method for accurately sending traffic monitoring rules to the computing nodes and network nodes where the traffic monitoring rules are deployed as required by the above method, so as to better realize on-demand statistics of north-south traffic of the cloud platform, fill the deficiencies of the prior art in distributed routing application scenarios, increase the scope of application of the traffic statistics function, and be more conducive to the deployment and practical application of the cloud platform environment.
[0075] Through the above-mentioned embodiments of the description of a traffic monitoring method provided by the present application, it is easy to know that the on-demand statistics of traffic should be a real-time and continuous process, that is, the monitoring of traffic is not just done once, but at regular intervals within the required time, the north-south traffic entering and leaving the cloud platform within the current time period is counted. When the above-mentioned interval time period is short enough, the effect of real-time monitoring can be approximately achieved.
[0076] Therefore, this embodiment provides a preferred implementation scheme: the above-mentioned monitoring component periodically executes the data collection script to obtain traffic monitoring data.
[0077] It should be noted that obtaining the traffic monitoring data counted according to the traffic monitoring rules in the namespace of the node router through the data collection script is only one possible data collection method. This embodiment is not limited to using only the above-mentioned implementation method in the process of collecting and obtaining traffic monitoring data. It is only because the above-mentioned method is simple and easy to operate, so the data collection script is used to collect the traffic monitoring data.
[0078] Furthermore, the periodic information based on which the monitoring component periodically executes the data collection script should be determined by the user according to his or her own needs, and the real-time performance of traffic monitoring and the load on each node of the cloud platform must be taken into consideration. The real-time performance of traffic monitoring requires that the preset period be as short as possible, that is, the higher the frequency of data collection, the better. However, for the node load, the frequency of data collection is required to be as low as possible. Therefore, technical personnel in this field should make trade-offs between the above two requirements based on actual conditions and needs.
[0079] Generally speaking, the default collection period is set to 5 minutes, that is, the monitoring component runs the data collection script once every 5 minutes to obtain the traffic monitoring data within these 5 minutes. As for whether the monitor displays the traffic monitoring data for these 5 minutes separately after obtaining it, or displays it in combination with the traffic monitoring data of other time periods obtained previously, this embodiment does not impose any restrictions on this, and technical personnel in this field can choose an appropriate traffic monitoring data display method according to actual needs.
[0080] A preferred implementation scheme provided in this embodiment periodically instructs the monitoring component to execute a data collection script to obtain traffic monitoring data, so that users can learn about the monitoring status of the north-south traffic of the cloud platform. The periodic collection of traffic monitoring data ensures that users can learn about traffic statistics in a timely manner to meet the monitoring needs of users. The collection of traffic monitoring data in the router namespace is realized by calling the data collection script. The operation is simple and the implementation is convenient, which reduces the use threshold of the traffic monitoring method provided in this application, so that it can be better applied in a practical environment.
[0081] In order to more clearly and in detail illustrate a flow monitoring method provided by the present application, this embodiment combines examples and Figure 2 Further explanation of the above method:
[0082] like Figure 2 In a distributed routing scenario shown, a group of control nodes, network nodes and computing nodes are shown as examples, and also include a user end for configuring traffic monitoring rules and an external network for communicating with the cloud platform.
[0083] Specifically, the control node includes the neutron service (also known as neutron-server); the network node includes: a traffic monitoring agent (neutron-metering-agent), a router namespace (router namespace), and a monitor (monitor), and the router namespace includes a qg port for data communication with the external network; the computing node includes: a virtual machine (VM), a traffic monitoring agent (neutron-metering-agent), a monitor (monitor), a router namespace (router namespace) and a floating ip namespace (fip namespace), wherein the router namespace includes an rfp port, and the floating ip namespace includes an fg port. It is easy to understand that the above-mentioned traffic monitoring agent and monitor are a monitoring component.
[0084] The user end has a communication connection with the neutron service in the control node, which is used to issue user-defined traffic monitoring rules; the neutron service in the control node has a communication connection with the traffic monitoring agent in the network node and the computing node, which is used to issue traffic monitoring rules; the traffic monitoring agent is used to convert the received traffic monitoring rules into iptables rules (rules), and issue them to the router namespace through the communication connection relationship with the router namespace.
[0085] In the current distributed routing application scenario, there are two transmission paths between the external network and the virtual machine. One is the FIP method, and the path is shown as the corresponding curve segment, which reaches the virtual machine through the fg port and rfp port of the computing node; the other is the SNAT method, which reaches the virtual machine through the qg port of the network node.
[0086] Therefore, the traffic monitoring rules acting on the router namespaces of network nodes and computing nodes can count the north-south traffic flowing through the corresponding ports. Furthermore, through the communication relationship between the router namespaces of each node and the monitor, the traffic monitoring data is collected, thereby realizing the function of user-defined rules to count traffic in distributed routing scenarios.
[0087] A traffic monitoring method provided by the present application deploys traffic monitoring rules in the router namespace of network nodes and computing nodes for distributed routing scenarios, so that the transmission paths of all north-south traffic interacting with the cloud platform can be counted by the traffic monitoring rules, thereby obtaining accurate traffic statistics results. The above-mentioned method fills the gap in the existing technology for traffic monitoring functions in distributed routing scenarios, making it possible to monitor and count the north-south traffic of the cloud platform according to user-defined traffic monitoring rules in distributed routing scenarios, thereby expanding the scope of application and being more conducive to the deployment and use of the cloud platform.
[0088] In the above embodiment, a flow monitoring method is described in detail, and the present application also provides a corresponding embodiment of a flow monitoring device. It should be noted that the present application describes the embodiment of the device part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.
[0089] Based on the functional module perspective, such as Figure 3 As shown, this embodiment provides a flow monitoring device, including:
[0090] The rule receiving module 21 is used to receive the traffic monitoring rules sent by the user terminal;
[0091] The node sending module 22 is used to convert the traffic monitoring rules into iptables rules that can be recognized by the underlying structure, and send them to the router namespaces in each computing node and network node connected to the external network;
[0092] The traffic monitoring module 23 is used to run the monitoring components in each computing node and network node, and obtain the traffic monitoring data collected by the monitoring components; wherein the traffic monitoring data is obtained by performing traffic statistics on the north-south traffic in each router namespace according to the iptables rules.
[0093] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0094] The traffic monitoring device provided in this embodiment, since in the distributed routing scenario, the communication between the virtual machine and the external network must pass through the port in the router namespace of the computing node or the network node, so this method sends the user-defined traffic monitoring rules received by the rule receiving module to each computing node and network node through the node sending module, and specifically acts on the router namespace of each node. Therefore, when the external network interacts with the virtual machine through the port in the router namespace, the traffic preset rules can match all the north-south traffic flowing through, and the traffic that is successfully matched is the traffic that needs to be counted, and the corresponding traffic monitoring data is generated. This embodiment fills the gap in the current distributed routing scenario for realizing the function of customizing rules to count north-south traffic, expands the scope of use of the function of counting north-south traffic in and out of the cloud platform according to preset rules, provides reliable data for cloud platform traffic billing, and is conducive to the continuous and stable operation of the cloud platform.
[0095] Figure 4 A structural diagram of a flow monitoring device provided in another embodiment of the present application is shown in FIG. Figure 4 As shown, a flow monitoring device includes: a memory 30 for storing a computer program;
[0096] The processor 31 is used to implement the steps of a flow monitoring method in the above embodiment when executing a computer program.
[0097] The flow monitoring device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.
[0098] Among them, the processor 31 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 31 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 31 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 31 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 31 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0099] The memory 30 may include one or more computer-readable storage media, which may be non-transitory. The memory 30 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 30 is at least used to store the following computer program 301, wherein, after the computer program is loaded and executed by the processor 31, it can implement the relevant steps of a flow monitoring method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 30 may also include an operating system 302 and data 303, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 302 may include Windows, Unix, Linux, etc. Data 303 may include, but is not limited to, a flow monitoring method, etc.
[0100] In some embodiments, a flow monitoring device may further include a display screen 32 , an input / output interface 33 , a communication interface 34 , a power supply 35 , and a communication bus 36 .
[0101] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation of a flow monitoring device, and may include more or fewer components than shown in the figure.
[0102] A flow monitoring device provided in an embodiment of the present application includes a memory and a processor. When the processor executes a program stored in the memory, it can implement the following method: a flow monitoring method.
[0103] The flow monitoring device provided in this embodiment executes a computer program stored in a memory through a processor to implement user-defined flow monitoring rules to each computing node and network node, and specifically acts on the router namespace of each node. Therefore, when the external network interacts with the virtual machine through the port in the router namespace, the flow preset rules can match all the north-south flows passing through, and the successfully matched flows are the flows that need to be counted, and the corresponding flow monitoring data is generated. This embodiment fills the gap in the current distributed routing scenario for realizing the function of counting north-south flows according to custom rules, expands the scope of use of the function of counting north-south flows entering and leaving the cloud platform according to preset rules, provides reliable data for cloud platform flow billing, and is conducive to the continuous and stable operation of the cloud platform.
[0104] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0105] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0106] The computer-readable storage medium provided in this embodiment, when the computer program stored therein is executed, can implement user-defined traffic monitoring rules to be sent to each computing node and network node, specifically acting on the router namespace of each node. Therefore, when the external network interacts with the virtual machine through the port in the router namespace, the traffic preset rules can match all north-south traffic flowing through, and the successfully matched traffic is the traffic that needs to be counted, and the corresponding traffic monitoring data is generated. This embodiment fills the gap in the current distributed routing scenario for implementing the function of customizing rules to count north-south traffic, expands the scope of use of the function of counting north-south traffic in and out of the cloud platform according to preset rules, provides reliable data for cloud platform traffic billing, and is conducive to the continuous and stable operation of the cloud platform.
[0107] The above is a detailed introduction to a flow monitoring method, device and medium provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0108] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A flow monitoring method, characterized in that: include: Receive traffic monitoring rules sent by a user end; wherein the traffic monitoring rules are rules written in a high-level language, including: filtering rules and normal matching rules; the filtering rules are used to filter north-south traffic, and the filtered north-south traffic does not participate in traffic statistics; the normal matching rules are used to match the north-south traffic, and the successfully matched north-south traffic participates in the traffic statistics; the priority of the filtering rules is greater than the normal matching rules, and there are multiple normal matching rules; the filtering rules and the normal matching rules include: any one or several of the processing port, source IP prefix, destination IP prefix, and message direction of the message; Query the nodes containing L3_agent in the current environment and obtain the node name; Sending the traffic monitoring rule to the traffic monitoring agent in the node including the L3_agent according to the node name; The traffic monitoring agent converts the traffic monitoring rules into iptables rules and sends them to the router namespace of the node; The monitoring components in each computing node and network node are run, and the traffic monitoring data collected by the monitoring components are obtained; wherein the traffic monitoring data is obtained by performing traffic statistics on the north-south traffic in each router namespace according to the iptables rule; the north-south traffic is obtained by counting the traffic passing through the rfp port of the router namespace in the computing node and the fg port of the floating ip namespace, and the qg port of the router namespace of the network node through the statistics function of the port; the traffic monitoring data is grouped according to the matching traffic monitoring rules, and each group of the traffic monitoring data includes: router namespace name, traffic direction, whether it is a filtering rule, source ip prefix, destination ip prefix, number of messages, and number of bytes; the monitoring component is a neutron component; the monitoring component periodically executes a data collection script to obtain the traffic monitoring data.
2. A flow monitoring device, characterized in that: include: A rule receiving module is used to receive traffic monitoring rules sent by a user end; wherein the traffic monitoring rules are rules written in a high-level language, including: filtering rules and normal matching rules; the filtering rules are used to filter north-south traffic, and the filtered north-south traffic does not participate in traffic statistics; the normal matching rules are used to match the north-south traffic, and the successfully matched north-south traffic participates in traffic statistics; the priority of the filtering rules is greater than the normal matching rules, and there are multiple normal matching rules; the filtering rules and the normal matching rules include: any one or several of the processing port of the message, the source IP prefix, the destination IP prefix, and the message direction; A node sending module, used for querying the node containing L3_agent in the current environment and obtaining the node name; sending the traffic monitoring rule to the traffic monitoring agent in the node containing the L3_agent according to the node name; the traffic monitoring agent converts the traffic monitoring rule into iptables rules and sends it to the router namespace of the node; A traffic monitoring module is used to run the monitoring components in each computing node and network node, and obtain the traffic monitoring data collected by the monitoring components; wherein the traffic monitoring data is obtained by performing traffic statistics on the north-south traffic in each router namespace according to the iptables rule; the north-south traffic is obtained by counting the traffic flowing through the rfp port of the router namespace in the computing node and the fg port of the floating ip namespace, and the qg port of the router namespace of the network node through the statistical function of the port; the traffic monitoring data is grouped according to the matching traffic monitoring rules, and each group of the traffic monitoring data includes: router namespace name, traffic direction, whether it is a filtering rule, source ip prefix, destination ip prefix, number of messages, and number of bytes; the monitoring component is a neutron component; the monitoring component periodically executes a data collection script to obtain the traffic monitoring data.
3. A flow monitoring device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the flow monitoring method as claimed in claim 1 when executing the computer program.
4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the flow monitoring method according to claim 1 are implemented.
Citation Information
Patent Citations
Method for counting traffic of virtual machine extranet of cloud platform
CN105681125A
Communication method, communication system and control node for distributed networks
CN105871740A
Method for realizing southbound and northbound communication of virtual machines on computing nodes
CN106059803A
Method and system for monitoring cloud computing virtual tenant network
CN106330602A
Method for achieving high-speed distributed routing between computational nodes of data center
CN106685835A
