Join more than 25k Postgres enthusiasts and sign up for our newsletter!

Step 5: Configure the Collector

Create your configuration file (e.g. named pganalyze_collector.env) with environment variables like this:

PGA_API_KEY=your_pga_organization_api_key
DB_HOST=your_database_host
DB_PORT=your_database_port
DB_NAME=your_database_name
DB_USERNAME=your_monitoring_user
DB_PASSWORD=your_monitoring_user_password

Fill in the values from the info in your Aiven console:

Aiven database settings screenshot
  1. The PGA_API_KEY can be found in the pganalyze Settings page for your organization, under the API keys tab
  2. The DB_HOST is the hostname of your PostgreSQL instance (example.aivencloud.com above)
  3. The DB_PORT is the port your PostgreSQL server is running on (12448 above)
  4. The DB_NAME is the database you want to monitor (defaultdb above--make sure this is the same database where you created the pg_stat_statements extension in Step 2)
  5. The DB_USERNAME and DB_PASSWORD should be the credentials of the monitoring user we created in Step 1

Test snapshot

Then run the following:

docker run --env-file pganalyze_collector.env quay.io/pganalyze/collector:stable test

Once you've confirmed the install is successful and you're receiving query data in pganalyze, we recommend setting up Log Insights as a follow-up step, to automatically track log events in your database.


Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →