oijkn / Docker-Raspberry-PI-Monitoring

A docker-compose stack solution for monitoring host and containers with Prometheus, Grafana, cAdvisor and NodeExporter.
MIT License
410 stars 61 forks source link

No docker data #31

Closed zangaby closed 11 months ago

zangaby commented 1 year ago

Hello, I just deployed your template and all seems fine except the docker data. I am using Client: Docker Engine - Community Version: 24.0.2 on Linux pi 6.1.21-v7l+ #1642 SMP Mon Apr 3 17:22:30 BST 2023 armv7l GNU/Linux

The only logs from the cadvisor logs are: W0613 19:39:05.043316 1 sysinfo.go:203] Nodes topology is not available, providing CPU topology W0613 19:39:05.046549 1 machine.go:65] Cannot read vendor id correctly, set empty. W0613 19:44:05.173332 1 sysinfo.go:203] Nodes topology is not available, providing CPU topology W0613 19:44:05.180616 1 machine.go:65] Cannot read vendor id correctly, set empty. W0613 19:49:05.169196 1 sysinfo.go:203] Nodes topology is not available, providing CPU topology W0613 19:49:05.172791 1 machine.go:65] Cannot read vendor id correctly, set empty. W0613 19:54:05.167764 1 sysinfo.go:203] Nodes topology is not available, providing CPU topology W0613 19:54:05.170801 1 machine.go:65] Cannot read vendor id correctly, set empty. W0613 19:59:05.168270 1 sysinfo.go:203] Nodes topology is not available, providing CPU topology W0613 19:59:05.172766 1 machine.go:65] Cannot read vendor id correctly, set empty. W0613 20:04:05.166263 1 sysinfo.go:203] Nodes topology is not available, providing CPU topology W0613 20:04:05.176903 1 machine.go:65] Cannot read vendor id correctly, set empty.

oijkn commented 11 months ago

This issue has been inactive for some time. Please let me know if it's still relevant and need attention or I will close it.

zangaby commented 11 months ago

Yes, the issue is still relevant. I assume it is related to the fact that I run docker rootless.

oijkn commented 11 months ago

You could try adding additional capabilities to the cAdvisor container to see if that resolves the issue.

  cadvisor:
    container_name: monitoring-cadvisor
    image: gcr.io/cadvisor/cadvisor:v0.47.1
    hostname: rpi-cadvisor
    restart: unless-stopped
    privileged: true
    cap_add:
      - SYS_PTRACE
      - SYS_ADMIN
    networks:
      - internal
    expose:
      - 8080
    devices:
      - /dev/kmsg
    volumes:
      - /:/rootfs:ro
      - /run/user/$(id -u)/docker.sock:/var/run/docker.sock:ro
      - /sys:/sys:ro
      - ~/.local/share/docker/:/var/lib/docker:ro
      - /dev/disk/:/dev/disk:ro
      - /etc/machine-id:/etc/machine-id:ro
zangaby commented 11 months ago

Thanks, unfortunately I ran into this error:

docker-compose up --force-recreate -d ERROR: Invalid interpolation format for "volumes" option in service "cadvisor": "/run/user/$(id -u)/docker.sock:/var/run/docker.sock:ro"

oijkn commented 11 months ago

The error you're encountering is due to the use of shell interpolation ($(id -u)) in your Docker Compose file, which is not directly supported. You can work around this by using an environment variable. Modify your Docker Compose file as follows:

volumes:
  - /run/user/${UID}/docker.sock:/var/run/docker.sock:ro

Then set the UID environment variable before running docker-compose up:

export UID=$(id -u)
docker-compose up --force-recreate -d
zangaby commented 11 months ago

As a regular user it seems not to work. export UID=$(id -u) -bash: UID: readonly variable I tried adding the actual UID on that line and now most of the data on the dashboard is populated, only I/O RX/TX FS is missing.

oijkn commented 11 months ago

I'm glad I've helped you, keep looking in this direction for the rest :)

zangaby commented 11 months ago

Thanks a lot for your help !