This is the multi-page printable view of this section. Click here to print.
PG Exporter Documentation
Install, deploy, secure, operate, and extend pg_exporter.
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
| Guide | Use it when you need to… |
|---|---|
| Introduction | Understand the architecture, execution model, and operational boundaries |
| Getting Started | Get a working exporter and Prometheus target in about ten minutes |
| Installation | Choose RPM, DEB, tarball, Docker, Pigsty, or source installation |
| Compatibility | Check PostgreSQL, pgBouncer, OS, CPU, package, and container support |
Run It in Production
| Guide | What it covers |
|---|---|
| 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
| Reference | What it covers |
|---|---|
| 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.
For source code, issues, and contributions, visit pgsty/pg_exporter.