Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metricbeat: Add network stats for containerized processes #2483

Closed
andrewkroh opened this issue Sep 7, 2016 · 7 comments
Closed

Metricbeat: Add network stats for containerized processes #2483

andrewkroh opened this issue Sep 7, 2016 · 7 comments
Assignees
Labels
enhancement Metricbeat Metricbeat module Team:Integrations Label for the Integrations team

Comments

@andrewkroh
Copy link
Member

andrewkroh commented Sep 7, 2016

Add networks stats to the system-process output.

The sample output below was collected from Amazon Linux 2016.03 running Docker 1.11.2.

# This is a containerized process.
[root@ip-10-0-50-226 ec2-user]# cat /proc/24138/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0:     438       5    0    0    0     0          0         0      648       8    0    0    0     0       0          0

# This is a regular process. The metrics are same as the overall system network stats.
[root@ip-10-0-50-226 ec2-user]# cat /proc/2627/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
vethf345468:     648       8    0    0    0     0          0         0      438       5    0    0    0     0       0          0
    lo: 1662073845 1565671    0    0    0     0          0         0 1662073845 1565671    0    0    0     0       0          0
docker0:    2568      38    0    0    0     0          0         0      438       5    0    0    0     0       0          0
  eth0: 771012855  945219    0    0    0     0          0         0 557250737  664840    0    0    0     0       0          0

# These are the overall system metrics.
[root@ip-10-0-50-226 ec2-user]# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
vethf345468:     648       8    0    0    0     0          0         0      438       5    0    0    0     0       0          0
    lo: 1662073845 1565671    0    0    0     0          0         0 1662073845 1565671    0    0    0     0       0          0
docker0:    2568      38    0    0    0     0          0         0      438       5    0    0    0     0       0          0
  eth0: 771014279  945239    0    0    0     0          0         0 557253481  664852    0    0    0     0       0          0
@andrewkroh andrewkroh self-assigned this Sep 13, 2016
@andrewkroh
Copy link
Member Author

andrewkroh commented Sep 13, 2016

I have a working prototype of this feature in my branch at https://github.com/andrewkroh/beats/tree/feature/mb/process-network-stats.

The system process metricset includes the network statistics aggregated across each of the interfaces. I did this to avoid having an array of individual interface metrics. You can filter out interfaces if desired (for example, to avoid including metrics from lo0).

Network interface metrics are only included when the process is in a different network namespace than Metricbeat. This is to avoid sending network metrics when those metrics are actually the same as the overall system network metrics. This is accomplished by comparing the namespace information in /proc/self/ns/net to /proc/[pid]/ns/net. If the inode's are different then they are in different namespaces.

Currently I am only enabling this feature when cgroups: true is configured. This feature is not strictly related to cgroups but you would probably enable them together. I'm on the fence about how to enable this?

@ruflin
Copy link
Contributor

ruflin commented Sep 13, 2016

It seems like the network stats are not too many additional metrics per event. That means if available I would ship them by default also when cgroup is diabled even though they are kind of linked together. If we don't want to enable it by default (if available) we should add one more config option. In case we flag this addition as experimental, a config option is required.

@monicasarbu
Copy link
Contributor

++ to add another config option (at least for now).

@tangyong
Copy link

whether having any release plan for the feature? thanks!

@ruflin ruflin added the module label Feb 26, 2018
@ruflin
Copy link
Contributor

ruflin commented May 8, 2018

@andrewkroh Do you remember if we ever moved forward on this one?

@andrewkroh
Copy link
Member Author

This feature was never added. Nearly all the code necessary to add this has been committed upstream so I think it would be relatively simple to add it now.

I still have my first attempt save at andrewkroh@7dd6ba8.

@jlind23
Copy link
Collaborator

jlind23 commented Apr 1, 2022

Backlog grooming: Closing it for now until further activity, can still be reopened if needed.

@jlind23 jlind23 closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Metricbeat Metricbeat module Team:Integrations Label for the Integrations team
Projects
None yet
Development

No branches or pull requests

5 participants