ualex73 / monitor_docker

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

Memory percent not calculated : Unknown #47

Closed sybux closed 3 years ago

sybux commented 3 years ago

Hi, just running a fresh install of HA and monitor_docker. All sensors are well returned except memory pct which has a value of unknown. I'm running hass version 0.118.3 Monitor_docker : 1.5 Docker version 19.03.13, build 4484c46

Don't hesitate to request more info if you can't reproduce from your side.

ualex73 commented 3 years ago

Does "docker stats" show the right information?

sybux commented 3 years ago

you're right, docker stats display 0b / 0b and 0.0% Mem so I think it's more a docker problem than a plug-in problem !

Jsut updated to version 19.03.14 of docker but still no value for memory usage

sybux commented 3 years ago

ok so as you point me to a way to debug, I've been able to debug and resolve the issue.

So for other people in my situation. If you're running docker on a Rasperry Pi 3 ou 4 and memory stats are not displayed, first check this command : docker info. you should have the following line : WARNING: No memory limit support

cat /proc/cgroups | column -t

you should get something like this :

subsys_name hierarchy num_cgroups enabled

cpuset 10 10 1 cpu 6 45 1 cpuacct 6 45 1 blkio 4 45 1 memory 8 87 0 devices 9 45 1 freezer 3 10 1 net_cls 5 10 1 perf_event 2 10 1 net_prio 5 10 1 pids 7 49 1

If Memory is 0 enabled you should apply this patch to your /boot/cmdline.txt by adding : cgroup_memory=1 cgroup_enable=memory

after rebooting you should have memory usage in docker stats