Step 4: Configure the Collector
Configuring the collector with Docker
Create your configuration file (e.g. named pganalyze_collector.env
) with environment variables like this:
PGA_API_KEY=undefined
DB_HOST=your_database_host
DB_NAME=your_database_name
DB_USERNAME=your_monitoring_user
DB_PASSWORD=your_monitoring_user_password
Fill in the values step-by-step:
- The
PGA_API_KEY
can be found in the pganalyze Settings page for your organization, under the API keys tab - The
DB_HOST
is the hostname of your PostgreSQL instance (usuallylocalhost
) - The
DB_NAME
is the database on the PostgreSQL server you want to monitor - The
DB_USERNAME
andDB_PASSWORD
should be the credentials of the monitoring user we created in Step 1
Test snapshot
Then run the following to test the configuration:
docker run --env-file pganalyze_collector.env quay.io/pganalyze/collector:stable test
After a successful test you can now start the collector in the background:
docker run -d --name pganalyze-collector --env-file pganalyze_collector.env quay.io/pganalyze/collector:stable
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 →