How to monitor network interfaces on a Docker host

I monitor an Ubuntu 22.04 Docker host (running many containers) with Checkmk Raw Edition 2.1.0p30. The Checkmk agent on the Docker host lists one service of type “Network interfaces and switch ports” per Docker network interface.

Running docker network ls gives me something like this:

NETWORK ID     NAME                     DRIVER    SCOPE
a2da626e9bc9   bridge                   bridge    local
f31e5ceede2f   certbot                  bridge    local
93c2d2b1dfb5   check-mk-raw             bridge    local
ffeac48f40cd   other-container          bridge    local
...

The respective services in Checkmk are named like “Interface XX” where XX is an incremented value starting with 02 (e.g. “Interface 02”, “Interface 03” etc.). The summary field of the services specifies the interface id, the MAC address etc., e.g. [br-b0929a0e9e06], (up), MAC: 02:42:A3:F7:FA:49, Speed: 10 GBit/s, In: 21.5 B/s (<0.01%), Out: 23.0 B/s (<0.01%)

The problem is, that these interfaces are being numbered in the alphabetical order of the network ids (like br-b0929a0e9e06). If I start a container temporarily, this creates another network id. Now Checkmk reports the values of this new network interface with the name of another service (like e.g. “Interface 04”). Lets say I monitored 12 network interfaces before, “Interface 12” becomes “Interface 13” (unmonitored service) for the time the temporary container runs.

There are several issues with this:

  • Metrics are reported to wrong services while one or multiple temporary containers are running.
  • I cannot disable the monitoring of or modify the parameters of a specific network interface, since I cannot configure a reliable condition for it.

Is there a way to …

  • … either use the network id (e.g. br-b0929a0e9e06) as the service name (e.g. “Network Interface br-b0929a0e9e06”)?
  • … or some other way to solve these issues?

The blog Network Monitoring with Checkmk: 3 rules to rule them all | Checkmk describes how to configure the network interfaces discovery ruleset to have the interface name in the service description. After having that you are able to disable interface checks based on the interface name.

Thank you, @r.sander
That solved my issues.