PG Exporter Documentation
PG Exporter is an advanced PostgreSQL and PgBouncer metrics exporter for Prometheus-compatible monitoring systems. It combines built-in availability and role metrics with a declarative SQL collector engine, so the metric surface can evolve independently of the Go binary.
These docs target the latest stable release, v1.4.1. They are maintained as a standalone, bilingual manual and are deliberately more detailed than the former Pigsty module pages.
Start Here
- Introduction — Understand the architecture, execution model, and operational boundaries.
- Quick Start — Get a working exporter and Prometheus target in about five minutes.
- Download — Choose, install, enable, and verify a package, archive, container, Pigsty, or source build.
- Installation — Look up the complete artifact and repository reference.
- Compatibility — Check PostgreSQL, PgBouncer, OS, CPU, package, and container support.
Run It in Production
- Production Deployment — Flags, environment variables, systemd, Docker, Kubernetes, discovery, scraping, and alerting.
- Security — Least-privilege database access, secrets, TLS, HTTP authentication, and network exposure.
- Troubleshooting — A symptom-driven runbook using logs,
/up,/explain,/stat, and config validation.
Understand and Extend It
- Collector Configuration — The complete YAML schema: queries, tags, predicates, TTL, timeout, labels, counters, gauges, and snapshot histograms.
- Bundled Collectors — All 58 definition files, collector groups, prerequisites, cost, and cardinality considerations.
- HTTP API — Metrics, health, role-routing, reload, explain, statistics, version, and landing endpoints.
- Development — Build, test, change collectors, regenerate merged configs, and understand release artifacts.
- Release Notes — One bilingual article per tagged version, newest first.
Documentation Contract
- Commands and paths are checked against the current
pg_exportersource tree and the v1.4.1 release artifacts. - Stable-release behavior is the default contract. Unreleased
mainbehavior is called out explicitly when relevant. - PostgreSQL 19 collector branches are included, but PostgreSQL’s own release status still determines whether a target is suitable for production.
- The English and Simplified Chinese pages are paired; use the language switcher to move between equivalent pages.
Open the Command Palette from any page with Ctrl with K on Windows/Linux or ⌘ with K on macOS. Type > to browse site and page commands without loading the search index. The optional Open in ChatGPT and Open in Claude actions are external handoffs; activating one sends the current page URL, including any query string or fragment, to that service.
For source code, issues, and contributions, visit pgsty/pg_exporter.