Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Collect netns#240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ShirleyFei wants to merge6 commits intoAtoptool:master
base:master
Choose a base branch
Loading
frombytedance:collect-netns
Open

Conversation

@ShirleyFei
Copy link
Contributor

The network devices, like eth2, are settled in another network namespace viaip netns add in some scenarios in the production environment. In this case, we have to switch to that new netns to get network related statistics, e.g. reading from /proc/net/dev, /proc/net/snmp, /proc/net/snmp6.

Add a 'netns' indicator to indicate which netns the network is belong to. And collect statistics for other netns by usingsetns to switch to another netns to read /proc files, and then use shared memory for parent-child IPC.

Combined with actual needs and performance considerations, this patch only collects other netns's physical network devices stats. Virtual devices are ignored except the 'lo'.

To pass the compiling, also update for atopsar, parsable and json.

Also format some lines according to astyle.

We already get the attibutes of ifprop during getifprop() afterreading /proc/net/dev, thus remove the unnecessary second getterin deviatsyst().Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
The network devices, like eth2, are settled in another networknamespace via `ip netns add` in some scenarios in the productionenvironment. In this case, we have to switch to that new netnsto get network related statistics, e.g. reading from /proc/net/dev,/proc/net/snmp, /proc/net/snmp6.This patch firstly adds the needed attributes, like 'netns', forcollecting and displaying network namespace statistics. Then thefollowing patches will do the real implementation.To pass the compiling, also update for atopsar, parsable and json.Also format some lines according to astyle.Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
For linux kernel, it exposes almost 100 lines for /proc/net/snmp6file. Considering multiple-netns situations, too many lines had tobe read and transferred, which is quite time consuming and spaceconsuming.Let's optimize this by adding 'idx' to mark the needed indicators'position in struct v6tab. During the first time reading, e.i. theinit_net namespace, we record the positions. Then in the followingother netns, we only need to store and transfer indicators' valuesaccording to their positions.Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
This patch implements how to collect statistics for other netnsby using `setns` to switch to another netns to read /proc files,and then use shared memory for parent-child IPC.Combined with actual needs and performance considerations, thispatch only collects other netns's physical network devices stats.Virtual devices are ignored except the 'lo'.Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
The default rule is splitting netns by blank space.And make sure the netns path exits.Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@ShirleyFei

[8]ページ先頭

©2009-2025 Movatter.jp