ualex73 / monitor_docker

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

Monitored conditions no longer created if not explicitly listed #148

Closed squirtbrnr closed 1 month ago

squirtbrnr commented 1 month ago

Two issues: The configuration options states the parameter monitored_conditions which is a list of container conditions to monitor is optional. If not listed, it defaults to all conditions. Under 1.14 and older this means all of the conditions were created as individual sensors. But under 1.16 (and possibly 1.15) none of the sensors are created. I needed to change my yaml config to now include the monitored_conditions parameter and list the ones that I wanted in order to get the individual sensors back. Something in code may need to be fixed so all sensors are created like they were before if monitored_conditions is not used. Or maybe the config readme needs to be updated to state that if monitored_conditions is not used, no individual sensors are created

The allinone sensor with multiple attributes is created at all times regardless if it is or is not listed in the monitored_conditions list.

1.14 yaml config which created all the individual sensors:

monitor_docker:
  - name: Docker
    url: unix://var/run/docker.sock
    containers:
      - homeassistant
      - mariadb
    rename:
      homeassistant: Home Assistant
      mariadb: MariaDB
  - name: RPi0W
    url: tcp://192.168.1.90:2375
    containers:
      - zwavejsui
    rename:
      zwavejsui: ZwaveJSUI

1.16 yaml I needed to add to get the sensors back:

    monitored_conditions:
      - state
      - status
      - health
      - uptime
      - image
      - cpu_percentage
      - 1cpu_percentage
      - memory
      - memory_percentage
      - network_speed_up
      - network_speed_down
      - network_total_up
      - network_total_down
ualex73 commented 1 month ago

Thanks for reporting, I will try to reproduce the issues here.

bobbinz commented 1 month ago

I also have the same issue - all my sensors are now unavailable after update to 1.16. I had none listed and it defaulted to all. Not I have zero,

ualex73 commented 1 month ago

Can you try the latest master in the repo? The issue should be fixed now, but requires more testing.

Headkillah commented 1 month ago

For me it works with 1.16 with "allinone"

bobbinz commented 1 month ago

Works as it did before without explicitly listing conditions to monitor

ualex73 commented 1 month ago

Thanks for confirming, I will close the issue now