Open dhilgarth opened 3 months ago
Pinging code owners:
receiver/hostmetrics: @dmitryax @braydonk
See Adding Labels via Comments if you do not have permissions to add labels yourself.
Only hard-guessing here but what about trying to set the hostNetwork
of the Collector Pod to true
?
I'm on Docker Swarm, not on Kubernetes. My understanding is that a container can either use the host network or be in overlay networks.
I need the container to be in overlay networks to be able to talk to the final destinations for the collected data.
I think @ChrsMark comment was on the right direction. In docker
the equivalent hostNetwork
parameter is directly named network
.
In Linux environments, the hostmetrics
receiver reads from any provided proc
filesystem, specifically, the network interface stats are read from the /proc/net/dev
file. But the key to your issue is that the proc filesystem is actually a pseudo-filesystem because it doesn't exist on disk but is instead generated dynamically by the kernel.
Reading network stats without the host's network:
$ docker run -it --user root -v /proc/net/dev:/host-proc-net ubuntu
root@ab671aece539:/# cat host-proc-net
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: 2058 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Reading network stats with the host's network (same network as the host):
$ docker run -it --user root --network=host -v /proc/net/dev:/host-proc-net ubuntu
root@neck-21fvs0qh00:/# cat host-proc-net
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 1347670 8939 0 0 0 0 0 0 1347670 8939 0 0 0 0 0 0
enp72: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
wlan0: 34873370 47887 0 0 0 0 0 0 12566182 34445 0 0 0 0 0 0
docker0: 0 0 0 0 0 0 0 0 3988 23 0 0 0 0 0 0
br-ef339b805f93: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
I reckon this is not an issue with the receiver as the expected host's network files are not available without the --network=host
flag.
@dhilgarth Would it work collecting the hostmetrics in a sidecar container which forwards them to the exit collector (OTLP receiver)?
Component(s)
receiver/hostmetrics
What happened?
Description
My otel collector is running in a container. I've followed the documentation to ensure that it is actually monitoring the host and not the container. And this works for everything except network.
My host has the interface enp7s0 and no interface eth0 or eth1.
Yet, I get data for eth0 and eth1 - as you can see below, the container is in two networks - and not für enp7s0
Collector version
0.106.1
Environment information
Environment
OS: "Ubuntu 22.04" Docker Swarm: "Docker version 24.0.7, build 24.0.7-0ubuntu2~22.04.1"
OpenTelemetry Collector configuration
Log output
No response
Additional context
This is the Docker Swarm Service definition: