ualex73 / monitor_docker

Monitor Docker containers from Home Assistant
Apache License 2.0
301 stars 37 forks source link

Remote host not reconnecting after power off #103

Open Londoneye02 opened 2 years ago

Londoneye02 commented 2 years ago

I have a installation made on a raspberry which is monitoring both the raspberry itself and also a remote host running Debian

Bellow is the configuration

- name: Docker_Raspberry
  containers:
     - pihole
     - nginx_manager
     - duplicati
     - grafana
     - homer
  rename:
    pihole: PiHole
    nginx_manager: Nginx Proxy Manager
    duplicati: Duplicati
    grafana: Grafana
    homer: Homer

  monitored_conditions:
    - version
    - containers_running
    - containers_total
    - state
    - status
    - memory
    - network_total_up

- name: Docker_DebianServer
  url: tcp://192.168.1.117:2375
  containers:
     - jellyfin 
  rename:
    jellyfin: Jellyfin

  monitored_conditions:
   - version
   - containers_running
   - containers_total
   - state
   - status
   - memory
   - network_total_up
   - network_speed_up
   - network_speed_down

It works fine if I start the raspberry after the Debian Server. But if I turn off the remote server, It does not receive any data from It when it comes back live.

Screenshot_20220615-182042-183

Is it the normal behaviour, or do I have anything wrong on the configuration?? Most of the times, it does not work. In a very few occasion, it works

Thank you for your time

ualex73 commented 5 months ago

I will test this soon, I am not also not sure what the behavior should be (I dependent on the underlying library).

RK62 commented 4 months ago

Same on my system. When the remote docker_proxy restarts, the integration will lost the connection and I have to restart Home Assistant to renable ist:

2024-07-06 10:19:15.279 ERROR (MainThread) [custom_components.monitor_docker.helpers] [xxxxx] bitwarden: Container not available anymore (3a) (DockerError(900, 'Cannot connect to Docker Engine via tcp://xxxxx.lan:2375 [Server disconnected]'))
2024-07-06 10:19:15.280 ERROR (MainThread) [custom_components.monitor_docker.helpers] [xxxxx] dockerproxy_xxxxx: Container not available anymore (3a) (DockerError(900, 'Cannot connect to Docker Engine via tcp://xxxxx.lan:2375 [Server disconnected]'))
2024-07-06 10:19:18.149 ERROR (MainThread) [custom_components.monitor_docker.helpers] [xxxxx]: run_docker_events loop ended
2024-07-06 10:20:21.219 ERROR (MainThread) [custom_components.monitor_docker.helpers] [xxxxx]: Trying to get a not existing container adminer
2024-07-06 10:20:21.219 ERROR (MainThread) [custom_components.monitor_docker.switch] Service restart failed, container 'adminer'does not exist 
ualex73 commented 4 months ago

@RK62 this is also with v1.19?

RK62 commented 4 months ago

@ualex73 Yes, I installed & try it today with...

nobodyspecial commented 4 months ago

I can confirm this. The monitor_docker component never attempts to reconnect to a remote host if it loses the connection.

Is there any way to restart the component without restarting home assistant?

sstratoti commented 3 months ago

I'm seeing this as well. If it loses connection it can't seem to re-establish, even though it is running. Restart of HA fixes it temporarily, and then I see errors again and lose current status.

ualex73 commented 3 months ago

I am aware of the issue, still investigating how we can make it work (the problem is a bit in the underlying library I use)

sstratoti commented 3 months ago

Sounds like you're on it, but I ust wanted to add - tried increasing my timeout through haproxy.cfg file mapped into tecnativa/docker-socket-proxy. Increased the timeouts to 1m with the same issue.

Thank you for looking into this!

Also I think tecnativa/docker-socket-proxy recently (last few weeks) updated to haproxy 3.0 in their main branch? Not sure if that matters either.