Publish: 2024-10-12 | Modify: 2024-10-12
Beszel is an open-source lightweight server resource monitoring tool that supports real-time monitoring of key server resources and records historical data. It presents critical metrics such as CPU, memory, and disk I/O through an intuitive interface, and also supports monitoring the operational status of Docker containers, helping users better understand container performance. Additionally, Beszel features an alert system that promptly notifies administrators of any anomalies, ensuring stable system operation. With a straightforward installation and configuration process, Beszel is well-suited for the daily monitoring needs of small and medium-sized servers.
The architecture of Beszel is a monitoring platform based on a client-server model, consisting of a Hub (central server) and Agent (proxy).
Hub (Central Server)
Agent (Proxy)
In this article, Xiaoz demonstrates how to deploy Beszel using Docker Compose, assuming you have Docker installed.
Deploying Beszel Hub
The Hub can be understood as the backend of Beszel, responsible for display/management and alerting. At least one server is required to use Beszel. Next, we will deploy the Beszel Hub using Docker Compose, with the detailed docker-compose.yaml
content as follows:
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 it. After successful startup, access the WEB page via http://IP:8090
and set an admin email and password for future use.
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 each server to monitor all servers. It is also deployed via Docker Compose, first needing to click Add System in the Beszel backend - top right.
Then fill in the server IP/port information and click the Copy docker compose button.
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
KEY
to your own.Save the above content as docker-compose.yaml
and enter the command docker-compose up -d
to start the Beszel Agent. The above yaml
configuration shows that the HOST
network mode is used, with 45876
as the port, so we also need to allow port 45876
in the firewall or security group for communication. 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 these operations, don't forget to return to the Beszel page and click the Add System button.
Then wait a few minutes, and you will see monitoring data on the page.
Another benefit of Beszel is its ability to monitor Docker container resources, which is quite impressive.
Beszel also allows you to set a dark mode.
You can also configure SMTP to send emails.
It can also monitor and alert on server metrics.
You can back up files to S3-compatible object storage. (Xiaoz is not sure whether this part is for log files or something else)
Additionally, Beszel supports API and Webhook functionalities, greatly facilitating operations and development. Interested friends can further explore.
The following are Xiaoz's personal opinions for reference only.
Advantages of Beszel
Disadvantages of Beszel
Comparison with Prometheus
Currently, Xiaoz uses the Prometheus + Grafana monitoring solution for most servers; this monitoring solution is very mature and aesthetically pleasing. Recently, after discovering Beszel, a deployment test was conducted. Each has its strengths and weaknesses; if it's for a company's production environment, I still recommend mature solutions like Prometheus or Zabbix. If it's your own server and you don't mind more detailed metrics, Beszel can fully meet the needs. Below is a personal non-professional comparison for reference.
Name/Function | Beszel | Prometheus |
---|---|---|
Installation | Simple | Difficult |
Usage | Simple | Difficult |
Monitoring Docker Containers | Default Support | Requires Extra Configuration |
Alerts | Default Support | Requires Extra Configuration |
Monitoring Metrics | General | Rich |
Monitoring Multiple Disks | General | User-friendly |
Auto Discovery | Not Supported | Supported |
Note: Beszel has very friendly support for Docker, so you can also install Beszel on your NAS device!
Beszel is an open-source tool designed for lightweight server monitoring, capable of meeting the daily monitoring needs of small and medium-sized servers through simple configuration. In a Docker environment, the deployment of Beszel is particularly convenient, supporting resource monitoring of Docker containers. Additionally, it includes alerting, data backup, and API integration features to help users respond quickly in the event of an anomaly. Although it may not compare to mature solutions like Prometheus in some advanced monitoring features, for personal servers or small projects that do not require complex configurations, Beszel remains an excellent choice.
Beszel project address: https://github.com/henrygd/beszel
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.