Projects/Gatus Service Monitoring
Monitoring

Gatus Service Monitoring

16 website/machine/tunnel availability checks with automatic alerting on anomalies and a publicly viewable status page.

What This Is

Gatus is a lightweight service monitor I run in my home lab. It is deployed on my Minecraft server (192.168.50.223, Ubuntu + CasaOS), listens on :8088, and its configuration file is located at /opt/gatus/config/config.yaml. It currently has 16 checks running.

Why I Built It

There are now three devices at home: this server xiejun-web (192.168.50.164, Debian 13), a Windows 11 computer (192.168.50.155), and the Minecraft server (192.168.50.223). These also host 9 Docker containers, a Bedrock server (19132/udp), a web-based world map (:8081), the CasaOS panel, and a Tailscale tunnel.

Previously, troubleshooting relied entirely on manual ping and SSHing into each machine to check. Problems were often only discovered "when using it." Once there are more things, manual inspection is no longer realistic.

What Problem It Solves

Gatus consolidates these checks into a single YAML file: websites use HTTP to check status codes, response content, and response time; machines use ICMP to check whether the host is still alive; and the tunnel and externally exposed services each have an endpoint. Alerts are triggered when conditions are not met, so I do not need to watch it. The status page is publicly accessible, so when I am away, I can open a browser to confirm whether a service is down without first connecting to the intranet.

Current Status

Running. The 16 checks cover three categories: websites, machines, and the tunnel, and anomaly alerts are connected. Later I want to add finer-grained items such as disk space and certificate expiry.

Features

  • 一份 YAML 定义全部端点,网站走 HTTP、机器走 ICMP、隧道单独一条
  • 用 conditions 判断状态码、响应内容和响应时间,而不是只看端口通不通
  • 条件不满足自动告警,不用人工盯着面板
  • 状态页对外可访问,离开内网也能看整体健康度
  • 覆盖 16 项检查,横跨三台设备和对外服务

Stack: Gatus · Docker · YAML · HTTP · ICMP · CasaOS · Tailscale

Deployment Steps

1. Create directories

mkdir -p /opt/gatus/config && cd /opt/gatus

2. Write the configuration config/config.yaml (the example below; replace endpoints with your own devices):

endpoints:
  - name: xiejun-web
    group: 机器
    url: "icmp://192.168.50.164"
    interval: 60s
    conditions:
      - "[CONNECTED] == true"

  - name: 世界地图
    group: 网站
    url: "http://192.168.50.223:8081"
    interval: 60s
    conditions:
      - "[STATUS] == 200"
      - "[RESPONSE_TIME] < 1500"

There are only three key points: url determines which protocol is used for probing (http://, https://, icmp://, tcp://), interval determines the frequency, and conditions determines what counts as healthy. Don't just check that the port is reachable; include status codes or response content where possible, otherwise false positives are easy.

3. Start the container

services:
  gatus:
    image: twinproduction/gatus:latest
    container_name: gatus
    restart: unless-stopped
    ports:
      - "8088:8080"
    volumes:
      - ./config:/config

Run docker compose up -d, then visit http://<host IP>:8088 to see the status page.

4. Add alerting

Add alerting to the configuration, pointing to your own webhook or email channel:

alerting:
  custom:
    url: "https://example.com/webhook"
    default-alert:
      failure-threshold: 3
      success-threshold: 2

It is recommended not to set failure-threshold to 1; a brief network blip will trigger alerts and annoy you into turning off notifications.

5. Verification and maintenance

Restart the container after changing the configuration for it to take effect. First intentionally stop a service, confirm that the status page turns red and that alerts are received, then bring it back — monitoring that has not itself been verified is as good as none. To add endpoints later, just append an entry to endpoints; no need to touch the container.