This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.2 instead.
Reason given by maintainers: superseded by 0.1.1: password masking fixes
dbhealth-agent
Client-side agent for DBHealth — collects PostgreSQL
pg_stat_* health metrics, strips query literals, client IPs, application
names, and row contents on a best-effort basis, and sends only the sanitized
aggregates to the DBHealth API for a weekly health report. Run dbhealth verify --json-output before your first real run to see, field by field,
exactly what would leave your server for YOUR data — that JSON audit output,
not this paragraph, is the authoritative source for what gets sent. (Plain
dbhealth verify, without --json-output, prints a human-readable summary —
counts and a truncated first-example query, not the full wire payload — plus
an explicit list of the sanitizer's current best-effort masking gaps.)
Literal masking (best-effort — a conservative filter, not a SQL lexer;
details on the verify screen): masking is a fail-CLOSED regex filter that
errs toward over-masking. It replaces standard, escape (E'...'), and
dollar-quoted strings ($$...$$ / $tag$...$tag$) with '?', replaces every
numeric form (including 1e10, 1_000, 0xFF, 0b1010, 1.5e-3, .5) with
?, and strips SQL comments (-- ... and /* ... */). When the collector's
400-char transfer cap cuts a literal mid-value and leaves it unclosed, the
masker cuts the preview and appends … rather than shipping the tail verbatim;
if a literal earlier in the same query was already masked to '?', the cut is
rolled back to that '?' so the text in between is dropped too — an unmatched
quote means the filter may have mis-read that text, so it is treated as
untrusted. The cost is deliberate over-masking of a valid query truncated inside
a later literal (col='?'… rather than col='?', other=…). Complete valid
queries keep their full masked shape. The masking behaviour proven by the
executed test corpus covers valid SQL and the malformed shapes recorded there;
it is still a regex filter, not a full PostgreSQL lexer, so it makes no absolute
guarantee — run dbhealth verify --json-output on your own query patterns to
confirm exactly what leaves your server.
Your database credentials never leave your server: the agent reads directly
from Postgres and only ever ships the sanitized JSON body over an encrypted
connection (HTTPS; http://localhost/127.0.0.1 is permitted only for local
development and never reaches the network).
Install
Install only a version that has been published on PyPI and independently verified. Pin that exact release:
python -m pip install "dbhealth-agent==<released-version>"
While distribution is unverified, the DBHealth setup page withholds the install command. A pending Trusted Publisher alone does not make a package installable. This repository is private; its Git URL is not a public installation channel.
Contributor / local development install
If you already have a checkout of this repository (e.g. as a maintainer or a contributor with access), you can install the agent package in editable mode from your local checkout. This is a development-only command for people who already have the source on disk -- it is not a public distribution channel and will not work for anyone else:
# run from wherever you cloned the repository, adjusting the path below
pip install -e services/db-health-reporter/agent
Usage
Set credentials via environment variables, not --token/--dsn flags.
CLI flags are visible to any local user via ps aux and persist forever in
~/.bash_history; the token and DSN password deserve better than that. Every
command below reads DBHEALTH_TOKEN / DBHEALTH_DSN / DBHEALTH_API_URL
from the environment if the corresponding flag is omitted:
export DBHEALTH_DSN="postgresql://readonly_user:password@localhost:5432/yourdb"
export DBHEALTH_TOKEN=dh_xxxx
# Audit exactly what would be sent — nothing is sent
dbhealth verify
# Collect metrics and send them to the API
dbhealth run
# Install a weekly cron job (default: every Monday 08:00, server timezone) --
# writes DBHEALTH_TOKEN/DBHEALTH_DSN as their own crontab environment lines,
# never as part of the executed command, so they never appear in argv either
dbhealth install-cron
Run dbhealth --help for the full command list.
Docker
The agent's container image is a one-shot job, not a daemon: it runs
dbhealth run, sends one report, and exits. docker compose up is not a
scheduler — it starts the container once and leaves it stopped — and a Docker
restart policy is not a timer either: restart: unless-stopped reads the
successful exit as a crash and re-runs the agent immediately, in a hot loop
against your database. The weekly cadence therefore comes from the host's
scheduler, running one container per occurrence:
0 8 * * 1 cd /srv/dbhealth && docker compose run --rm dbhealth-agent >> "$HOME/.local/state/dbhealth/dbhealth.log" 2>&1
Cron times are the host's local timezone, not UTC, unless that crontab sets
TZ/CRON_TZ.
No image is published yet. dbhealth docker-snippet fails closed while
that is true: it exits nonzero and tells you what is missing instead of
printing a compose service that names an image which would 404 on first run.
Until an image exists, use dbhealth install-cron — it schedules the same
weekly run without any container.
If you build and push your own image from this directory's Dockerfile, set
DBHEALTH_AGENT_IMAGE to its full reference — registry host, a namespace you
own, and a tag equal to this agent's version — and dbhealth docker-snippet
will print the compose service for it. Anything mutable is rejected: no
latest, no untagged reference, and no tag belonging to a different agent
version than the one printing the snippet.
Secrets stay out of the image and out of the compose file. The generated
service carries no credential values at all — it references a gitignored
.env file that defines DBHEALTH_TOKEN and DBHEALTH_DSN, so those values
never enter docker-compose.yml (usually committed), the crontab line, or
argv (ps aux is readable by every local user).
Metadata
Release files for dbhealth-agent 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dbhealth_agent-0.1.0.tar.gz | 44.3 kB | With provenance | Details for dbhealth_agent-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dbhealth_agent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dbhealth_agent-0.1.0-py3-none-any.whl |
Total release size: 86.8 kB
Release files / dbhealth_agent-0.1.0.tar.gz
| Download URL | dbhealth_agent-0.1.0.tar.gz |
|---|---|
| Size | 44.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37513f9e0e551df6cbc70aef4811b89c425c47914d3c5cb0c12fd3f06b023611
|
|
BLAKE2b-256 checksum How to use checksums |
c68bd261d7bab1aab9319f1312f2fd11124e7c790a5af0f5e487fa3815a06f62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logRelease files / dbhealth_agent-0.1.0-py3-none-any.whl
| Download URL | dbhealth_agent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 42.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
923a8a222e95fb28e56c4f8e607c68d4eedcb0f8988286990151742cb9fc5abd
|
|
BLAKE2b-256 checksum How to use checksums |
90e5550bef98ca74fba6fedd4d5103c992fa85aba6078f0a6cdb92cbbc6155cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logSecurity for dbhealth-agent 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for dbhealth_agent-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.