ualex73 / monitor_docker

Monitor Docker containers from Home Assistant
Apache License 2.0
268 stars 34 forks source link

Bug in reading memory usage. #36

Closed TomasSeven closed 3 years ago

TomasSeven commented 3 years ago

Installed on a supervised installation. Host OS: Ubuntu 20.04 LTS Core 0.115.5

Followed this guide : https://gist.github.com/styblope/dc55e0ad2a9848f2cc3307d4819d819f and got the tcp port working, can do a docker -H tcp://127.0.0.1:2375 ps.

Most of the sensor are working in Homeassistant but not the memory sensors.

From Homeassistant log 2020-09-29 17:29:09 ERROR (Thread-37) [custom_components.monitor_docker.helpers] hassio_dns: Cannot determine memory usage for container ('usage') 2020-09-29 17:29:09 ERROR (Thread-37) [custom_components.monitor_docker.helpers] {}: Raw 'memory_stats' hassio_dns 2020-09-29 17:29:09 ERROR (Thread-37) [custom_components.monitor_docker.helpers] homeassistant: Cannot determine memory usage for container ('usage') 2020-09-29 17:29:09 ERROR (Thread-37) [custom_components.monitor_docker.helpers] {}: Raw 'memory_stats' homeassistant 2020-09-29 17:29:09 ERROR (Thread-37) [custom_components.monitor_docker.helpers] unifi: Cannot determine memory usage for container ('usage')

ualex73 commented 3 years ago

I cannot do much about this, it looks like your docker API does not return this value. Which Docker version are you running?

ualex73 commented 3 years ago

Issue still persists?

TomasSeven commented 3 years ago

Hi, sorry. I missed the notification that you responded!

The issue is still there, can check docker version later today.

TomasSeven commented 3 years ago

Can I do a manual check if the docker does respond with the information? I do not fully understand the code, which part is failing? From the error log it seems like the script is sending wrong container name to docker when checking memory useage.

TomasSeven commented 3 years ago

Docker version 19.03.8, build afacb8b7f0

TomasSeven commented 3 years ago

Error is in my host system, docker -stats doesn´t report any memory usage.

image

Will try a few rabbit hole like this one to get it working. https://github.com/moby/moby/issues/18420

Ty for responding, and hopefully I can get my host os to support your component.

TomasSeven commented 3 years ago

So digging a bit deeper this was the solution: https://askubuntu.com/questions/1237813/enabling-memory-cgroup-in-ubuntu-20-04

" I was able to get this working by appending cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 to the file /boot/firmware/cmdline.txt. Changes made to /boot/firmware/nobtcmd.txt in Ubuntu 20.04 appear to be ignored (there's a note in config.txt about cmdline=nobtcmd.txt being deprecated in favour of include commands). "

Closing this issue. Ty for a great component!