System monitoring for docker installation

I’m running HA in a docker env on my Pi.
What’s the best way to do system monitoring including monitoring the docker containers?

  • The systemmonitor sensor platform unfortunately does not know the containers and the filesize sensor can’t watch files on the host itself (outside the /config path).
  • Glances knows containers, but adds 5% CPU usage just for monitoring.
    (And my HA does not recognize the glance platform. In the log I see Platform glances not ready yet although I can open the glances web site)
  • fritzbox_netmonitor to have more details of network stuff.
    Does this provide further info not included in other sensors but useful?
  • speedtest produces a lot of network traffic just for monitoring. Useful? Cheaper options?
  • HA-Dockermon: Start/Stop containers. More?
  • (Someone using a Western Digital NAS and monitoring this, too?)

Whats the goal of your system monitoring? What are you trying to monitor or be alerted to?

At the beginning just have an eye on the system.
Alerts maybe later.

  • Are the containers running and healthy?
  • Figure out, what causes swap sometime to go to 98% usage?
  • Database file size
  • Is the Pi healthy or maybe should it be rebooted?
  • Why and when does the WD fan is on?
  • Up- and Download speed of my DSL connection.
  • Disk usage

Use portainer and hadockermon.

File size sensor will work for this https://www.home-assistant.io/components/filesize/

What constitutes ‘healthy’? A lot of things could be pegged to almost full load and the system could be running exactly as expected.

Use speedtest. Yes it creates a lot of network traffic. You can limit when or how often it runs.

Use https://www.home-assistant.io/components/filesize/. Specifically the disk_use_percent, disk_use , disk_free options.

Thanks for your suggestions.

Someone using another option to check the DSL quality producing less traffic?

The description does not know those parameters.
Beside this, this sensor can’t watch file not in /config…

No way to get filesize of files outside /config folder?

Tried with command sensor, but seems that those also do not see the files outside /config.

  - platform: command_line
    name: A_File_Size
    command: "du -m /home/pi/example.jpg | cut -f1"
    unit_of_measurement: 'MB'
    value_template: '{{ value | int }}

But this command sensor does work, although it reads a file outside /config:

  - platform: command_line
    name: cCPU Temperature           # CPU Temperatur in °C
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"       # If errors occur, remove degree symbol
    value_template: '{{ value | multiply(0.001) | round(1) }}'

You can access stuff outside of /config because docker links them by itself (system stuff often gets linked because programs use it). If you want to monitor the whole hard drive or whatever you have, you’ll need to ‘mount’/link your drive’s root directory (/) into the container and then monitor that with HA. You could mount it wherever you want, just be sure to not overwrite stuff. Try: /srv/drive or so, that should be free

You should map your system drives as read only. If you use docker-compose just add this under volumes

- /host:/:ro

If you just want to check free space on filesystem you can use this instead

- /dev/sdaX:/drives/sdaX:ro

Notice that your device name and partition may change so set it as your system

You can check free space pointing to /drives/sdaX