Monitoring your machines

A neat looking tool to monitor your selfhosting machines

I used to go with Glances for monitoring my machine's health, temperature, cpu and other miscellaneous stuff. As Glances is a real-time Htop like webui, it was hard for me to see previous events and logs. That's when I found Beszel

Beszel

Beszel monitoring

A lightweight server resource monitoring hub with historical data, docker stats, and alerts. It was really simple to setup, and came in two parts:

  • Hub - this is where all the monitoring and logging and alerts are displayed. Built on PocketBase.

  • Agent - this is the machine that logs the data.

These two are split into two docker-compose file so it's very easy to setup and install.

Installation

The easiest way to install Beszel is through docker-compose.yml file:

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

Next, we setup the agent by accessing the webui through port 8090 (or behind whatever reverse proxy you have).

After creating an account and signing in, just click on Add System.

Add a machine

Add the agent machine. Make sure your docker container has network access to the agent machine

Note: If you're monitoring the same host that the Beszel-hub is one use host.docker.internal for your Host/IP and put both agent and hub in the same docker-compose.yml file.

services:
  beszel:
    image: 'henrygd/beszel'
    container_name: 'beszel'
    restart: unless-stopped
    ports:
      - '8090:8090'
    volumes:
      - ./beszel_data:/beszel_data
    extra_hosts:
      - 'host.docker.internal:host-gateway'

  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: '...'
      # FILESYSTEM: /dev/sda1 # set to the correct filesystem for disk I/O stats

Now you should be able to see it up and running.

Configuring notifications

Settings and setup webhook

Go to settings and notifications to setup the webhook url. Test the url. After that, go back to your dashboard and click on the bell notifications to setup alerts for appropriate timings.

Setting alerts

Now you're all set!

Last updated