Prerequisites
- PostgreSQL Server Exporter binary installed (see Binary Deployment)
- systemd-based Linux distribution
- PostgreSQL database accessible from the host
Service Setup
Service Configuration Options
Using Configuration File
For multi-target or advanced setups:Using Unix Socket
For local PostgreSQL using Unix sockets (common on Debian/Ubuntu): Update the environment file/etc/postgres_exporter/postgres_exporter.env:
Managing the Service
Start, Stop, Restart
Enable/Disable Auto-Start
Check Status
Advanced Configuration
systemd Socket Activation
Use systemd socket activation for on-demand service start:Resource Limits
Add resource constraints to the service file:Custom Collectors
Enable specific collectors:FreeBSD rc.d Service
For FreeBSD systems, use the provided rc.d script:Security Hardening
Troubleshooting
Service fails to start
Check logs for errors:Permission denied errors
Verify file ownership:postgres_exporter:postgres_exporter.