personal_infra/ansible/roles/gatus/templates/config.yaml.j2
counterweight f6656b0ff7
gatus: show resolved values on successful conditions, ui as a pass-through
Asked to un-hide endpoint properties; the answer is that nothing was hidden.
All six hide-* options (hide-hostname, hide-url, hide-port, hide-conditions,
hide-errors, and dont-resolve-failed-conditions) already default to false
upstream, so hostname, URL, port, conditions and errors were all being shown.

The one setting that genuinely displays MORE is resolve-successful-conditions.
By default a FAILING check resolves its placeholders - "[STATUS] (502) == 200" -
while a PASSING one drops the value and shows only "[STATUS] == 200". With it
on, a healthy DNS check now reads:

    [DNS_RCODE] (NOERROR) == NOERROR
    [BODY] (64.226.70.190) == 64.226.70.190

which says what it actually resolved to rather than merely that the assertion
held. Applied to all 27 pulled endpoints via a gatus_endpoint_default_ui that
each caller can override.

It applies to pulled endpoints ONLY: an external (push) endpoint has no `ui`
field upstream at all, because it carries no conditions - success comes from the
push. The template was initially emitting the block in both loops; emitting an
unknown key into the external-endpoints list risks a parse rejection, and a
rejected config is exactly what skip-invalid-config-update exists to survive.

Also made the page-level `ui` a pass-through dict, the same shape as
gatus_alerting, so every upstream option (description, dashboard-heading, logo,
link, favicon, buttons, custom-css, dark-mode, default-sort-by,
default-filter-by) is reachable without a variable per key. Replaces the two
one-off gatus_ui_title / gatus_ui_header variables.

Set default-sort-by: group, because the dashboard's own grouping toggle starts
OFF and remembers per browser in localStorage - without it the ten groups render
as one flat list of 86 rows for anyone who has not clicked it.

Note the limit of all this: it is configuration. Layout, card design and group
rendering come from the Vue app compiled into the binary (//go:embed static), so
changing those means forking and rebuilding the image - which would discard the
pinned-digest property the deployment relies on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-14 22:14:44 +02:00

64 lines
2.4 KiB
Django/Jinja

# {{ gatus_base_config_file }} — managed by Ansible (roles/gatus)
#
# BASE CONFIGURATION ONLY.
#
# Gatus merges every *.yaml under GATUS_CONFIG_PATH: maps are deep-merged and
# lists are appended, but a primitive defined in two files is ambiguous and
# upstream refuses it. So `web`, `storage`, `ui`, `alerting` and `security` are
# set here and MUST NOT appear in any other file in this directory.
#
# Endpoints are lists, so they append cleanly. Each service drops its own file
# into endpoints/ via the gatus_endpoint role - the same shape as caddy_site.
web:
# 0.0.0.0 is the CONTAINER's interface, not the host's. This must not be
# 127.0.0.1: that is the container's own loopback, which docker-proxy cannot
# reach, and gatus comes up healthy while the published port refuses every
# connection.
#
# The isolation comes from the port mapping in docker-compose.yml, which
# publishes to {{ gatus_bind_address }} on the host. Caddy fronts that, and it
# matters because the external-endpoint push API shares this listener with the
# dashboard.
address: 0.0.0.0
port: {{ gatus_port }}
# Gatus reloads when its config changes. If the NEW config fails to parse it
# calls panic() - unless this is set, in which case it logs the error and keeps
# running on the old config. Endpoint files are contributed by other playbooks,
# so one malformed file would otherwise take the monitor down, which is the
# worst possible time to lose it.
skip-invalid-config-update: {{ gatus_skip_invalid_config_update | bool | lower }}
storage:
type: {{ gatus_storage_type }}
{% if gatus_storage_type != 'memory' %}
path: {{ gatus_storage_path }}
{% endif %}
caching: {{ gatus_storage_caching | bool | lower }}
maximum-number-of-results: {{ gatus_storage_max_results }}
maximum-number-of-events: {{ gatus_storage_max_events }}
ui:
{{ gatus_ui | to_nice_yaml(indent=2) | indent(2, true) }}
{% if gatus_alerting %}
alerting:
{{ gatus_alerting | to_nice_yaml(indent=2) | indent(2, true) }}
{% else %}
# No alerting provider is configured yet. Gatus still evaluates every condition
# and records every result; it simply has nowhere to shout. Setting
# `gatus_alerting` is the single change needed to wire one up.
{% endif %}
{% if gatus_basic_auth %}
security:
basic:
{{ gatus_basic_auth | to_nice_yaml(indent=2) | indent(4, true) }}
{% endif %}
{% if gatus_maintenance %}
maintenance:
{{ gatus_maintenance | to_nice_yaml(indent=2) | indent(2, true) }}
{% endif %}