{"id":37123008,"url":"https://github.com/lovoo/postgres_exporter","last_synced_at":"2026-01-14T14:12:48.707Z","repository":{"id":45515943,"uuid":"53332190","full_name":"lovoo/postgres_exporter","owner":"lovoo","description":"A PostgresSQL metric exporter for Prometheus","archived":false,"fork":true,"pushed_at":"2016-02-18T09:47:19.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-06-21T01:44:14.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"prometheus-community/postgres_exporter","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lovoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-07T14:36:46.000Z","updated_at":"2021-02-17T15:16:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lovoo/postgres_exporter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lovoo/postgres_exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovoo%2Fpostgres_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovoo%2Fpostgres_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovoo%2Fpostgres_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovoo%2Fpostgres_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovoo","download_url":"https://codeload.github.com/lovoo/postgres_exporter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovoo%2Fpostgres_exporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28422408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T14:12:47.964Z","updated_at":"2026-01-14T14:12:48.645Z","avatar_url":"https://github.com/lovoo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostgresSQL Server Exporter\n\nPrometheus exporter for PostgresSQL server metrics.\nSupported Postgres versions: 9.1 and up.\n\n## Building and running\n\n    make\n    export DATA_SOURCE_NAME=\"postgres://postgres:password@localhost/?sslmode=disable\"\n    ./postgres_exporter \u003cflags\u003e\n\nSee the [github.com/lib/pq](http://github.com/lib/pq) module for other ways to format the connection string.\n\n### Flags\n\nName               | Description\n-------------------|------------\nweb.listen-address | Address to listen on for web interface and telemetry.\nweb.telemetry-path | Path under which to expose metrics.\n\n### Setting the Postgres server's data source name\n\nThe PostgresSQL server's [data source name](http://en.wikipedia.org/wiki/Data_source_name)\nmust be set via the `DATA_SOURCE_NAME` environment variable.\n\nFor running it locally on a default Debian/Ubuntu install, this will work (transpose to init script as appropriate):\n\n    sudo -u postgres DATA_SOURCE_NAME=\"user=postgres host=/var/run/postgresql/ sslmode=disable\" postgres_exporter\n\n### Adding new metrics\n\nThe exporter will attempt to dynamically export additional metrics if they are added in the\nfuture, but they will be marked as \"untyped\". Additional metric maps can be easily created\nfrom Postgres documentation by copying the tables and using the following Python snippet:\n\n```python\nx = \"\"\"tab separated raw text of a documentation table\"\"\"\nfor l in StringIO(x):\n    column, ctype, description = l.split('\\t')\n    print \"\"\"\"{0}\" : {{ prometheus.CounterValue, prometheus.NewDesc(\"pg_stat_database_{0}\", \"{2}\", nil, nil) }}, \"\"\".format(column.strip(), ctype, description.strip())\n```\nAdjust the value of the resultant prometheus value type appropriately. This helps build\nrich self-documenting metrics for the exporter.\n\n\n### Running as non-superuser\n\nTo be able to collect metrics from pg_stat_activity and pg_stat_replication as non-superuser you have to create functions and views to do so.\n\n```sql\nCREATE USER postgres_exporter PASSWORD 'password';\nALTER USER postgres_exporter SET SEARCH_PATH TO postgres_exporter,pg_catalog;\n\nCREATE SCHEMA postgres_exporter AUTHORIZATION postgres_exporter;\n\nCREATE FUNCTION postgres_exporter.f_select_pg_stat_activity()\nRETURNS setof pg_catalog.pg_stat_activity\nLANGUAGE sql\nSECURITY DEFINER\nAS $$\n  SELECT * from pg_catalog.pg_stat_activity;\n$$;\n\nCREATE FUNCTION postgres_exporter.f_select_pg_stat_replication()\nRETURNS setof pg_catalog.pg_stat_replication\nLANGUAGE sql\nSECURITY DEFINER\nAS $$\n  SELECT * from pg_catalog.pg_stat_replication;\n$$;\n\nCREATE VIEW postgres_exporter.pg_stat_replication\nAS\n  SELECT * FROM postgres_exporter.f_select_pg_stat_replication();\n\nCREATE VIEW postgres_exporter.pg_stat_activity\nAS\n  SELECT * FROM postgres_exporter.f_select_pg_stat_activity();\n\nGRANT SELECT ON postgres_exporter.pg_stat_replication TO postgres_exporter;\nGRANT SELECT ON postgres_exporter.pg_stat_activity TO postgres_exporter;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovoo%2Fpostgres_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovoo%2Fpostgres_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovoo%2Fpostgres_exporter/lists"}