gatus

TwiN / gatus

Gatus 是一个面向开发者的自动化状态页,集成告警与事件管理,通过配置即可监控服务可用性并展示状态。

Go 开发工具 基础设施 Web 开发 状态页 服务监控 告警 开发者工具 自托管

为什么值得看

编辑点评

Gatus 的核心优势是轻量、配置驱动,无需复杂 agent,即可通过 HTTP/ICMP/TCP 等探测方式持续检查服务健康,并内置告警通道。适合需要快速搭建内部或对外状态页的团队,尤其适合与已有监控体系互补。注意它更偏“端到端可用性”而非深度指标监控,复杂告警规则需依赖外部系统。

Star 趋势

近 7 日
  • Star 总数12,088
  • 今日新增+8
  • 7 日增速+100%
  • Fork827

同类项目

同场景 · 开发工具 / 基础设施 / Web 开发

项目文档

来自 GitHub README · master 分支

Gatus

Go Report Card

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:

  • Highly flexible health check conditions: While checking the response status may be enough for some use cases, Gatus goes much further and allows you to add conditions on the response time, the response body and even the IP address.
  • Ability to use Gatus for user acceptance tests: Thanks to the point above, you can leverage this application to create automated user acceptance tests.
  • Very easy to configure: Not only is the configuration designed to be as readable as possible, it's also extremely easy to add a new service or a new endpoint to monitor.
  • Alerting: While having a pretty visual dashboard is useful to keep track of the state of your application(s), you probably don't want to stare at it all day. Thus, notifications via Slack, Mattermost, Messagebird, PagerDuty, Twilio, Google chat and Teams are supported out of the box with the ability to configure a custom alerting provider for any needs you might have, whether it be a different provider or a custom application that manages automated rollbacks.
  • Metrics
  • Low resource consumption: As with most Go applications, the resource footprint that this application requires is negligibly small.
  • Badges: Uptime 7d Response time 24h
  • Dark mode

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: - All maps/objects are deep merged (i.e. you could define alerting.slack in one file and alerting.pagerduty in another file) - All slices/arrays are appended (i.e. you can define endpoints in multiple files and each endpoint will be added to the final list of endpoints) - Parameters with a primitive value (e.g. metrics, alerting.slack.webhook-url, etc.) may only be defined once to forcefully avoid any ambiguity - To clarify, this also means that you could not define alerting.slack.webhook-url in two files with different values. All files are merged into one before they are processed. This is by design.

💡 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 of type DNS.
See Monitoring an endpoint using DNS queries.
""
endpoints[].dns.query-type Query type (e.g. MX). ""
endpoints[].dns.query-name Query name (e.g. example.com). ""
endpoints[].ssh Configuration for an endpoint of type SSH.
See Monitoring an endpoint using SSH.
""
endpoints[].ssh.username SSH username (e.g. example). Required ""
endpoints[].ssh.password SSH password (e.g. password). Required ""
endpoints[].alerts List of all alerts for a given endpoint.
See Alerting.
[]
endpoints[].maintenance-windows List of all maintenance windows for a given endpoint.
See Maintenance.
[]
endpoints[].client Client configuration. {}
endpoints[].ui UI configuration at the endpoint level. {}
endpoints[].ui.hide-conditions Whether to hide conditions from the results. Note that this only hides conditions from results evaluated from the moment this was enabled. false
endpoints[].ui.hide-hostname Whether to hide the hostname from the results. false
endpoints[].ui.hide-port Whether to hide the port from the results. false
endpoints[].ui.hide-url Whether to hide the URL from the results. Useful if the URL contains a token. false
endpoints[].ui.hide-errors Whether to hide errors from the results. false
endpoints[].ui.dont-resolve-failed-conditions Whether to resolve failed conditions for the UI. false
endpoints[].ui.resolve-successful-conditions Whether to resolve successful conditions for the UI (helpful to expose body assertions even when checks pass). false
endpoints[].ui.badge.response-time List of response time thresholds. Each time a threshold is reached, the badge has a different color. [50, 200, 300, 500, 750]
endpoints[].extra-labels Extra labels to add to the metrics. Useful for grouping endpoints together. {}
endpoints[].always-run (SUITES ONLY) Whether to execute this endpoint even if previous endpoints in the suite failed. false
endpoints[].store (SUITES ONLY) Map of values to extract from the response and store in the suite context (stored even on failure). {}

You may use the following placeholders in the body (endpoints[].body): - [ENDPOINT_NAME] (resolved from endpoints[].name) - [ENDPOINT_GROUP] (resolved from endpoints[].group) - [ENDPOINT_URL] (resolved from endpoints[].url) - [LOCAL_ADDRESS] (resolves to the local IP and port like 192.0.2.1:25 or [2001:db8::1]:80) - [RANDOM_STRING_N] (resolves to a random string of numbers and letters of length N (max: 8192))

External Endpoints

Unlike regular endpoints, external endpoints are not monitored by Gatus, but they are instead pushed programmatically. This allows you to monitor anything you want, even when what you want to check lives in an environment that would not normally be accessible by Gatus.

For instance: - You can create your own agent that lives in a private network and pushes the status of your services to a publicly-exposed Gatus instance - You can monitor services that are not supported by Gatus - You can implement your own monitoring system while using Gatus as the dashboard

Parameter Description Default
external-endpoints List of endpoints to monitor. []
external-endpoints[].enabled Whether to monitor the endpoint. true
external-endpoints[].name Name of the endpoint. Can be anything. Required ""
external-endpoints[].group Group name. Used to group multiple endpoints together on the dashboard.
See Endpoint groups.
""
external-endpoints[].token Bearer token required to push status to. Required ""
external-endpoints[].alerts List of all alerts for a given endpoint.
See Alerting.
[]
external-endpoints[].heartbeat Heartbeat configuration for monitoring when the external endpoint stops sending updates. {}
external-endpoints[].heartbeat.interval Expected interval between updates. If no update is received within this interval, alerts will be triggered. Must be at least 10s. 0 (disabled)

Example:

external-endpoints:
  - name: ext-ep-test
    group: core
    token: "potato"
    heartbeat:
      interval: 30m  # Automatically create a failure if no update is received within 30 minutes
    alerts:
      - type: discord
        description: "healthcheck failed"
        send-on-resolved: true

To push the status of an external endpoint, you can use gatus-cli:

gatus-cli external-endpoint push --url https://status.example.org --key "core_ext-ep-test" --token "potato" --success

or send an HTTP request:

POST /api/v1/endpoints/{key}/external?success={success}&error={error}&duration={duration}

Where: - {key} has the pattern <GROUP_NAME>_<ENDPOINT_NAME> in which both variables have , /, _, ,, ., #, + and & replaced by -. - Using the example configuration above, the key would be core_ext-ep-test. - {success} is a boolean (true or false) value indicating whether the health check was successful or not. - {error} (optional): a string describing the reason for a failed health check. If {success} is false, this should contain the error message; if the check is successful, this will be ignored. - {duration} (optional): the time that the request took as a duration string (e.g. 10s).

You must also pass the token as a Bearer token in the Authorization header.

Suites (ALPHA)

Suites are collections of endpoints that are executed sequentially with a shared context. This allows you to create complex monitoring scenarios where the result from one endpoint can be used in subsequent endpoints, enabling workflow-style monitoring.

Here are a few cases in which suites could be useful: - Testing multi-step authentication flows (login -> access protected resource -> logout) - API workflows where you need to chain requests (create resource -> update -> verify -> delete) - Monitoring business processes that span multiple services - Validating data consistency across multiple endpoints

Parameter Description Default
suites List of suites to monitor. []
suites[].enabled Whether to monitor the suite. true
suites[].name Name of the suite. Must be unique. Required ""
suites[].group Group name. Used to group multiple suites together on the dashboard. ""
suites[].interval Duration to wait between suite executions. 10m
suites[].timeout Maximum duration for the entire suite execution. 5m
suites[].context Initial context values that can be referenced by endpoints. {}
suites[].endpoints List of endpoints to execute sequentially. Required []
suites[].endpoints[].store Map of values to extract from the response and store in the suite context (stored even on failure). {}
suites[].endpoints[].always-run Whether to execute this endpoint even if previous endpoints in the suite failed. false

Note: Suite-level alerts are not supported yet. Configure alerts on individual endpoints within the suite instead.

Using Context in Endpoints

Once values are stored in the context, they can be referenced in subsequent endpoints: - In the URL: https://api.example.com/users/[CONTEXT].user_id - In headers: Authorization: Bearer [CONTEXT].auth_token - In the body: {"user_id": "[CONTEXT].user_id"} - In conditions: [BODY].server_ip == [CONTEXT].server_ip

Note that context/store keys are limited to A-Z, a-z, 0-9, underscores (_), and hyphens (-).

Example Suite Configuration

suites:
  - name: item-crud-workflow
    group: api-tests
    interval: 5m
    context:
      price: "19.99"  # Initial static value in context
    endpoints:
      # Step 1: Create an item and store the item ID
      - name: create-item
        url: https://api.example.com/items
        method: POST
        body: '{"name": "Test Item", "price": "[CONTEXT].price"}'
        conditions:
          - "[STATUS] == 201"
          - "len([BODY].id) > 0"
          - "[BODY].price == [CONTEXT].price"
        store:
          itemId: "[BODY].id"
        alerts:
          - type: slack
            description: "Failed to create item"

      # Step 2: Update the item using the stored item ID
      - name: update-item
        url: https://api.example.com/items/[CONTEXT].itemId
        method: PUT
        body: '{"price": "24.99"}'
        conditions:
          - "[STATUS] == 200"
        alerts:
          - type: slack
            description: "Failed to update item"

      # Step 3: Fetch the item and validate the price
      - name: get-item
        url: https://api.example.com/items/[CONTEXT].itemId
        method: GET
        conditions:
          - "[STATUS] == 200"
          - "[BODY].price == 24.99"
        alerts:
          - type: slack
            description: "Item price did not update correctly"

      # Step 4: Delete the item (always-run: true to ensure cleanup even if step 2 or 3 fails)
      - name: delete-item
        url: https://api.example.com/items/[CONTEXT].itemId
        method: DELETE
        always-run: true
        conditions:
          - "[STATUS] == 204"
        alerts:
          - type: slack
            description: "Failed to delete item"

The suite will be considered successful only if all required endpoints pass their conditions.

Conditions

Here are some examples of conditions you can use:

Condition Description Passing values Failing values
[STATUS] == 200 Status must be equal to 200 200 201, 404, ...
[STATUS] < 300 Status must lower than 300 200, 201, 299 301, 302, ...
[STATUS] <= 299 Status must be less than or equal to 299 200, 201, 299 301, 302, ...
[STATUS] > 400 Status must be greater than 400 401, 402, 403, 404 400, 200, ...
[STATUS] == any(200, 429) Status must be either 200 or 429 200, 429 201, 400, ...
[CONNECTED] == true Connection to host must've been successful true false
[RESPONSE_TIME] < 500 Response time must be below 500ms 100ms, 200ms, 300ms 500ms, 501ms
[IP] == 127.0.0.1 Target IP must be 127.0.0.1 127.0.0.1 0.0.0.0
[BODY] == 1 The body must be equal to 1 1 {}, 2, ...
[BODY].user.name == john JSONPath value of $.user.name is equal to john {"user":{"name":"john"}}
[BODY].data[0].id == 1 JSONPath value of $.data[0].id is equal to 1 {"data":[{"id":1}]}
[BODY].age == [BODY].id JSONPath value of $.age is equal JSONPath $.id {"age":1,"id":1}
len([BODY].data) < 5 Array at JSONPath $.data has less than 5 elements {"data":[{"id":1}]}
len([BODY].name) == 8 String at JSONPath $.name has a length of 8 {"name":"john.doe"} {"name":"bob"}
has([BODY].errors) == false JSONPath $.errors does not exist {"name":"john.doe"} {"errors":[]}
has([BODY].users) == true JSONPath $.users exists {"users":[]} {}
[BODY].name == pat(john*) String at JSONPath $.name matches pattern john* {"name":"john.doe"} {"name":"bob"}
[BODY].id == any(1, 2) Value at JSONPath $.id is equal to 1 or 2 1, 2 3, 4, 5
[CERTIFICATE_EXPIRATION] > 48h Certificate expiration is more than 48h away 49h, 50h, 123h 1h, 24h, ...
[DOMAIN_EXPIRATION] > 720h The domain must expire in more than 720h 4000h 1h, 24h, ...

Placeholders

Placeholder Description Example of resolved value
[STATUS] Resolves into the HTTP status of the request 404
[RESPONSE_TIME] Resolves into the response time the request took, in ms 10
[IP] Resolves into the IP of the target host 192.168.0.232
[BODY] Resolves into the response body. Supports JSONPath. {"name":"john.doe"}
[CONNECTED] Resolves into whether a connection could be established true
[CERTIFICATE_EXPIRATION] Resolves into the duration before certificate expiration (valid units are "s", "m", "h".) 24h, 48h, 0 (if not protocol with certs)
[DOMAIN_EXPIRATION] Resolves into the duration before the domain expires (valid units are "s", "m", "h".) 24h, 48h, 1234h56m78s
[DNS_RCODE] Resolves into the DNS status of the response NOERROR

Functions

Function Description Example
len If the given path leads to an array, returns its length. Otherwise, the JSON at the given path is minified and converted to a string, and the resulting number of characters is returned. Works only with the [BODY] placeholder. len([BODY].username) > 8
has Returns true or false based on whether a given path is valid. Works only with the [BODY] placeholder. has([BODY].errors) == false
pat Specifies that the string passed as parameter should be evaluated as a pattern. Works only with == and !=. [IP] == pat(192.168.*)
any Specifies that any one of the values passed as parameters is a valid value. Works only with == and !=. [BODY].ip == any(127.0.0.1, ::1)

💡 Use pat only when you need to. [STATUS] == pat(2*) is a lot more expensive than [STATUS] < 300.

Web

Allows you to configure how and where the dashboard is being served.

Parameter Description Default
web Web configuration {}
web.address Address to listen on. 0.0.0.0
web.port Port to listen on. 8080
web.read-buffer-size Buffer size for reading requests from a connection. Also limit for the maximum header size. 8192
web.tls.certificate-file Optional public certificate file for TLS in PEM format. ""
web.tls.private-key-file Optional private key file for TLS in PEM format. ""

UI

Allows you to configure the application wide defaults for the dashboard's UI. Some of these parameters can be overridden locally by users using the local storage of their browser.

Parameter Description Default
ui UI configuration {}
ui.title Title of the document. Health Dashboard ǀ Gatus
ui.description Meta description for the page. Gatus is an advanced....
ui.dashboard-heading Dashboard title between header and endpoints Health Dashboard
ui.dashboard-subheading Dashboard description between header and endpoints Monitor the health of your endpoints in real-time
ui.header Header at the top of the dashboard. Also used as the title on the OIDC login page. Gatus
ui.logo URL to the logo to display. When set, shown alongside the Gatus logo on the OIDC login page. ""
ui.link Link to open when the logo is clicked. ""
ui.favicon.default Favourite default icon to display in web browser tab or address bar. /favicon.ico
ui.favicon.size16x16 Favourite icon to display in web browser for 16x16 size. /favicon-16x16.png
ui.favicon.size32x32 Favourite icon to display in web browser for 32x32 size. /favicon-32x32.png
ui.buttons List of buttons to display below the header. []
ui.buttons[].name Text to display on the button. Required ""
ui.buttons[].link Link to open when the button is clicked. Required ""
ui.custom-css Custom CSS ""
ui.dark-mode Whether to enable dark mode by default. Note that this is superseded by the user's operating system theme preferences. true
ui.default-sort-by Default sorting option for endpoints in the dashboard. Can be name, group, or health. Note that user preferences override this. name
ui.default-filter-by Default filter option for endpoints in the dashboard. Can be none, failing, or unstable. Note that user preferences override this. none
ui.login-subtitle Subtitle displayed on the OIDC login page. System Monitoring Dashboard

Announcements

System-wide announcements allow you to display important messages at the top of the status page. These can be used to inform users about planned maintenance, ongoing issues, or general information. You can use markdown to format your announcements.

This is essentially what some status page calls "incident communications".

Parameter Description Default
announcements List of announcements to display []
announcements[].timestamp UTC timestamp when the announcement was made (RFC3339 format) Required
announcements[].type Type of announcement. Valid values: outage, warning, information, operational, none "none"
announcements[].message The message to display to users Required
announcements[].archived Whether to archive the announcement. Archived announcements show at the bottom of the status page instead of at the top. false

Types: - outage: Indicates service disruptions or critical issues (red theme) - warning: Indicates potential issues or important notices (yellow theme) - information: General information or updates (blue theme) - operational: Indicates resolved issues or normal operations (green theme) - none: Neutral announcements with no specific severity (gray theme, default if none are specified)

Example Configuration:

announcements:
  - timestamp: 2025-11-07T14:00:00Z
    type: outage
    message: "Scheduled maintenance on database servers from 14:00 to 16:00 UTC"
  - timestamp: 2025-11-07T16:15:00Z
    type: operational
    message: "Database maintenance completed successfully. All systems operational."
  - timestamp: 2025-11-07T12:00:00Z
    type: information
    message: "New monitoring dashboard features will be deployed next week"
  - timestamp: 2025-11-06T09:00:00Z
    type: warning
    message: "Elevated API response times observed for US customers"
    archived: true

If at least one announcement is archived, a Past Announcements section will be rendered at the bottom of the status page: Gatus past announcements section

Storage

Parameter Description Default
storage Storage configuration {}
storage.path Path to persist the data in. Only supported for types sqlite and postgres. ""
storage.type Type of storage. Valid types: memory, sqlite, postgres. "memory"
storage.caching Whether to use write-through caching. Improves loading time for large dashboards.
Only supported if storage.type is sqlite or postgres
false
storage.maximum-number-of-results The maximum number of results that an endpoint can have 100
storage.maximum-number-of-events The maximum number of events that an endpoint can have 50

The results for each endpoint health check as well as t

README 内容较长,此处已截断,完整内容请查看 GitHub 仓库。

文档抓取自 GitHub 仓库 README,版权归原作者所有;已过滤徽章等噪音并经安全消毒后展示。