PG Exporter: Containerized Metrics
app/pg_exporter provides a standalone PG Exporter container example for collecting metrics from external PostgreSQL instances. Pigsty’s PGSQL module already manages a native exporter; choose a separate port for this template to avoid conflicts.
Quick Start
The default image is pgsty/pg_exporter without a pinned version tag. .env uses the least-privilege monitoring account dbuser_monitor. The default metrics endpoint is http://127.0.0.1:9632/metrics, and the host port mapping binds to all interfaces by default.
Ports and Metrics
PG_EXPORTER_PORT controls the published host port. The container’s PG_EXPORTER_LISTEN_ADDRESS must use :PORT format (such as :9730, without an IP address or hostname). Compose passes it to both --web.listen-address and the container target port mapping so they stay aligned.
make view uses Python 3 to parse the effective Compose configuration, including environment variables and COMPOSE_ENV_FILES overrides, then requests the actual published port and PG_EXPORTER_TELEMETRY_PATH.
The database account needs the monitoring privileges required by the selected collectors. Replace example passwords before deployment, configure TLS and HBA for the actual network, and restrict access to the metrics port.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)