Closed tamimology closed 1 month ago
I'm running Monitor Docker against the docker-socket-proxy running alongside the actual HA, in the same Docker on Synology NAS. The reason why I'm using docker-socket-proxy is that it's not possible to mount /var/run/docker.sock in Synology Docker GUI. When installed and configured, all worked fine. Now checking the container statuses in HA, and HA logs, I can see the same errors as reported above:
2022-11-02 08:28:31.904 ERROR (Thread-3 (RunDocker)) [custom_components.monitor_docker.helpers] [Docker]: run_docker_info (DockerError(900, 'Cannot connect to Docker Engine via tcp://localhost:2375 [Server disconnected]')) Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiodocker/docker.py", line 248, in _do_query response = await self.session.request( File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read await self._waiter aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/monitor_docker/helpers.py", line 489, in _run_docker_info info = await self._api.system.info() File "/usr/local/lib/python3.10/site-packages/aiodocker/system.py", line 16, in info response = await self.docker._query_json("info", method="GET") File "/usr/local/lib/python3.10/site-packages/aiodocker/docker.py", line 300, in _query_json async with self._query( File "/usr/local/lib/python3.10/site-packages/aiodocker/utils.py", line 309, in aenter resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiodocker/docker.py", line 261, in _do_query raise DockerError( aiodocker.exceptions.DockerError: DockerError(900, 'Cannot connect to Docker Engine via tcp://localhost:2375 [Server disconnected]')
The dockerproxy container log doesn't show anything unusual, only lots of usual monitoring activities, such as: 172.17.0.1:48954 [02/Nov/2022:08:45:49.715] dockerfrontend dockerbackend/dockersocket 0/0/0/1048/1048 200 2240 - - ---- 3/3/1/1/0 0/0 "GET /v1.41/containers/518a8ff77ec9695cd12831726343178d07843dbfb988e615fedfdd59fa80d2be/stats?stream=0 HTTP/1.1"
The docker entities in HA seem to recover every time after a few minutes. Some monitored conditions seem to be affected more affected than others:
The only three monitored conditions which are not affected by this are version, containers_running, containers_total. All conditions recover to normal state after some time, without any intervention: 2022-11-02 09:22:06.583 INFO (MainThread) [custom_components.monitor_docker.sensor] [Docker] appdeamon: Initializing sensor with parameter: Health
I'm running Monitor Docker against the docker-socket-proxy running alongside the actual HA, in the same Docker on Synology NAS. The reason why I'm using docker-socket-proxy is that it's not possible to mount /var/run/docker.sock in Synology Docker GUI. When installed and configured, all worked fine. Now checking the container statuses in HA, and HA logs, I can see the same errors as reported above:
2022-11-02 08:28:31.904 ERROR (Thread-3 (RunDocker)) [custom_components.monitor_docker.helpers] [Docker]: run_docker_info (DockerError(900, 'Cannot connect to Docker Engine via tcp://localhost:2375 [Server disconnected]')) Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiodocker/docker.py", line 248, in _do_query response = await self.session.request( File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read await self._waiter aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/monitor_docker/helpers.py", line 489, in _run_docker_info info = await self._api.system.info() File "/usr/local/lib/python3.10/site-packages/aiodocker/system.py", line 16, in info response = await self.docker._query_json("info", method="GET") File "/usr/local/lib/python3.10/site-packages/aiodocker/docker.py", line 300, in _query_json async with self._query( File "/usr/local/lib/python3.10/site-packages/aiodocker/utils.py", line 309, in aenter resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiodocker/docker.py", line 261, in _do_query raise DockerError( aiodocker.exceptions.DockerError: DockerError(900, 'Cannot connect to Docker Engine via tcp://localhost:2375 [Server disconnected]')
The dockerproxy container log doesn't show anything unusual, only lots of usual monitoring activities, such as: 172.17.0.1:48954 [02/Nov/2022:08:45:49.715] dockerfrontend dockerbackend/dockersocket 0/0/0/1048/1048 200 2240 - - ---- 3/3/1/1/0 0/0 "GET /v1.41/containers/518a8ff77ec9695cd12831726343178d07843dbfb988e615fedfdd59fa80d2be/stats?stream=0 HTTP/1.1"
The docker entities in HA seem to recover every time after a few minutes. Some monitored conditions seem to be affected more affected than others:
The only three monitored conditions which are not affected by this are version, containers_running, containers_total. All conditions recover to normal state after some time, without any intervention: 2022-11-02 09:22:06.583 INFO (MainThread) [custom_components.monitor_docker.sensor] [Docker] appdeamon: Initializing sensor with parameter: Health
Did you find a solution?
From my HA vm to Synology dockers this docker is working. But when I run this docker on my unraid server, I have the same issues as you.
This issue still persists?
I will close this one, if it happens again, please raise a new issue.
I am running HA on docker, and have socket proxy as well, below is my compose for both:
I did test the socket by running
docker -H tcp://192.168.1.10:2375 ps
on the host machine, and got the full detailed list of all containers I am running on the machineAnd I have configured monitor_docker in HA as following:
When I boot HA, in the logs, I keep getting the below (this comes out for every single container I have, even if i did not include in the configuration to be monitored):