ualex73 / monitor_docker

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

Memory Usage stats not available over TCP #64

Closed drinfernoo closed 1 month ago

drinfernoo commented 3 years ago

I have a remote Docker instance being monitored with this component, and I keep seeing these errors in my logs:

2021-05-26 21:36:49 ERROR (Thread-4) [custom_components.monitor_docker.helpers] wyzesense2mqtt: Cannot determine memory usage for container ('usage')
2021-05-26 21:36:49 ERROR (Thread-4) [custom_components.monitor_docker.helpers] wyzesense2mqtt: Raw 'memory_stats' {}

My YAML looks like:

monitor_docker:
  - name: DockerPi
    url: http://192.168.1.220:2375
    containers:
      - wyzesense2mqtt
    rename:
      wyzesense2mqtt: WyzeSense2MQTT

Also, the sensor entities (in my case, sensor.dockerpi_memory, sensor.dockerpi_memory_percent, sensor.dockerpi_wyzesense2mqtt_memory, and sensor.dockerpi_wyzesense2mqtt_memory_percent) gets created, but with an unknown state.

drinfernoo commented 3 years ago

I've actually updated my YAML to not request these statistics:

monitor_docker:
  - name: DockerPi
    url: http://192.168.1.220:2375
    monitored_conditions:
      - state
      - status
      - uptime
      - image
      - 1cpu_percentage
    containers:
      - wyzesense2mqtt
    rename:
      wyzesense2mqtt: WyzeSense2MQTT

And I'm still getting the error from my previous comment... Which makes me feel like the integration isn't respecting my new YAML?

drinfernoo commented 2 years ago

Actually, I only today noticed that there's a FAQ about getting memory stats from some platforms. After making that change on my (Raspbian) system, I no longer get the errors in my logs... but I'm still not configured to fetch the memory stats anyways, and am not getting the entities (as expected).

So, it still appears the integration is attempting to fetch memory stats even when not configured to do so.

drinfernoo commented 2 years ago

On a semi-related note, what type of changes would need to be made to make this work for a Docker container running inside of an LXC container?

ualex73 commented 2 years ago

Is v1.11 an improvement with the TCP behavior?

Docker inside LXC should work, as long the TCP port is exposed (reachable).

eyalcha commented 1 year ago

I have the same issue. I have removed memory monitoring but I get single error when home assistant starts.

2022-08-15 21:00:37.728 ERROR (Thread-3 (RunDocker)) [custom_components.monitor_docker.helpers] [Docker2] dockerproxy: Cannot determine memory usage for container ('stats')

2022-08-15 21:00:37.817 ERROR (Thread-3 (RunDocker)) [custom_components.monitor_docker.helpers] [Docker2] dockerproxy: Raw 'memory_stats' {}

@drinfernoo what change did you make on raspberry pi?

eyalcha commented 1 year ago

This solved my issue: https://github.com/ualex73/monitor_docker/issues/26#issuecomment-723016034