System Requirements
Before installing, verify your system meets these requirements:PostgreSQL Version
PostgreSQL 13-18 (recommended)PostgreSQL 9.1+ supported with reduced functionality
Operating System
Linux (amd64, arm64, armv7, ppc64le)Windows and macOS supported for development
Network
Port 9187 (exporter metrics endpoint)Access to PostgreSQL port 5432 (or custom port)
Permissions
PostgreSQL user with
pg_monitor role (PostgreSQL 10+)Or custom monitoring functions (PostgreSQL 9.x)Installation Methods
- Docker
- Binary
- From Source
- Kubernetes
Docker Installation
The fastest way to deploy postgres_exporter is using the official Docker image.Pull the Image
Images are published to both Quay.io (primary) and Docker Hub. Use
prometheuscommunity/postgres-exporter for Docker Hub.Basic Deployment
Production Deployment with Secrets
Use file-based secrets for production:Enable Optional Collectors
Pass command-line flags to enable additional collectors:Docker Compose
docker-compose.yml
Verify Installation
Configuration File
The exporter supports a YAML configuration file for advanced settings, particularly for multi-target monitoring.Create Configuration File
Createpostgres_exporter.yml:
postgres_exporter.yml
Use Configuration File
Database User Setup
Create a dedicated monitoring user with minimal required permissions.PostgreSQL 10 and Later
PostgreSQL 9.x
Older versions require creating helper functions:AWS RDS / Aurora
RDS restricts superuser functions. Use the master user or grant the monitoring user to master:Verify Installation
Run these commands to verify the exporter is working correctly:Next Steps
Configuration Reference
Complete guide to collectors, flags, and environment variables
Multi-Target Monitoring
Configure centralized monitoring for multiple PostgreSQL servers
Prometheus Integration
Set up scrape configs and alerting rules
Security Best Practices
Secure your exporter deployment