Closed LordShadowen closed 3 years ago
The number of (online) CPUs is available, so I did such simple divide option. A new option "containers_1cpu_percentage" is now available. I just push the commit to the repository, but it is not available in HACS yet (maybe next week?)
Just released version 1.2, should be available in 5-6 hours in HACS.
Just tried it. The main "sensor.docker_1cpu" seems to be working great, but all the individual container _1cpu sensors are returning "unknown". Any idea why?
I included partially the code for "container_1cpu", but I need to add a bit more code to make it work (the number of CPUs is unavailable in a container, only in the overall docker sensor). Currently it will give None/Unknown.
It should be working per container too, please verify - then we can close this one ;-)
Yes, seems to work fine :)
ok, then we can close it ;-)
Currently the CPU usage is being reported as % of a single core (also known as the Irix mode on Linux). This is actually the same thing that docker stats reports, so it's "correct".
However, other Docker monitoring systems (like the one from Synology) report on the Solaris mode, where is a percentage of total core availability. So, for example, a container reporting 36% usage on a 12-core system is reported as only 3%
I prefer the Solaris mode (more intuitive) and makes for nice graphs in Home Assistant :) Any way this could be a config option? I don't know if there is any way to get this directly out of Docker, but a quick and dirty way would be to just divide by number of cores on the host.