{"id":17651384,"url":"https://github.com/rnaveiras/postgres_exporter","last_synced_at":"2025-04-28T15:50:14.140Z","repository":{"id":28250084,"uuid":"112318419","full_name":"rnaveiras/postgres_exporter","owner":"rnaveiras","description":"Postgres exporter","archived":false,"fork":false,"pushed_at":"2025-04-28T14:25:19.000Z","size":6656,"stargazers_count":19,"open_issues_count":5,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T15:36:32.955Z","etag":null,"topics":["postgres","postgresql","prometheus","prometheus-exporter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnaveiras.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-11-28T10:02:29.000Z","updated_at":"2025-04-28T14:25:22.000Z","dependencies_parsed_at":"2024-12-20T22:28:03.851Z","dependency_job_id":"bdb28ab9-a0d5-4cae-b050-08919ef6f7c6","html_url":"https://github.com/rnaveiras/postgres_exporter","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnaveiras%2Fpostgres_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnaveiras%2Fpostgres_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnaveiras%2Fpostgres_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnaveiras%2Fpostgres_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnaveiras","download_url":"https://codeload.github.com/rnaveiras/postgres_exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342693,"owners_count":21574242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgres","postgresql","prometheus","prometheus-exporter"],"created_at":"2024-10-23T11:42:01.641Z","updated_at":"2025-04-28T15:50:14.124Z","avatar_url":"https://github.com/rnaveiras.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postgres exporter\n\nPrometheus exporter for PostgreSQL server metrics.\n\n## Collectors\n\n- disk_usage\n- stat_activity\n- stat_archiver\n- stat_bgwriter\n- stat_database\n- stat_progress_vacuum\n- stat_replication\n- stat_user_indexes\n- stat_user_tables\n- info\n- locks\n\n## Exported Metrics\n\n| Metric | Meaning | Labels |\n| ------ | ------- | ------ |\n| postgres_disk_usage_index_bytes| Number of bytes used on disk to store this index | datname, schemaname, relname, indexname |\n| postgres_disk_usage_table_bytes| Number of bytes used on disk to store this table | datname, schemaname, relname |\n| postgres_in_recovery | Whether Postgres is in recovery | |\n| postgres_info| Postgres version | version |\n| postgres_stat_activity_connections | Number of current connections in their current state | datname, state |\n| postgres_stat_activity_oldest_backend_timestamp| Oldest backend timestamp (epoch) | |\n| postgres_stat_activity_oldest_query_active_seconds| Oldest query in running state | |\n| postgres_stat_activity_oldest_snapshot_seconds | Oldest Snapshot | |\n| postgres_stat_activity_oldest_xact_seconds | Oldest transaction | |\n| postgres_stat_archiver_archived_total | Number of WAL files that have been successfully archived | |\n| postgres_stat_archiver_failed_total   | Number of failed attempts for archiving WAL files | |\n| postgres_stat_archiver_stats_reset_timestamp | Time at which these statistics were last reset | |\n| postgres_stat_bgwriter_buffers_allow_total | Number of buffers allocated | |\n| postgres_stat_bgwriter_buffers_backend_fsync_total | Number of times a backend had to execute its own fsync call | |\n| postgres_stat_bgwriter_buffers_backend_total | Number of buffers written directly  by a backend | |\n| postgres_stat_bgwriter_buffers_checkpoint_total | Number of buffers written during checkpoints | |\n| postgres_stat_bgwriter_buffers_clean_total | Number of buffers written by the background writer | |\n| postgres_stat_bgwriter_checkpoint_sync_time_seconds_total | Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk | |\n| postgres_stat_bgwriter_checkpoint_write_time_seconds_total | Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk | |\n| postgres_stat_bgwriter_checkpoints_req_total | Number of requested checkpoints that have been performed | |\n| postgres_stat_bgwriter_checkpoints_timed_total | Number of scheduled checkpoints that have been performed | |\n| postgres_stat_bgwriter_maxwritten_clean_total | Number of times the background writter stopped a cleaning scan because it had written too many buffers | |\n| postgres_stat_bgwriter_stats_reset_timestamp | Time at wich these statistics were last reset | |\n| postgres_stat_database_blks_hit_total | Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache) | datname |\n| postgres_stat_database_blks_read_total | Number of disk blocks read in this database | datname |\n| postgres_stat_database_conflicts_total | Number of queries canceled due to conflicts with recovery in this database | datname |\n| postgres_stat_database_deadlocks_total | Number of deadlocks detected in this database | datname |\n| postgres_stat_database_numbackends | Number of backends currently connected to this database | datname |\n| postgres_stat_database_temp_bytes_total | Total amount of data written to temporary files by queries in this database | datname |\n| postgres_stat_database_temp_files_total | Number of temporary files created by queries in this database | datname |\n| postgres_stat_database_tup_deleted_total | Number of rows deleted by queries in this database | datname |\n| postgres_stat_database_tup_fetched_total | Number of rows fetched by queries in this database | datname |\n| postgres_stat_database_tup_inserted_total | Number of rows inserted by queries in this database | datname |\n| postgres_stat_database_tup_returned_total | Number of rows returned by queries in this database | datname |\n| postgres_stat_database_tup_updated_total | Number of rows updated by queries in this database | datname |\n| postgres_stat_database_xact_commit_total | Number of transactions in this database that have been committed | datname |\n| postgres_stat_database_xact_rollback_total | Number of transactions in this database that have been rolled back | datname |\n| postgres_stat_replication_lag_bytes | Replication Lag in bytes | application_name, client_addr, state, sync_state |\n| postgres_stat_vacuum_progress_heap_blks_scanned | Number of heap blocks scanned | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_heap_blks_total | Total number of heap blocks in the table | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_heap_blks_vacuumed | Number of heap blocks vacuumed | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_index_vacuum_count | Number of completed index vacuum cycles | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_max_dead_tuples | Number of dead tuples that we can store before needing to perform an index vacuum cycle | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_num_dead_tuples | Number of dead tuples collected since the last index vacuum cycle | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_phase_cleaning_up_indexes | VACUUM is currently cleaning up indexes | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_phase_initializing | VACUUM is preparing to begin scanning the heap | pid, query_start, schemaname, datname, relnam\n| postgres_stat_vacuum_progress_phase_performing_final_cleanup | VACUUM is performing final cleanup | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_phase_scanning_heap | VACUUM is currently scanning the heap | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_phase_truncating_heap | VACUUM is currently truncating the heap | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_phase_vacuuming_heap | VACUUM is currently vacuuming the heap | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_phase_vacuuming_indexes | VACUUM is currently vacuuming the indexes | pid, query_start, schemaname, datname, relname |\n| postgres_stat_vacuum_progress_running | VACUUM is running | pid, query_start, schemaname, datname, relname |\n| postgres_stat_user_indexes_scan_total | Number of times this index has been scanned | datname, schemaname, tablename, indexname |\n| postgres_stat_user_indexes_tuple_read_total | Number of times tuples have been returned from scanning this index | datname, schemaname, tablename, indexname |\n| postgres_stat_user_indexes_tuple_fetch_total | Number of live tuples fetched by scans on this index | datname, schemaname, tablename, indexname |\n| postgres_up | Whether the Postgres server is up | |\n\n### Run\n\n#### Passing in a libpq connection string\n\n```\n./postgres_exporter \\\n    --db.data-source=\"user=postgres host=/var/run/postgresql\"\n```\n\n#### Using the PG* environment variables\n\n- Set the [libpq PG* envvars](https://www.postgresql.org/docs/current/libpq-envars.html) like so:\n\n```\nexport PGHOST=/var/run/postgresql\nexport PGUSER=postgres\n```\n\n- or in a [pgservicefile](https://www.postgresql.org/docs/current/libpq-pgservice.html)\n\n```\nexport PGSERVICEFILE=/var/run/cloudsql/pg_service.conf\n```\n\n- then, invoke the `postgres_exporter` binary\n\n```\n./postgres_exporter\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnaveiras%2Fpostgres_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnaveiras%2Fpostgres_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnaveiras%2Fpostgres_exporter/lists"}