DEV Community

Cover image for Lightweight Container Monitoring: Setting up Beszel on Podman
Project-42
Project-42

Posted on

Lightweight Container Monitoring: Setting up Beszel on Podman

I have recently discovered a nice and lightweight monitoring tool that give you an overview of podman container status, so decided to give it a try

1. Beszel hub deployment

Create volumes folder destination and quadlet file for the beszel_hub



[|=| raspi in ~ ]$ mkdir -p /home/solifugo/pods/beszel/beszel_data
[|=| raspi in ~ ]$ mkdir -p /home/solifugo/pods/beszel/beszel_socket
[|=| raspi in ~ ]$
[|=| raspi in ~/pods ]$ cat ~/.config/containers/systemd/beszel_hub.container
[Unit]
Description=beszel hub

[Container]
Image=docker.io/henrygd/beszel
ContainerName=beszel_hub
AutoUpdate=registry
Volume=/home/solifugo/pods/beszel/beszel_data:/beszel_data
Volume=/home/solifugo/pods/beszel/beszel_socket:/beszel_socket
PublishPort=8090:8090

[Service]
Restart=unless-stopped

[Install]
WantedBy=multi-user.target default.target

[|=| raspi in ~/pods ]$
Enter fullscreen mode Exit fullscreen mode

We need to start beszel_hub in order to create the Admin user and capture some details for the Agent:

[|=| raspi in ~ ]$ systemctl --user daemon-reload
[|=| raspi in ~ ]$ systemctl --user start beszel_hub.service
[|=| raspi in ~ ]$ podman ps
CONTAINER ID  IMAGE                             COMMAND               CREATED         STATUS                   PORTS                   NAMES
641ede03f72a  docker.io/henrygd/beszel:latest   serve --http=0.0....  3 minutes ago   Up 3 minutes             0.0.0.0:8090->8090/tcp  beszel_hub
c01b90706e13  docker.io/library/mariadb:latest  --default-authent...  24 seconds ago  Up 24 seconds            0.0.0.0:3306->3306/tcp  mariadb
d03052aaf5b5  localhost:5000/p42_wordpress:v1   apache2-foregroun...  24 seconds ago  Up 23 seconds (healthy)  0.0.0.0:8042->80/tcp    systemd-wordpress

[|=| raspi in ~ ]$
Enter fullscreen mode Exit fullscreen mode

Once we have entered the system, select "+ Add System" and we add the name of the monitored system and in this case, since the agent is local to the hub, we will add /beszel_socket/beszel.sock to the "Host / IP" field

01 Beszel hub -  login
02 Beszel hub -  add system

Remember to copy both the Public Key and Token which will be needed to configure the Agent container

2. Beszel agent deployment (local)

Create volumes folder destination and quadlet file for the beszel_agent.

We need to make sure we add the volumen for podman socket (double check the user id which own it, in our case is 1001)

We also add the volume for the beszel_socket (since is local Agent)

After that, add to the Environment Public Key and Token and since this is local Agent, we need to add LISTEN=/beszel_socket/beszel.sock
(More information in Beszel website on this: https://beszel.dev/guide/common-issues#connecting-hub-and-agent-on-the-same-system-using-docker)

[|=| raspi in ~ ]$ mkdir -p /home/solifugo/pods/beszel/beszel_agent_data
[|=| raspi in ~ ]$
[|=| raspi in ~ ]$ cat ~/.config/containers/systemd/beszel_agent.container
[Unit]
Description=beszel agent

[Container]
Image=docker.io/henrygd/beszel-agent:latest
ContainerName=beszel_agent
AutoUpdate=registry
User=1001
Volume=/run/user/1001/podman/podman.sock:/run/user/1001/podman/podman.sock:ro
Volume=/home/solifugo/pods/beszel/beszel_agent_data:/var/lib/beszel-agent
Volume=/home/solifugo/pods/beszel/beszel_socket:/beszel_socket
Environment=KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOgfG4iXqHmqcYT/LhNQvgNCRA0HIIxEHjnk79rg+ypF" HUB_URL="http://localhost:8090" TOKEN="5f2b-126b3d08f8-a8dd-e796537cf8" LISTEN=/beszel_socket/beszel.sock
Network=host

[Service]
Restart=unless-stopped

[Install]
WantedBy=multi-user.target default.target

[|=| raspi in ~ ]$

[|=| raspi in ~ ]$ systemctl --user daemon-reload
[|=| raspi in ~ ]$ systemctl --user start beszel_agent.service
[|=| raspi in ~ ]$ podman ps
CONTAINER ID  IMAGE                                  COMMAND               CREATED         STATUS                   PORTS                   NAMES
641ede03f72a  docker.io/henrygd/beszel:latest        serve --http=0.0....  18 minutes ago  Up 18 minutes            0.0.0.0:8090->8090/tcp  beszel_hub
c01b90706e13  docker.io/library/mariadb:latest       --default-authent...  15 minutes ago  Up 15 minutes            0.0.0.0:3306->3306/tcp  mariadb
d03052aaf5b5  localhost:5000/p42_wordpress:v1        apache2-foregroun...  15 minutes ago  Up 15 minutes (healthy)  0.0.0.0:8042->80/tcp    systemd-wordpress
5dd1a629b6bb  docker.io/henrygd/beszel-agent:latest                        16 seconds ago  Up 16 seconds                                    beszel_agent

[|=| raspi in ~ ]$
Enter fullscreen mode Exit fullscreen mode

Once we start the Agent, we should just click Add system in the Hub and we should see the system

03 Beszel hub -  raspi added 03

3. Beszel agent deployment (remote)

If we are adding a remote Agent, we just specify IP/port instead of the Unix socket (beszel.sock)

04 Beszel hub -  adding chromebook

[|=| penguin in ~ ]$ podman run -d   --name beszel-agent  \
--user 1000   --network host   --restart unless-stopped  \
 -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro   \
 -e KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOgfG4iXqHmqcYT/LhNQvgNCRA0HIIxEHjnk79rg+ypF"  \
 -e HUB_URL="http://192.168.0.130:8090"   \
 -e TOKEN="5be-0f813ae513-27d9-83664c253c"   \
 -e LISTEN=45876   \
 docker.io/henrygd/beszel-agent:latest

463c33d4cb24aa79193375deebb0a99be86ca53f0ba4a13ce291a0d429a119c4

[|=| penguin in ~ ]$
Enter fullscreen mode Exit fullscreen mode

05 Beszel hub -  chromebook added

4. Additional Details

Make sure podman socket is running:

[|=| raspi in ~/pods ]$ systemctl --user enable podman.socket
[|=| raspi in ~/pods ]$ systemctl --user start podman.socket
[|=| raspi in ~/pods ]$ systemctl --user status podman.socket
● podman.socket - Podman API Socket
     Loaded: loaded (/usr/lib/systemd/user/podman.socket; enabled; preset: enabled)
     Active: active (listening) since Wed 2026-02-18 15:37:35 GMT; 17h ago
 Invocation: aeff63f6592d4d5d9fc3fce56f78286d
   Triggers: ● podman.service
       Docs: man:podman-system-service(1)
     Listen: /run/user/1001/podman/podman.sock (Stream)
     CGroup: /user.slice/user-1001.slice/user@1001.service/app.slice/podman.socket

[|=| raspi in ~ ]$
Enter fullscreen mode Exit fullscreen mode

For Raspberry pi, you can hit this issue when trying to get container memory stats:

Error getting container stats err="systemd-wordpress - bad memory stats - see https://github.com/henrygd/beszel/issues/144"
Error getting container stats err="mariadb - bad memory stats - see https://github.com/henrygd/beszel/issues/144"
Enter fullscreen mode Exit fullscreen mode

Solution can be find here, which is to add some componenets to firmware/cmdline.txt
https://akashrajpurohit.com/blog/resolving-missing-memory-stats-in-docker-stats-on-raspberry-pi/

[|=| raspi in ~ ]$ sudo cat /boot/cmdline.txt
console=tty1 root=PARTUUID=dc0d2f94-02 rootfstype=ext4 fsck.repair=yes rootwait cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1

[|=| raspi in ~ ]$
Enter fullscreen mode Exit fullscreen mode

If you are trying to run podman in Crostini (Chromebook Linux subsystem) you can find some help here: Setup Podman on Chrome OS Flex and Crostini.md (I had to run the Troubleshooting additional commands to get it working)

Top comments (0)