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

docker_ error for memory #1447

Open
msgrt opened this issue Aug 21, 2024 · 4 comments
Open

docker_ error for memory #1447

msgrt opened this issue Aug 21, 2024 · 4 comments

Comments

@msgrt
Copy link

msgrt commented Aug 21, 2024

docker_ plugin stops the execution in the memory section with the following error:

multigraph docker_memory
Traceback (most recent call last):
  File "/etc/munin/plugins/docker_multi", line 579, in <module>
    main()
  File "/etc/munin/plugins/docker_multi", line 572, in main
    globals()[s](client, mode)
  File "/etc/munin/plugins/docker_multi", line 519, in memory
    print_containers_memory(client)
  File "/etc/munin/plugins/docker_multi", line 317, in print_containers_memory
    memory_usage = stats['memory_stats']['usage']
                   ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'usage'

Raspberry OS/Debian Bookworm
Docker CE 27.1.2
Python 3.11.2

Any ideas how to get this to work?

@kenyon
Copy link
Member

kenyon commented Aug 21, 2024

I'd guess that the Docker API doesn't provide the usage key anymore. You could debug this by printing the value of stats inside print_containers_memory.

@kenyon
Copy link
Member

kenyon commented Aug 21, 2024

Although, I see in the API docs that there should be a usage key, so 🤷 https://docs.docker.com/engine/api/v1.46/#tag/Container/operation/ContainerStats

@kenyon
Copy link
Member

kenyon commented Aug 21, 2024

You can see what the Docker API is providing like this:

curl --unix-socket /var/run/docker.sock http://localhost/v1.46/containers/<container ID>/stats | jq --color-output .

@msgrt
Copy link
Author

msgrt commented Aug 22, 2024

Thank you very much @kenyon .
Unfortunately no usage values here. I have tested with all the containers I have running.
The last 4 values given in the example in the documentation (max_usage, usage, failcnt, limit) are missing for me.

  "memory_stats": {
    "stats": {
      "active_anon": 0,
      "active_file": 0,
      "anon": 0,
      "anon_thp": 0,
      "file": 0,
      "file_dirty": 0,
      "file_mapped": 0,
      "file_writeback": 0,
      "inactive_anon": 0,
      "inactive_file": 0,
      "kernel_stack": 0,
      "pgactivate": 0,
      "pgdeactivate": 0,
      "pgfault": 0,
      "pglazyfree": 0,
      "pglazyfreed": 0,
      "pgmajfault": 0,
      "pgrefill": 0,
      "pgscan": 0,
      "pgsteal": 0,
      "shmem": 0,
      "slab": 0,
      "slab_reclaimable": 0,
      "slab_unreclaimable": 0,
      "sock": 0,
      "thp_collapse_alloc": 0,
      "thp_fault_alloc": 0,
      "unevictable": 0,
      "workingset_activate": 0,
      "workingset_nodereclaim": 0,
      "workingset_refault": 0
    }
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants