Beszel: A Lightweight Open-Source Server Monitoring Tool - Docker Installation Guide

beszeldocker server monitoringlightweight monitoring toolserver resource monitoringbeszel tutorial
Published·Modified·

Beszel is an open-source lightweight server resource monitoring tool that supports real-time monitoring of key server resources and records historical data. It displays critical metrics such as CPU, memory, and disk I/O through an intuitive interface, and also supports monitoring the runtime status of Docker containers, helping users better understand container performance. Additionally, Beszel features alerting capabilities to notify administrators of system anomalies in a timely manner, ensuring stable system operation. With its simple installation and configuration process, Beszel is ideal for daily monitoring needs of small to medium-sized servers.

3d198574915e7ce3.png

Beszel Features

  • Lightweight: Smaller and consumes fewer resources than mainstream solutions.
  • Simple: Easy to set up and does not need to be exposed to the public internet.
  • Docker Statistics: Tracks historical CPU, memory, and network usage for each container.
  • Alerts: Configurable alerting for CPU, memory, disk usage, and system status.
  • Multi-user: Each user manages their own systems; administrators can share systems with other users.
  • OAuth / OIDC: Supports multiple OAuth2 providers and allows disabling password authentication.
  • Automatic Backup: Data can be saved to disk or S3-compatible storage with support for restoration.
  • REST API: Allows scripts and applications to use or update data.

Beszel Architecture

Beszel's architecture is a client-server based monitoring platform consisting of a Hub (central server) and an Agent (proxy).

Hub (Central Server)

  • Function: The Hub acts as the central server for Beszel, aggregating and displaying monitoring data. It receives data from multiple systems and displays server resource usage on the interface, such as historical data for CPU, memory, and disk I/O.
  • Deployment: Can run as a single binary or Docker container. The Hub does not need to be exposed to the public internet, enhancing security.

Agent (Proxy)

  • Function: The Agent is a lightweight program installed on the monitored system. It collects server resource usage and sends data to the Hub. The Agent also supports monitoring Docker containers, tracking CPU, memory, and network usage.
  • Deployment: The Agent can be installed via Docker container or a single binary file, supporting configuration of multiple file systems and network interfaces through simple environment variables.

Deploying Beszel with Docker

This article uses Docker Compose to deploy Beszel as a demonstration, assuming you have Docker already installed.

Deploying Beszel Hub

The Hub can be understood as the backend of Beszel, responsible for display, management, and alerting. At least one server-side instance is required. Below is the detailed docker-compose.yaml content for deploying Beszel Hub via Docker Compose:

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

Then use docker-compose up -d to start. After successful startup, access the web page via http://IP:8090 and set an administrator email and password for future use.

6c1486101b5084e4.png

Deploying Beszel Agent

The Agent acts as the client for Beszel, responsible for collecting data and reporting it to the Hub (server). We need to install the Agent on every server to monitor all servers. Deployment is also done via Docker Compose. First, go to the Beszel Dashboard - Click Add System in the top right corner.

eac6a04be86101b5084e4.png

Then fill in the server IP/port information, and click the Copy docker compose button.

c9c802a1c9d5fe79.png

This will automatically generate the docker-compose.yaml content in the following format:

services:
  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
      # monitor other disks / partitions by mounting a folder in /extra-filesystems
      # - /mnt/disk1/.beszel:/extra-filesystems/disk1:ro
    environment:
      PORT: 45876
      KEY: "ssh-ed25519 xxx"
      # FILESYSTEM: /dev/sda1 # override the root partition / device for disk I/O stats
  • Note: Please change the KEY to your own.

Save the above content as docker-compose.yaml and run the command docker-compose up -d to start the Beszel Agent. As seen in the YAML configuration above, the HOST network mode is used, and port 45876 is used. Therefore, you must also allow port 45876 in the firewall or security group, otherwise communication will fail. The method is as follows:

# If using firewalld
firewall-cmd --zone=public --add-port=45876/tcp --permanent
firewall-cmd --reload
# If using ufw
ufw allow 45876

After completing the operation, do not forget to return to the Beszel page and click the Add System button.

875dbcd799b2f7f4.png

Then wait a few minutes, and you will see the monitoring data on the page.

3bd0148f9899dde1.png

Beszel also has the benefit of monitoring Docker container resources, which is very useful.

1cb0b30884ed52b6.png

Other Features

Beszel also supports setting a dark mode.

0cbf25e5ab12c9ae.png

You can also configure SMTP to send emails.

d517660674a67de5.png

You can also set up alerts for server metrics.

e09f1d411951d555.png

You can also back up files to S3 protocol object storage. (The author is not sure if this part is for log files or something else).

1b8b491857e1d53c.png

At the same time, Beszel supports API and Webhook features, greatly facilitating operations and development personnel. Interested friends can further explore this.

Pros and Cons of Beszel

The following are the author's personal opinions for reference only.

Beszel Pros

  • Relatively simple installation
  • Lightweight and concise, meets basic monitoring needs
  • Supports Docker container resource monitoring

Beszel Cons

  • Interface does not support Chinese
  • Servers cannot be modified after addition; if modification is needed, they must be deleted and re-added
  • Not very friendly to servers with multiple disks
  • Monitoring metrics are not detailed enough, e.g., cannot monitor server network connection counts

Comparison with Prometheus

Currently, the author uses the Prometheus + Grafana monitoring solution for most servers. This solution is very mature and beautiful. After recently discovering Beszel and testing it, both have their pros and cons. For company production environments, the author still recommends mature solutions like Prometheus or Zabbix. For personal servers where more detailed metrics are not a concern, Beszel can fully meet the needs. The following is a non-professional comparison organized by the author for reference only.

Name/Feature Beszel Prometheus
Installation Simple Difficult
Usage Simple Difficult
Monitor Docker Containers Default Support Requires extra configuration
Alerts Default Support Requires extra configuration
Monitoring Metrics Average Rich
Monitor Multiple Disks Average Friendly
Auto Discovery Not Supported Supported

Note: Beszel is very friendly to Docker support, so you can also install Beszel on your NAS device!

Conclusion

Beszel is an open-source tool designed for lightweight server monitoring that can meet the daily monitoring needs of small to medium-sized servers through simple configuration. In a Docker environment, Beszel deployment is particularly convenient and supports monitoring Docker container resources. It also features alerting, data backup, and API integration, helping users respond quickly to abnormal situations. Although it may not match mature solutions like Prometheus in advanced monitoring functions, Beszel remains an excellent choice for personal servers or small projects that do not require complex configuration.

Beszel Project Address: https://github.com/henrygd/beszel