Skip to main content

Health-check CLI for DHIS2 instances integrated with chap-core; cron-friendly with Slack alerts on status transitions.

Project description

chap-checker

CI PyPI version Python 3.13+ License: AGPL v3 Documentation

A small command-line health-check and alerting tool for DHIS2 instances that integrate with chap-core via a DHIS2 route. Cron-friendly, with optional Slack alerts on status transitions and a Textual TUI dashboard for the at-a-glance "leave it on a TV" view.

Documentation: https://dhis2-chap.github.io/chap-checker

Install

# One-shot run without installing (no PATH pollution):
uvx chap-checker --version
uvx chap-checker verify --url https://dhis2.example.com --token-env DHIS2_TOKEN

# Persistent install into uv's isolated tool environment:
uv tool install chap-checker
chap-checker --version

# Upgrade to the latest release later:
uv tool upgrade chap-checker

# Or, if you're embedding into another uv project:
uv add chap-checker

Quick start

Ad-hoc against a single instance (credentials resolved safely):

# With a DHIS2 Personal Access Token (recommended on modern servers):
export PROD_TOKEN=...
chap-checker verify \
    --url https://dhis2.example.com \
    --token-env PROD_TOKEN

# With a password (Basic auth) read from a named env var:
export PROD_PASSWORD=...
chap-checker verify \
    --url https://dhis2.example.com \
    --username admin \
    --password-env PROD_PASSWORD

# Omit --password / --token entirely and you'll be prompted on the
# terminal (hidden input). DHIS2_TOKEN / DHIS2_PASSWORD env vars
# work as defaults too. Passing --password / --token inline still
# works but is discouraged - the value lands in shell history and
# `ps` output. Token and password flags are mutually exclusive.

Multiple instances in ./chap-checker.toml:

[instances.prod]
url = "https://dhis2.example.com"
username = "ops"
password_env = "PROD_PASS"
alerts = ["slack"]

[alerts.slack]
webhook_url_env = "SLACK_WEBHOOK_URL"

Then chap-checker verify runs every configured instance and pages Slack on status transitions. See chap-checker.toml.example for the full template.

The TUI:

chap-checker dashboard

Built-in checks

Two namespaces — dhis2_* probes DHIS2 itself, dhis2_chap_* probes chap-core through the DHIS2 route. Each tile in the dashboard, each row in chap-checker checks list, each entry in the JSON output:

  • dhis2_ping/api/me
  • dhis2_system_info/api/system/info
  • dhis2_chap_route/api/routes?filter=code:eq:chap
  • dhis2_chap_ping/api/routes/chap/run/health
  • dhis2_chap_system_info/api/routes/chap/run/system/info
  • dhis2_chap_modeling_app/api/apps (matched by app_hub_id)

Full reference + endpoint details: Built-in checks.

Development

make install
make lint        # ruff + mypy + pyright
make test
make docs        # serve docs locally

See Development for repo layout and house rules.

License

AGPL-3.0-or-later

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chap_checker-0.3.1.tar.gz (784.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chap_checker-0.3.1-py3-none-any.whl (801.9 kB view details)

Uploaded Python 3

File details

Details for the file chap_checker-0.3.1.tar.gz.

File metadata

  • Download URL: chap_checker-0.3.1.tar.gz
  • Upload date:
  • Size: 784.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chap_checker-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d621951c59c0f80c7666f7dfc15487e7c85365a25f5b08ef1595f79aee75d73d
MD5 c52dd956d9eda348143e01a232065cd5
BLAKE2b-256 0951fc11fd149bf666d4bcca44d0549c56989ae01fb8f0034477340f129a4ce6

See more details on using hashes here.

Provenance

The following attestation bundles were made for chap_checker-0.3.1.tar.gz:

Publisher: release.yml on dhis2-chap/chap-checker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chap_checker-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: chap_checker-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 801.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chap_checker-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b82d919ba112b1d2a5f311f50f0cab2bb2d298c84641f65fefee78f259979ea0
MD5 836badc8a1f6bd3a81aad45abcd642ab
BLAKE2b-256 9afff18fe9eac460ecb8077c044e5a009b379ec36bb6d66cac69c667be5e32ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for chap_checker-0.3.1-py3-none-any.whl:

Publisher: release.yml on dhis2-chap/chap-checker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page