prometheus-community/postgres_exporter

A PostgreSQL metric exporter for Prometheus

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 44 minutes ago
Added to GitGenius on July 24th, 2022
Created on August 24th, 2015
Open Issues & Pull Requests: 264 (+0)
Number of forks: 831
Total Stargazers: 3,599 (+0)
Total Subscribers: 45 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 41.8 days
Mean response time: 485.7 days
90th percentile: 1901.4 days
Tracked items: 218

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 100% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Only 3% of issues opened in the past year have been closed. Three people close 90% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 119
New in 7 days: 4
Closed in 7 days: 0
Avg open age: 768 days
Stale 30+ days: 109
Stale 90+ days: 104

Recent activity

Opened in 7 days: 4
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • enhancement (16)
  • help wanted (16)
  • bug (8)
  • question (4)
  • documentation (3)
  • go (3)
  • invalid (2)
  • needs info (1)

Detailed Description

The postgres_exporter is a Prometheus exporter written in Go that collects and exposes metrics from PostgreSQL database servers. It enables monitoring of PostgreSQL instances by converting internal database statistics into Prometheus-compatible metrics that can be scraped and visualized in monitoring systems.

The exporter supports PostgreSQL versions 13 through 18 as verified by its CI testing. It is distributed as a Docker container image and can be deployed either as a sidecar alongside individual PostgreSQL instances or as a centralized service using the multi-target pattern. The multi-target functionality, currently in beta, allows a single exporter instance to monitor multiple PostgreSQL targets by accepting HTTP requests to the /probe endpoint with target DSN parameters, making it suitable for monitoring SaaS-managed PostgreSQL services where sidecar deployment is not feasible.

The exporter provides extensive configurability through command-line flags and environment variables. It includes numerous collector modules that can be individually enabled or disabled, covering database statistics, replication status, transaction activity, WAL archiving, background writer statistics, table and index I/O metrics, and statement-level query statistics. Key collectors enabled by default include database metrics, locks, replication, replication slots, settings, statement activity, archiver statistics, background writer metrics, database statistics, vacuum progress, replication statistics, and user table statistics. Optional collectors disabled by default include database wraparound detection, long-running transaction tracking, postmaster metrics, idle process detection, autovacuum activity, checkpoint statistics, WAL receiver status, index I/O metrics, WAL metrics, and xlog location tracking.

Configuration is managed through a YAML file that supports auth_modules for defining preset authentication credentials, allowing sensitive connection information to be kept out of URLs when using the multi-target endpoint. The exporter accepts data source configuration through multiple environment variables including DATA_SOURCE_NAME, DATA_SOURCE_URI, and file-based variants for usernames and passwords, supporting secure credential management through mounted files rather than environment variables.

The repository shares contributors with microsoft/vscode, keycloak/keycloak, and microsoft/typescript, indicating cross-project collaboration within the broader open-source ecosystem.

The exporter includes advanced features such as configurable collection timeouts to prevent connection exhaustion when databases respond slowly, support for custom queries through external YAML files, metric prefix customization, and flexible logging with both logfmt and JSON output formats. It can be deployed with systemd socket activation on Linux systems and supports TLS and basic authentication through web configuration files.