Skip to content

Configuration

chap-checker looks for ./chap-checker.toml in the current working directory by default. Override the path with --config <path> on any subcommand, or set the CHAP_CHECKER_CONFIG env var.

There is no XDG / system-wide lookup: the config lives next to wherever you run chap-checker from. Put a copy alongside your cron entry, ansible-managed deploy, or systemd unit.

File shape

# Top-level (optional)
concurrency = 5                     # how many instances to check in parallel

# One [instances.<name>] block per server to monitor. `kind` defaults to
# "dhis2"; see "Instance kinds" below for Open Geo Service servers.
[instances.prod]
# name = "Production"              # optional human label for TUI / dashboard / Slack body
url = "https://dhis2.example.com"
username = "ops"
password = "REPLACE_ME"            # OR set password_env, not both
# password_env = "PROD_PASS"
# timeout_s = 10.0                 # default 10s, must be > 0
# verify_tls = true                # default true
# checks = ["dhis2_ping", ...]     # subset; omit to run every check for the instance's kind
# alerts = ["slack"]               # opt-in per alerter; omit / [] = no alerts

# One [alerts.<name>] block per transport. Built-in: `slack`, `webhook`.
[alerts.slack]
webhook_url_env = "SLACK_WEBHOOK_URL"
# webhook_url = "https://hooks.slack.com/services/..."   # alternative
# notify_on = ["fail", "error", "warn"]                  # default
# timeout_s = 10.0

A ready-to-edit template lives at chap-checker.toml.example in the repo.

Credentials

The file carries passwords and webhook URLs — treat it like any other secret.

  • Keep it out of git. chap-checker.toml is in the repo's .gitignore.
  • chmod 600 chap-checker.toml. The config loader logs a warning on POSIX if the file is group- or world-readable while holding any inline password or webhook_url.
  • Prefer the *_env variants (password_env, webhook_url_env) and keep the actual secret in your shell, secrets manager, or systemd EnvironmentFile.
  • An env var named by a *_env field must be set and non-empty. An empty or whitespace-only value is an error, not an empty password / token / URL. Literal password and token values must not be empty either.
  • Don't put credentials in a URL (https://user:pass@host). Instance url, [alerts.slack].webhook_url and [alerts.webhook].url (and their *_env values) are rejected when they carry a user[:pass]@ part, because the URL is shown in verify --json, /api/state and alert payloads. Use the username / password / token fields for DHIS2, and the headers table for webhook auth. Webhook URLs that carry a secret in the path or query string (Slack-style) are still accepted.
  • Config errors printed by the CLI, the TUI reload toast and POST /api/reload name the field and the problem but never echo the rejected value.

Instance display name

Each [instances.<key>] block accepts an optional name = "..." field. When set, that value is rendered everywhere a human sees the instance — the TUI tile header, the browser dashboard card title, the verify Rich-table heading, and the bold target line in the Slack alert body. When unset, the section key is used (the historical behaviour).

The section key is always the stable identifier: state-file dedup keys, React keys in the browser dashboard, and log lines all use the key, not the label. That means you can rename name whenever you like — the instance's transition history and any pending recovery alert survive the rename. It also means two different [instances.<key>] blocks can carry the same name if you want them to read the same on the dashboard while remaining distinct entities to the alerting state machine.

[instances.chap-modeling-platform]
name = "CHAP Modeling Platform"
url  = "https://chap.dhis2.org/chap-modeling-platform/"

The generic JSON output (verify --json, the /api/state endpoint, the webhook envelope) exposes both: target_name (section key) and target_display_name (the label, or null if unset).

Instance kinds

Each [instances.<name>] block has a kind that decides which fields are valid and which checks run. It defaults to "dhis2", so configs written before kinds existed keep working unchanged.

kind Server Auth Checks
"dhis2" DHIS2 (optionally with the chap-core integration) required: password or token (see above) http_2xx, dhis2_*
"ogs" Open Geo Service (openEO backend) none http_2xx, ogs_*
"chap" chap-core reached directly (its base URL, without /health) none chap_*
"caps" CAPS (its base URL, without /system/info) none caps_*
"http" Any URL none (or headers) http_expect

Each kind is a plugin; chap-checker plugins list prints them all with a copy-paste table.

Open Geo Service was called Open Climate Service (OCS) until late 2026. chap-checker 0.11.x and earlier used kind = "ocs" and ocs_health / ocs_info; those names are no longer accepted (see the 0.12.0 changelog).

[instances.nepal-ogs]
kind = "ogs"
name = "Nepal climate service"
url = "https://ocs-demo-nepal.dhis2.org"
alerts = ["slack"]

An ogs, chap or caps instance accepts the shared fields only: name, url, timeout_s, verify_tls, checks, alerts. They have no authentication, so setting username / password / token on one is a validation error, and neither the top-level [retry] block nor a per-instance retry_policy applies to them.

[instances.chap-stable]
kind = "chap"
name = "Chap Core stable"
url = "https://climate-demo.dhis2.org/chap/stable"

[instances.caps]
kind = "caps"
url = "https://climate-demo.dhis2.org/caps"

An http instance also takes what the URL must answer, all optional:

Field Meaning
expect_status The statuses that count as up, e.g. [200] or [200, 401]. Default: any 2xx.
body_contains Text the body must contain.
json_path A dotted path into a JSON body: status, data.0.state.
json_equals The value at json_path (a string, number or boolean). Needs json_path.
headers Headers to send, e.g. { Accept = "application/json" }. Credentials here count as inline secrets (see the file-mode note above).
[instances.landing]
kind = "http"
name = "Landing page"
url = "https://climate-demo.dhis2.org/"
body_contains = "Climate"

Redirects are followed (up to five) and the status checked is the final one's. With headers set, a redirect to another origin (host, port or scheme) is not followed, so the headers never reach a server you didn't name; the check then sees the redirect's own status.

Alerts, the state file, verify --json and the dashboard treat every kind the same way. JSON output carries a target_kind field per run, and dashboard rows show the platform (DHIS2 2.42.3, OGS 0.1.0, Chap Core 2.7.0, CAPS 3.2.2).

Per-instance check filter

Add checks = [...] on an instance to restrict which checks fire against it. Transitive requires are pulled in automatically, so a partial selection still has every prerequisite present.

# DHIS2-only instance (no chap stack):
[instances.pure-dhis2]
url = "https://dhis2.example.com"
username = "admin"
password_env = "DHIS2_PASS"
checks = ["dhis2_ping", "dhis2_system_info"]

# chap stack but no modeling-app check:
[instances.api-only]
url = "https://dhis2.example.com"
username = "admin"
password_env = "DHIS2_PASS"
checks = ["dhis2_chap_system_info"]   # pulls in dhis2_ping, dhis2_chap_route, dhis2_chap_ping

Unknown names, and names that don't apply to the instance's kind (for example dhis2_ping on an OGS instance), are rejected at config load. There is no "exclude" syntax — list the checks you want.

The CLI's --check flag overrides every instance's list for one run. Names that don't apply to an instance's kind are ignored for that instance, and an instance left with nothing to run is skipped with a note.

See Built-in checks for the names and dependency graph.

Per-instance alert opt-in

alerts = ["slack", ...] on an instance lists which configured alerters fire for that instance. The default is [], so a fresh instance is silent until you explicitly opt it in. Useful for "ten staging instances, only prod should page."

[alerts.slack]
webhook_url_env = "SLACK_WEBHOOK_URL"

[instances.prod]               # pages on transitions
url = "https://dhis2.example.com"
alerts = ["slack"]
# ...

[instances.staging]            # silent, just tracked
url = "https://staging.dhis2.example.com"
# no `alerts =` line, default is []
# ...

See Alerting for the full transport setup and transition semantics.

Concurrency

concurrency (default 5) controls how many instances are probed in parallel. Each target gets its own HTTP client, so there's no shared HTTP state. Bump it up for many same-network targets, down to 1 to force serial execution. Hard upper bound 100.

CLI flag --concurrency N on verify overrides the config value for one run.

Retries

Optional [retry] block — applies a retry policy to every DHIS2 target's client so transient transport failures and the configured retry_statuses (default 429 / 502 / 503 / 504) are retried with exponential backoff. Off by default: a health checker generally wants to see flakes, not paper over them. Opt in when you specifically want a brief blip not to count as a failed check.

[retry]
max_attempts = 3            # total attempts including the first call (1-10)
base_delay = 0.5            # initial backoff seconds before the second attempt
max_delay = 30.0            # hard cap per sleep
backoff_factor = 2.0        # multiplier per attempt (exponential)
jitter = 0.1                # +/- 10% random jitter on each delay
retry_statuses = [429, 502, 503, 504]

For a per-instance override, set retry_policy = { ... } inside an [instances.<name>] block — it wins over the top-level default.

[retry]
max_attempts = 3

[instances.flaky]
url = "https://flaky.example"
username = "u"
password_env = "FLAKY_PASS"
retry_policy = { max_attempts = 5, base_delay = 1.0 }

[instances.strict]
url = "https://strict.example"
username = "u"
password_env = "STRICT_PASS"
# disable retries on this one specifically while keeping the global default
retry_policy = { max_attempts = 1 }

UI branding and theme

[ui]
title = "DHIS2 / Climate Instance Checker"  # default; 1-120 chars
theme = "phosphor"                          # phosphor | amber | high | tokyo | dhis2

title is the header text shown in both the terminal dashboard and the browser dashboard served by chap-checker serve. The browser also syncs document.title so the browser tab matches.

theme selects the palette for both the browser dashboard and the terminal dashboard. The browser's command palette (Ctrl+K/⌘K) also exposes the same options at runtime — there, the config value acts as the starting default and a per-user palette pick (persisted in browser localStorage) wins over the config until cleared. The TUI starts in the config's theme the first time; a theme picked in its settings (,) is kept between runs after that. In the TUI the themes are sokkel's: phosphor, amber, tokyo, phosphor-bright for high, and tray for dhis2.

Themes:

  • phosphor (default) — phosphor-green-on-near-black terminal look.
  • amber — amber-on-near-black terminal look.
  • high — high-contrast green-on-black for kiosks and impaired vision.
  • tokyo — deep navy with a cobalt accent (Tokyo Night).
  • dhis2 — light-mode mimicking the DHIS2 admin chrome: white tile cards on a pale grey body with a deep-blue header strip and white header text. Status colours stay semantic (green/amber/red) but pick darker shades for legibility on white.

Both fields are optional; omit [ui] to take the defaults. The Reload config command (Ctrl+R in the TUI, the same entry in the browser's Ctrl+K palette, or POST /api/reload directly) re-reads the section along with the rest of the config — the browser picks up title changes on the next /api/state poll without a reload of the browser tab. There is no top-level chap-checker reload CLI command; reload is in-process only.