gatus README

The project's README from github.com/TwiN/gatus. As one markdown file: README.md.

Gatus

test Go Report Card Go version Docker pulls Follow TwiN

Gatus is a developer-oriented health dashboard that gives you the ability to monitor your services using HTTP, ICMP, TCP, and even DNS queries as well as evaluate the result of said queries by using a list of conditions on values like the status code, the response time, the certificate expiration, the body and many others. The icing on top is that each of these health checks can be paired with alerting via Slack, Teams, PagerDuty, Discord, Twilio and many more.

I personally deploy it in my Kubernetes cluster and let it monitor the status of my core applications: https://status.twin.sh/

Looking for a managed solution? Check out Gatus.io.

Quick start
docker run -p 8080:8080 --name gatus ghcr.io/twin/gatus:stable

You can also use Docker Hub if you prefer:

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

For more details, see Usage

❤ Like this project? Please consider sponsoring me.

Gatus dashboard

Have any feedback or questions? Create a discussion.

Table of Contents

Why Gatus?

Before getting into the specifics, I want to address the most common question:

Why would I use Gatus when I can just use Prometheus’ Alertmanager, Cloudwatch or even Splunk?

Neither of these can tell you that there’s a problem if there are no clients actively calling the endpoint. In other words, it's because monitoring metrics mostly rely on existing traffic, which effectively means that unless your clients are already experiencing a problem, you won't be notified.

Gatus, on the other hand, allows you to configure health checks for each of your features, which in turn allows it to monitor these features and potentially alert you before any clients are impacted.

A sign you may want to look into Gatus is by simply asking yourself whether you'd receive an alert if your load balancer was to go down right now. Will any of your existing alerts be triggered? Your metrics won’t report an increase in errors if no traffic makes it to your applications. This puts you in a situation where your clients are the ones that will notify you about the degradation of your services rather than you reassuring them that you're working on fixing the issue before they even know about it.

Features

The main features of Gatus are:

Gatus dashboard conditions

Usage

docker run -p 8080:8080 --name gatus ghcr.io/twin/gatus:stable

You can also use Docker Hub if you prefer:

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

If you want to create your own configuration, see Docker for information on how to mount a configuration file.

Here's a simple example:

endpoints:
  - name: website                 # Name of your endpoint, can be anything
    url: "https://twin.sh/health"
    interval: 5m                  # Duration to wait between every status check (default: 60s)
    conditions:
      - "[STATUS] == 200"         # Status must be 200
      - "[BODY].status == UP"     # The json path "$.status" must be equal to UP
      - "[RESPONSE_TIME] < 300"   # Response time must be under 300ms

  - name: make-sure-header-is-rendered
    url: "https://example.org/"
    interval: 60s
    conditions:
      - "[STATUS] == 200"                          # Status must be 200
      - "[BODY] == pat(*<h1>Example Domain</h1>*)" # Body must contain the specified header

This example would look similar to this:

Simple example

If you want to test it locally, see Docker.

Configuration

By default, the configuration file is expected to be at config/config.yaml.

You can specify a custom path by setting the GATUS_CONFIG_PATH environment variable.

If GATUS_CONFIG_PATH points to a directory, all *.yaml and *.yml files inside said directory and its subdirectories are merged like so:

💡 You can also use environment variables in the configuration file (e.g. $DOMAIN, ${DOMAIN})

⚠️ When your configuration parameter contains a $ symbol, you have to escape $ with $$.

See Use environment variables in config files or examples/docker-compose-postgres-storage/config/config.yaml for examples.

If you want to test it locally, see Docker.

Configuration

Parameter Description Default
metrics Whether to expose metrics at /metrics. false
storage Storage configuration. {}
alerting Alerting configuration. {}
announcements Announcements configuration. []
endpoints Endpoints configuration. Required []
external-endpoints External Endpoints configuration. []
security Security configuration. {}
concurrency Maximum number of endpoints/suites to monitor concurrently. Set to 0 for unlimited. See Concurrency. 3
disable-monitoring-lock Whether to disable the monitoring lock. Deprecated: Use concurrency: 0 instead. false
skip-invalid-config-update Whether to ignore invalid configuration update.
See Reloading configuration on the fly.
false
web Web configuration. {}
ui UI configuration. {}
maintenance Maintenance configuration. {}

If you want more verbose logging, you may set the GATUS_LOG_LEVEL environment variable to DEBUG. Conversely, if you want less verbose logging, you can set the aforementioned environment variable to WARN, ERROR or FATAL. The default value for GATUS_LOG_LEVEL is INFO.

Endpoints

Endpoints are URLs, applications, or services that you want to monitor. Each endpoint has a list of conditions that are evaluated on an interval that you define. If any condition fails, the endpoint is considered as unhealthy. You can then configure alerts to be triggered when an endpoint is unhealthy once a certain threshold is reached.

Parameter Description Default
endpoints List of endpoints to monitor. Required []
endpoints[].enabled Whether to monitor the endpoint. true
endpoints[].name Name of the endpoint. Can be anything. Required ""
endpoints[].group Group name. Used to group multiple endpoints together on the dashboard.
See Endpoint groups.
""
endpoints[].url URL to send the request to. Required ""
endpoints[].method Request method. GET
endpoints[].conditions Conditions used to determine the health of the endpoint.
See Conditions.
[]
endpoints[].interval Duration to wait between every status check. 60s
endpoints[].graphql Whether to wrap the body in a query param ({"query":"$body"}). false
endpoints[].body Request body. ""
endpoints[].headers Request headers. {}
endpoints[].dns Configuration for an endpoint

gatus (TwiN/gatus)

Searching Database…

12.3K ·GitHub
这是干什么的?Gatus 是一个面向开发者的开源状态页和健康监控面板:它会主动通过 HTTP、TCP、ICMP 或 DNS 探测你的服务,把结果展示在网页面板上,并在检查失败时向你发出警报。
它和 Prometheus Alertmanager 或 Cloudwatch 告警有什么区别?基于指标的告警依赖已有的流量,如果没有客户端在调用出故障的服务,就不会触发任何告警。Gatus 会自己按计划运行健康检查,所以能在用户察觉故障之前就提醒你。
怎么把它跑起来?运行 Docker 镜像(docker run -p 8080:8080 twinproduction/gatus)并挂载你的配置文件即可。文档里还提供了 Helm chart、Terraform、Kubernetes 清单以及直接安装二进制文件的方式。默认从 config/config.yaml 读取配置。
配置一个健康检查是什么样的?只用到 YAML:每个端点需要一个名称、URL、请求方法、检查间隔,以及一组针对状态码、响应时间、响应体或证书过期时间等值的条件。被监控的服务上不用安装任何代理程序。
有没有还在实验阶段或已弃用的功能需要留意?有——Suites 被标记为 ALPHA(早期测试),远程实例是 EXPERIMENTAL(实验性),旧的 Teams 告警已弃用,改用 Teams Workflow 告警。另外配置文件检查很严格:在合并的多个文件中,同一个基础参数如果定义了两次会被拒绝。
这是给运维团队用的,还是给个人开发者用的?它本身就是面向开发者设计的:作者在自己的 Kubernetes 集群里用它监控核心应用,部署方式从单个 Docker 容器到 Helm 和 Terraform 都有——适合任何自托管服务的人。
它会偷偷联网上报或把我的数据发到别处吗?它完全自托管:检查从你部署它的地方发起,结果保存在你自己的存储里(自带一个使用 PostgreSQL 的 docker-compose 示例)。敏感的配置值可以通过环境变量注入;官方在 Gatus.io 也提供托管版本。
除了普通的 HTTP 网址,它还能检查什么?除了 HTTP/HTTPS,它还能探测 TCP、UDP 和 SCTP 端口,通过 ICMP ping 主机,执行 DNS 查询,访问 WebSocket 和 gRPC 端点,检查 SSH、STARTTLS 和 TLS 服务,发送 GraphQL 请求,甚至还能跟踪域名的到期日期。
检查失败之后会发生什么?一旦失败次数达到阈值,Gatus 就会通过它内置的众多通知渠道之一提醒你——包括 Slack、Teams、PagerDuty、Discord、Telegram、Twilio、电子邮件等几十种——也可以用你自己写的自定义告警渠道。还可以为所有端点统一配置一个默认告警。
我能把数据导出来,或者把状态徽章嵌入到别的地方吗?可以。它提供一个程序化 API,可以获取原始数据、在线率和响应时间序列;还能生成在线率、健康状况(兼容 Shields.io)和响应时间的徽章,颜色阈值都可以自定义。
我能把它当成自动化的冒烟测试工具来用吗?这正是它宣传的用法之一:由于检查条件可以对状态码、响应体、响应时间甚至解析出的 IP 做断言,README 里就建议利用 Gatus 来创建自动化的用户验收测试。
Creator
TwiN
Size
36 MB
Stars
12.3K
Age
7y
Commits · 90 Days