henrygd / beszel

Lightweight server monitoring hub with historical data, docker stats, and alerts.
MIT License
2.42k stars 73 forks source link

Error getting container stats: container_name - invalid data #144

Closed Malek-GHub closed 2 months ago

Malek-GHub commented 2 months ago

Hello

I've installed the Beszel Hub and Agent on a raspberry pi 4, with the logging Container Dozzle The Hub can see the raspberry Pi cpu, disk and memory etc,

image

however, I cannot see any container information and am getting the following error in the logs of the Beszel agent

beszel-agent logs

 2024/09/01 15:40:59 Found network interface: eth0 (5065362491 recv, 1064108764 sent)
2024/09/01 15:40:59 Starting SSH server on :45876
2024/09/01 15:41:03 Error getting container stats: beszel - invalid data
2024/09/01 15:41:03 Error getting container stats: beszel-agent - invalid data
2024/09/01 15:41:03 Error getting container stats: dozzle - invalid data
2024/09/01 15:41:56 Error getting container stats: beszel-agent - invalid data
2024/09/01 15:41:56 Error getting container stats: beszel - invalid data
2024/09/01 15:41:56 Error getting container stats: dozzle - invalid data
2024/09/01 15:42:56 Error getting container stats: beszel - invalid data
2024/09/01 15:42:56 Error getting container stats: beszel-agent - invalid data

This is my docker compose , and env file. I know this is insecure but I just wanted it to work like this first before installing the socketproxy... Any Ideas would be greatly appreciated..

docker-compose.yaml

services:  
   beszel:
     image: henrygd/beszel
     container_name: beszel
     restart: unless-stopped  
     env_file:
       - malmeser.env     
     ports:
       - '8090:8090'
     volumes:
       - ./volumes/beszel/config:/beszel_data

   beszel-agent:
     image: "henrygd/beszel-agent"
     container_name: "beszel-agent"
     restart: unless-stopped
     network_mode: host
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock:ro
     environment:
       PORT: 45876
       KEY: "ssh_key_here"
       FILESYSTEM: /dev/mmcblk02 # set to the correct filesystem for disk I/O stats

   dozzle: # Dozzle - Real-time Docker Log Viewer
     image: amir20/dozzle:latest
     container_name: dozzle
     restart: unless-stopped
     env_file:
       - malmeser.env
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock:ro # Mounted as read-only       
     ports:
       - 7070:8080
malmeser.env

# Common variables
PUID=1000
PGID=1000
TZ=Europe/Madrid

#Dozzle Specific variables
DOZZLE_LEVEL=info
DOZZLE_FILTER="status=running"
DOZZLE_HOSTNAME=Malmeser
DOZZLE_ENABLE_ACTIONS=true
#DOZZLE_REMOTE_HOST=  #add comma for more hosts
#DOZZLE_FILTER: "label=log_me" # limits logs displayed to containers with this label      
henrygd commented 2 months ago

Hi, you probably need to enable cgroups memory accounting.

It's an easy fix. See this article:

https://akashrajpurohit.com/blog/resolving-missing-memory-stats-in-docker-stats-on-raspberry-pi/

I'll add this info to the readme next time I update it.

Malek-GHub commented 2 months ago

That was it! I'm now getting docker cpu readings from the individual containers and no log errors anymore! image

Thank you for the help!!

henrygd commented 2 months ago

No problem!

lephtHanded commented 2 months ago

thanks, just found this.