Inputs.docker - no docker_container_network

Please help me see or debug why Telegraf does not report on docker_container_network. Telegraf DOES report on status, mem, cpu & blkio(from stdout):

docker_container_status
docker_container_mem
docker_container_cpu
docker_container_blkio

telegraf.conf
[[inputs.docker]]
endpoint = “unix:///var/run/docker.sock”
perdevice = false
total = false
perdevice_include = [“cpu”, “blkio”, “network”]
total_include = [“cpu”, “blkio”, “network”]

telegraf --version
Telegraf 1.24.2

docker version
With Docker (API) Verison
Client:
Version: 20.10.17
API version: 1.41
Go version: go1.18.6
Server:
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)

Please checkout the dockker readme

Please note that this setting has no effect if ‘total’ is set to ‘false’
total_include = [“cpu”, “blkio”, “network”]

You have total_include set to network, but total set to false so that option is ignored.

@jpowers Thanks for the reply.

Could you please suggest a working stanza that ‘should’ work? I don’t seem to have any luck when mix/matching the set of options. cpu, mem, blkio, status all report w/o issue.

I this, it reports all except net:
[[inputs.docker]]
endpoint = “unix:///var/run/docker.sock”
perdevice = false
#perdevice required (can’t comment out) to prevent log deprecated warning.
#total = true
#perdevice_include = [“cpu”, “blkio”, “network”]
#total_include = [“cpu”, “blkio”, “network”]

OS:
Virtualization: amazon
Operating System: Amazon Linux 2

What do you get with the following?

[[inputs.docker]]
endpoint = "unix:///var/run/docker.sock"
perdevice_include = ["cpu", "blkio", "network"]
total_include = ["cpu", "blkio", "network"]
perdevice = false

With that I see my network:

docker_container_net,container_image=telegraf,container_name=festive_heisenberg,container_status=running,container_version=unknown,engine_host=ryzen,host=ryzen,network=eth0,server_version=20.10.21 rx_errors=0i,tx_packets=0i,tx_dropped=0i,tx_errors=0i,container_id="5b989ca95b89e6aa0b8e5464f1e7826b5eba1df3acd4c0568639f2e19e299599",rx_dropped=0i,rx_bytes=3855i,rx_packets=40i,tx_bytes=0i 1668021677000000000

@jpowers

[[inputs.docker]]
endpoint = “unix:///var/run/docker.sock”
perdevice_include = [“cpu”, “blkio”, “network”]
total_include = [“cpu”, “blkio”, “network”]
perdevice = false

No results for net.
[root@stg-live3 telegraf]# telegraf --test --config telegraf.conf | grep docker_container_net
[root@stg-live3 telegraf]# telegraf --test --config telegraf.conf | grep docker_container_cpu

docker_container_cpu,container_image=verify_address_book,container_name=verify_address_book,container_status=running,container_version=unknown,cpu=cpu-total,engine_host=…,host=…,maintainer=…,org.label-schema.build-date=20190305,org.label-schema.license=GPLv2,org.label-schema.name=CentOS\ Base\ Image,org.label-schema.schema-version=1.0,org.label-schema.vendor=CentOS,server_version=20.10.17 container_id=“79ac913a37c26555d4b27cc9e3eadc56bc97c9aa568b8b3e5c96e0cec314af39”,throttling_periods=0i,throttling_throttled_periods=0i,throttling_throttled_time=0i,usage_in_kernelmode=5200000000i,usage_in_usermode=4330000000i,usage_percent=0,usage_system=1370738470000000i,usage_total=9521778065i 1668023199000000000

What network is verify_address_book using:

docker ps --format '{{ .ID }} {{ .Names }} {{ json .Networks }}'

@jpowers Not sure if this answers the question, but here is the result:

79ac913a37c2 verify_address_book “host”

And docker inspect shows this for NetworkSettings:

“NetworkSettings”: {
“Bridge”: “”,
“SandboxID”: “9cb483b93bfde569f802e932a31af4ac491f71fcfe4ff2f0819d66b2dd8ad0e3”,
“HairpinMode”: false,
“LinkLocalIPv6Address”: “”,
“LinkLocalIPv6PrefixLen”: 0,
“Ports”: {},
“SandboxKey”: “/var/run/docker/netns/default”,
“SecondaryIPAddresses”: null,
“SecondaryIPv6Addresses”: null,
“EndpointID”: “”,
“Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“MacAddress”: “”,
“Networks”: {
“host”: {
“IPAMConfig”: null,
“Links”: null,
“Aliases”: null,
“NetworkID”: “2740783d9dd8631735df83dd9b9a9cec03fbf8f0d931463a221c281d70477cc0”,
“EndpointID”: “84dab8d592cd6b2dbc7f03e4099a03bc78f59a2f605e06b200a09960dc0b92de”,
“Gateway”: “”,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“MacAddress”: “”,
“DriverOpts”: null
}

“host”

I believe this is why. I can’t seem to find the actual doc, but the docker stats subcommand doesn’t report network usage with host networking. There is one inline comment about this as well.

You can try this yourself by launching two containers, one with host and one with bridge. Run wget or apt update or yum update or something to generate some traffic on each. Then run docker stats. The host networking container will still show 0B/0B for stats, while the bridge one will not.

@jpowers Dang it. Thanks for flushing this out with me. I’ll see what other options we have. Host network was a choice by developer, said he was having UDP issues and switched to host network.