ualex73 / monitor_docker

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

Home assistant log error #76

Closed legolas0802 closed 1 month ago

legolas0802 commented 2 years ago

I am on home assistant supervisor and I use the proxy container as per instructions, in the log I find the following error:

Source: custom_components/monitor_docker/helpers.py:268
Integration: Monitor Docker (documentation, issues)
First occurred: 17:51:55 (1 occurrences)
Last logged: 17:51:55

[Docker]: run_docker_events loop ended 

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:586
Integration: Sensore (documentation, issues)
First occurred: 18:02:11 (7 occurrences)
Last logged: 18:02:11

Entity id already exists - ignoring: sensor.docker_containers_total
Entity id already exists - ignoring: sensor.docker_containers_stopped
Entity id already exists - ignoring: sensor.docker_1cpu
Entity id already exists - ignoring: sensor.docker_memory
Entity id already exists - ignoring: sensor.docker_images

with the consequence that those entities disappear for all containers, to see them reappear after a few minutes. All in an infinite cycle.

ualex73 commented 2 years ago

Does it happen every 10 minutes? It is possible the proxy container closes that connection every 10 minutes ... is that something you can check? I myself I am not using the proxy container and it looks like you are the first seeing this problem.

legolas0802 commented 2 years ago

I check and let you know, but if the container closes the connection, shouldn't all the entities disappear? general docker information and switches remain there and are fully functional

legolas0802 commented 2 years ago

i checked and it happens every 10 minutes

ualex73 commented 2 years ago

Ok, confirmed: https://github.com/Tecnativa/docker-socket-proxy/blob/master/haproxy.cfg

It has: timeout client 10m timeout server 10m

Your connection which closes, is the docker event thread ... so it only gets traffic when a container stops, starts, etc

You can download the haproxy.cfg from the GitHub link (above), modify it (e.g. 10min to 60min), and mount it inside the container.

ualex73 commented 2 years ago

Other option could be: configure a container with "health" check, this should generate event traffic. I cannot do this from monitor_docker.

btw if you run "docker events" you can see the events push from docker on the screen.

legolas0802 commented 2 years ago

I tried to increase the container time to 60 minutes, for both the client and the server. The problem is only postponed

legolas0802 commented 2 years ago

I did another test, deleting the entries: timeout client 10m timeout server 10m the problem no longer arises.

ualex73 commented 2 years ago

I am not sure you do not get any "docker events", because those should keep the connection open (aka alive). But thanks for further testing, I will add your fix to the README.

clipse2004 commented 2 years ago

sorry if the question is rather stupid, but I have the same problem. however, my docker knowledge is quite poor, can I edit the haproxy via portainer? if not, can you help me how to get these two lines out?

Thanks a lot!

legolas0802 commented 2 years ago

scusate se la domanda è un po' stupida, ma ho lo stesso problema. tuttavia, la mia conoscenza della finestra mobile è piuttosto scarsa, posso modificare l'haproxy tramite portainer? se no, puoi aiutarmi come ottenere queste due righe?

Molte grazie!

through portainer enter the console of the proxi container in / bin / sh mode, move to the path usr / local / etc / haproxy / haproxy.cfg and with the command "vi" edit the file

zhuykovkb commented 2 years ago

guys, is deleting lines timeout client, timeout server

a true workaround solution? I'm using docker-socket over tcp connection and got the same problem with ha logs

ualex73 commented 1 month ago

I will close this old issue. If still persists, please open a new issue.