{"id":13582377,"url":"https://github.com/pganalyze/collector","last_synced_at":"2026-01-21T08:14:44.087Z","repository":{"id":37444883,"uuid":"54454727","full_name":"pganalyze/collector","owner":"pganalyze","description":"pganalyze statistics collector for gathering PostgreSQL metrics and log data","archived":false,"fork":false,"pushed_at":"2025-03-28T22:49:19.000Z","size":36797,"stargazers_count":356,"open_issues_count":28,"forks_count":65,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-04-01T08:30:02.772Z","etag":null,"topics":["database","metrics","monitoring","postgresql","rds"],"latest_commit_sha":null,"homepage":"https://pganalyze.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pganalyze.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-22T07:36:55.000Z","updated_at":"2025-03-28T22:49:22.000Z","dependencies_parsed_at":"2023-10-17T06:03:05.554Z","dependency_job_id":"c05e5dfa-9d05-4d29-963a-5c9326abe741","html_url":"https://github.com/pganalyze/collector","commit_stats":{"total_commits":1128,"total_committers":24,"mean_commits":47.0,"dds":0.276595744680851,"last_synced_commit":"27007812479a9499b05a1deedb37154e92168b45"},"previous_names":[],"tags_count":115,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pganalyze%2Fcollector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pganalyze%2Fcollector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pganalyze%2Fcollector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pganalyze%2Fcollector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pganalyze","download_url":"https://codeload.github.com/pganalyze/collector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"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":["database","metrics","monitoring","postgresql","rds"],"created_at":"2024-08-01T15:02:39.521Z","updated_at":"2025-10-07T05:01:51.552Z","avatar_url":"https://github.com/pganalyze.png","language":"Go","funding_links":[],"categories":["Go","Monitoring/Statistics/Perfomance"],"sub_categories":["Samples"],"readme":"pganalyze collector\n===================\n\nThis is a Go-based daemon which collects various information about Postgres databases\nas well as queries run on it.\n\nAll data is converted to a protocol buffers structure which can then be used as data source for monitoring \u0026 graphing systems. Or just as reference on how to pull information out of PostgreSQL.\n\nIt currently collects information about\n\n * Schema\n   * Tables (including column, constraint and trigger definitions)\n   * Indexes\n * Statistics\n   * Tables\n   * Indexes\n   * Database\n   * Queries\n * OS\n   * CPU\n   * Memory\n   * Storage\n\nInstallation\n------------\n\nThe collector is available in multiple convenient options:\n\n* APT/YUM packages: https://packages.pganalyze.com/\n* Docker sidekick service, see details further down in this file\n\nConfiguration (APT/YUM Packages)\n--------------------------------\n\nAfter the package was installed, you can find the configuration in /etc/pganalyze-collector.conf\n\nAdjust the values in that file by adding your API key (found in the pganalyze dashboard, use one per database server), and database connection credentials.\n\nYou can repeat the configuration block with a different `[name]` if you have multiple servers to monitor.\n\nSee https://pganalyze.com/docs/install for further details.\n\n\nSetting up a Restricted Monitoring User\n---------------------------------------\nSee https://pganalyze.com/docs/install/self_managed/01_create_monitoring_user (or the corresponding\ninstructions for your platform) for details.\n\n\nExample output\n--------------\n\nTo get a feel for the data that is collected you can run the following command. This will show the data that would be sent (in JSON format), without sending it:\n\n\n```sh\npganalyze-collector --dry-run\n```\n\nDon't hesitate to reach out to support@pganalyze.com if you have any questions about what gets sent, or how to adjust the collector data collection.\n\n\nDocker Container (RDS)\n----------------------\n\nIf you are monitoring an RDS database and want to run the collector inside Docker, we recommend the following:\n\n```sh\ndocker pull quay.io/pganalyze/collector:stable\ndocker run \\\n  --rm \\\n  --name pganalyze-mydb \\\n  -e DB_URL=postgres://username:password@my-instance-id.account.us-east-1.rds.amazonaws.com/mydb \\\n  -e PGA_API_KEY=YOUR_PGANALYZE_API_KEY \\\n  -e AWS_INSTANCE_ID=YOUR_RDS_DB_IDENTIFIER \\\n  quay.io/pganalyze/collector:stable\n```\n\nYou'll need to set PGA_API_KEY, DB_URL, and AWS_INSTANCE_ID with the correct values.\n\nPlease also note that the EC2 instance running your Docker setup needs to have an IAM role that allows Cloudwatch access: https://pganalyze.com/docs/install/amazon_rds/iam_policy\n\nTo get better data quality for server metrics, enable \"Enhanced Monitoring\" in your RDS dashboard. The pganalyze collector will automatically pick this up and get all the metrics.\n\nWe currently require one Docker container per RDS instance monitored.\n\nIf you have multiple databases on the same RDS instance, you can monitor them all by specifying DB_ALL_NAMES=true as an environment variable.\n\nDocker Container (non-RDS)\n--------------------------\n\nIf the database you want to monitor is running inside a Docker environment you can use the Docker image:\n\n```sh\ndocker pull quay.io/pganalyze/collector:stable\ndocker run \\\n  --name my-app-pga-collector \\\n  --link my-app-db:db \\\n  --env-file collector_config.env \\\n  quay.io/pganalyze/collector:stable\n```\n\ncollector_config.env needs to look like this:\n\n```sh\nPGA_API_KEY=$YOUR_API_KEY\nPGA_ALWAYS_COLLECT_SYSTEM_DATA=true\nDB_NAME=your_database_name\nDB_USERNAME=your_database_user\nDB_PASSWORD=your_database_password\n```\n\nThe only required arguments are PGA_API_KEY (found in the [pganalyze](https://pganalyze.com/) dashboard) and DB_NAME. Only specify `PGA_ALWAYS_COLLECT_SYSTEM_DATA` if the database is running on the same host and you'd like the collector to gather system metrics (from inside the container).\n\nNote: You can add ```-v /path/to/database/volume/on/host:/var/lib/postgresql/data``` in order to collect I/O statistics from your database (this requires that it runs on the same machine).\n\n\nHeroku Monitoring\n-----------------\n\nWhen monitoring a Heroku Postgres database, it is recommended you deploy the collector as its own app inside your Heroku account.\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://www.heroku.com/deploy?template=https://github.com/pganalyze/collector)\n\nFollow the instructions in the pganalyze documentation to add your databases to the collector.\n\n\nSuccess/Error Callbacks\n-----------------------\n\nIn case you want to run a script based on data collection running successfully\nand/or failing, you can set the `success_callback` and `error_callback` options:\n\n```\n[pganalyze]\n...\nerror_callback=/usr/local/bin/my_error_script.sh\n\n[mydb]\n...\n```\n\nNote that the callback is executed in a shell, so you can use shell expressions as well.\n\nThe script will also have the following environment variables set:\n\n* PGA_CALLBACK_TYPE (type of callback, `error` or `success`)\n* PGA_CONFIG_SECTION (server that was processed, `mydb` in this example)\n* PGA_SNAPSHOT_TYPE (type of data that was processed, currently there are `full` snapshots, as well as `logs` snapshots which contain only log data)\n* PGA_ERROR_MESSAGE (error message, in the case of the error callback)\n\n\nHelm Chart\n----------\n\nYou can install the Helm chart for the collector like the following:\n\n```bash\nhelm repo add pganalyze https://charts.pganalyze.com/\nhelm install my-collector pganalyze/pganalyze-collector --values=myvalues.yml\n```\n\nYou can find values for this chart using `helm show values pganalyze/pganalyze-collector`,\nor you can also find in the [README in the Helm chart directory](/contrib/helm/pganalyze-collector/README.md).\n\nLicense\n-------\n\npganalyze-collector is licensed under the 3-clause BSD license, see LICENSE file for details.\n\nCopyright (c) 2012-2023, Duboce Labs, Inc. (pganalyze)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpganalyze%2Fcollector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpganalyze%2Fcollector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpganalyze%2Fcollector/lists"}