PG Exporter
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 | Monitor PostgreSQL (10-18+) and pgBouncer (1.8-1.24+) with 600+ metrics and ~3K time series per instance |
| Declarative Configuration | Define custom metrics through YAML configs with fine-grained control over timeout, caching, and skip conditions |
| Custom Collectors | Define your own metrics with declarative YAML configuration and dynamic query planning |
| Auto-Discovery | Automatically discover and monitor multiple databases within a PostgreSQL instance |
| Dynamic Planning | Automatically adapt metric collection based on PostgreSQL version, extensions, and server characteristics |
| Production Ready | Battle-tested in real-world environments across 12K+ cores for 6+ years with enterprise reliability |
| Health Check APIs | Comprehensive HTTP endpoints for service health and traffic routing with primary/replica detection |
| Smart Caching | Built-in caching mechanism with configurable TTL to reduce database load and improve performance |
| Extension Aware | Native support for TimescaleDB, Citus, pg_stat_statements, pg_wait_sampling and automatic detection |
Installation
PG Exporter provides multiple install methods to fit your infrastructure:
docker run -d --name pg_exporter -p 9630:9630 -e PG_EXPORTER_URL="postgres://user:pass@host:5432/postgres" pgsty/pg_exporter:latest# RPM-based systems
sudo tee /etc/yum.repos.d/pigsty-infra.repo > /dev/null <<-'EOF'
[pigsty-infra]
name=Pigsty Infra for $basearch
baseurl=https://repo.pigsty.io/yum/infra/$basearch
enabled = 1
gpgcheck = 0
module_hotfixes=1
EOF
sudo yum makecache;
sudo yum install -y pg_exportersudo tee /etc/apt/sources.list.d/pigsty-infra.list > /dev/null <<EOF
deb [trusted=yes] https://repo.pigsty.io/apt/infra generic main
EOF
sudo apt update;
sudo apt install -y pg-exporterwget https://github.com/pgsty/pg_exporter/releases/download/v1.1.1/pg_exporter-1.1.1.linux-amd64.tar.gz
tar -xf pg_exporter-1.1.1.linux-amd64.tar.gz
sudo install pg_exporter-1.1.1.linux-amd64/pg_exporter /usr/bin/
sudo install pg_exporter-1.1.1.linux-amd64/pg_exporter.yml /etc/pg_exporter.yml# Build from source
git clone https://github.com/pgsty/pg_exporter.git
cd pg_exporter
make buildQuick Start
Get PG Exporter up and running in minutes, Getting Started with:
# Run with PostgreSQL URL
PG_EXPORTER_URL='postgres://user:pass@localhost:5432/postgres' pg_exporter
# Access metrics
curl http://localhost:9630/metrics
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-2025 © Ruohang Feng / [email protected]
Installation
How to download and install the pg_exporter
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.