状态监控软件Gatus

简约而不简单的状态监控软件:Gatus

最近需要监控一些接口的在线状态,于是在程序员之友 github 上筛选到了基于 Go 语言的 Gatus。

Gatus 是一个面向开发人员的运行状况仪表板,使您能够使用 HTTP、ICMP、TCP 甚至 DNS 查询来监控您的服务,并通过使用状态代码等值的条件列表来评估所述查询的结果,响应时间、证书过期、正文等等。最重要的是,这些运行状况检查中的每一项都可以与通过 Slack、Teams、PagerDuty、Discord、Twilio 等发出的警报配对。

部署

快速启动:

1
docker run -p 8080:8080 --name gatus twinproduction/gatus

使用配置文件:

新建配置文件 config.yaml 内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 保存数据(默认是内存)
storage:
type: sqlite
path: /config/data.db

# 监控列表
endpoints:
- name: tms-driverapi
url: "https://tms.truking.com:8443/driverapi/train/getconfirmtrain"
interval: 60s
conditions:
- "[STATUS] == 500"
- "[RESPONSE_TIME] < 3000"
- "[BODY].OperationDesc == HTTP 405 Method Not Allowed"

- name: tms-web
url: "https://tms.truking.com:8443/login"
interval: 60s
conditions:
- "[STATUS] == 200"
- "[RESPONSE_TIME] < 3000"

- name: baidu.com
url: "https://www.baidu.com"
interval: 60s
conditions:
- "[STATUS] == 200"
- "[RESPONSE_TIME] < 3000"

新建 docker-compose 文件:

1
2
3
4
5
6
7
8
9
10
11
version: "3.9"
services:
homepage:
image: docker.io/twinproduction/gatus
container_name: gatus
network_mode: bridge
ports:
- 8088:8080
volumes:
- ./data:/config
restart: unless-stopped

启动服务:

1
docker compose up -d

状态监控软件Gatus
https://frely.github.io/2024/04/02/状态监控软件gatus/
作者
frely
发布于
2024年4月2日
许可协议