部署轻量私有化服务监控Gatus

本文最后更新于 196 天前, 如有失效请评论区留言.

类似Uptime Kuma, 可以视为其相似替代品,目前唯一不足的地方不支持可视化部署。本文主要记录部署和使用。

项目地址

TwiN/gatus

功能

  • 高度灵活的运行状况检查条件
  • 配置简单
  • 丰富的告警方式
  • 低耗
  • 徽章
  • 服务可用性动态
  • 存储类型多样化

不足

这里简单说下我在使用过程中遇到不足的地方

  • 不支持可视化编辑
  • endpoints.name或group不支持中文, 这里踩了不少坑😂

部署

这次我没在k8s上部署,找了台吃灰的小鸡跑着哈哈哈

docker部署服务端

version: '2'

services:
  gatus:
    image: twinproduction/gatus:latest
    container_name: gatus
    ports:
      - "8080:8080"
    volumes:
      - '/data/gatus/config:/config'
      - '/data/gatus/data:/data'
    restart: always

拉取镜像docker compose -f gatus.yml pull

编写配置文件

配置文件/data/gatus/config/config.yaml
storage:
  type: sqlite
  path: /data/data.db

ui:
  buttons:
    - name: "Home"
      link: "https://ysicing.me/links"

endpoints:
  - name: bloghk
    group: core
    url: "https://ysicing.me/ping"
    interval: 3m
    conditions:
      - "[STATUS] == 200"

  - name: blogcn
    group: core
    url: "https://blog.ysicing.net/ping"
    interval: 3m
    conditions:
      - "[STATUS] == 200"

  - name: mikizhuzhu
    group: links
    url: "https://mikizhuzhu.cn/"
    interval: 10m
    conditions:
      - "[STATUS] == 200"

  - name: faritor
    group: links
    url: "https://www.unmz.net/?blog_source=ysicing.me"
    interval: 10m
    conditions:
      - "[STATUS] == 200"

  - name: naiba
    group: links
    url: "https://lifelonglearn.ing/?blog_source=ysicing.me"
    interval: 10m
    conditions:
      - "[STATUS] == 200"

  - name: imsun
    group: links
    url: "https://www.imsun.org/?blog_source=ysicing.me"
    interval: 10m
    conditions:
      - "[STATUS] == 200"

  - name: shiina
    group: links
    url: "https://blog.shiina.fun/?blog_source=ysicing.me"
    interval: 10m
    conditions:
      - "[STATUS] == 200"

从配置文件来看,配置是非常简单,其他类型配置如PING

- name: icmp-ping
  url: "icmp://ysicing.me"
  interval: 1m
  conditions:
    - "[CONNECTED] == true"
- name: example-dns-query
  url: "8.8.8.8"
  interval: 5m
    dns:
      query-name: "example.com"
      query-type: "A"
    conditions:
      - "[BODY] == 93.184.216.34"
      - "[DNS_RCODE] == NOERROR"

启动服务

docker compose -f gatus.yml up -d

启动完成访问8080端口

配置Caddy

# /etc/caddy/gatus.caddy
gatus.dx.rdns.12306.work {
 reverse_proxy 127.0.0.1:8080
}

演示

目前这服务应用在友情链接

其他

部署轻量私有化服务监控UptimeKuma

Chapters

Sponsor

Like this article? $1 reward

Comments

Teacher Du ·v1 香港 Reply

这个能监控容器吗?

老孙 ·v1 安大略多伦多 Reply

@Teacher Du 看文档应该是可以的

ysicing 👨‍💻 ·v1 Reply

@Teacher Du 监控容器的运行状态么,服务的话肯定没问题,如果是运行状态可能hack一下