PG Exporter 1.4 Documentation
The ultimate monitoring experience for PostgreSQL with 600+ metrics, declarative configuration, and dynamic planning capabilities.
Get Started | GitHub | Live Demo
Features
| Feature | Description |
|---|---|
| Comprehensive Metrics | 600+ metrics covering nearly every statistics view of PostgreSQL (10-19+) and pgBouncer (1.8-1.25+) |
| Declarative Collectors | Every metric comes from a YAML collector definition — a SQL query plus execution conditions; add, change, or remove metrics without touching code |
| Dynamic Planning | Each collector branch is admitted per target based on version, primary/replica role, installed extensions, and tags |
| Auto-Discovery | Automatically discovers and scrapes every database in an instance, distinguished by the datname label |
| Health Check APIs | /up, /primary, /replica endpoints serve directly as load-balancer probes for primary/replica traffic routing |
| Smart Caching | Per-collector TTL caching decouples scrape frequency from query frequency — probe and scrape storms never reach the database |
| Snapshot Histograms | HISTOGRAM column type aggregates SQL snapshots into classic Prometheus histogram distributions |
| Extension Aware | Native support for pg_stat_statements, pg_wait_sampling, citus, and timescaledb |
| Production Ready | Battle-tested in real-world environments across 12K+ cores for 6+ years |
Version Info
- Current stable release:
v1.4.1 - Default config support: PostgreSQL 10-19+
- Legacy config support: PostgreSQL 9.1-9.6 via the
legacy/config bundle - pgBouncer support: 1.8-1.25+
See Release Notes for the full history.
Design Rationale
pg_exporter is built around a few simple production-oriented principles:
- Local-first connectivity: fall back to
postgresql:///?sslmode=disablewhen no explicit URL is provided, which fits same-host deployments - Declarative collection: metric behavior is driven by YAML collector definitions with precise control over
ttl,timeout,tags, andfatal - Dynamic planning: choose the appropriate collector branch at runtime based on server version, role, extensions, and tags
- Keep serving under failure: use non-blocking startup by default so HTTP endpoints still come up while the database is temporarily unavailable
- Hot reload: support
POST/GET /reloadandSIGHUPreloads, with extraSIGUSR1support on non-Windows platforms - Split probes from traffic: health endpoints use cached background probes instead of blocking the database on every request
- Tighten the management surface:
/reload,/explain, and/statexpose runtime and config details, so production deployments should protect them with--web.config.fileor keep them internal
Installation
PG Exporter provides multiple installation methods to fit your infrastructure:
Quick Start
Get PG Exporter up and running in minutes with Getting Started:
Documentation
- Getting Started - Quick start guide and basic concepts
- Installation - Installation instructions for all platforms
- Configuration - Configuration reference and examples
- Deployment - Production deployment best practices
- Collectors - Detailed documentation for all metric collectors
Live Demo
Experience PG Exporter in action with our live demo environment: https://g.pgsty.com
The demo showcases real PostgreSQL clusters monitored by PG Exporter, featuring:
- Real-time metrics visualization with Grafana
- Multiple PostgreSQL versions and configurations
- Extension-specific metrics and monitoring
- Complete observability stack powered by Pigsty
Community & Support
- GitHub - Source code, issues, and contributions
- Discussions - Ask questions and share experiences
- Pigsty - Complete PostgreSQL Distro with PG Exporter
License
PG Exporter is open-source software licensed under the Apache License 2.0.
Copyright 2018-2026 © Ruohang Feng / [email protected]
Get pg_exporter running and see PostgreSQL metrics in Prometheus within ten minutes
How to download and install the pg_exporter
Production deployment — connection & credentials, systemd / Docker / Kubernetes, auto-discovery and alerting
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)