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=your-organization-api-key
DB_HOST=your_database_host
DB_NAME=your_database_name
DB_USERNAME=your_monitoring_user
DB_PASSWORD=your_monitoring_user_password
DB_SSLROOTCERT=rds-ca-global
DB_SSLMODE=verify-fullFill in the values step-by-step:
- The
PGA_API_KEYcan be found on the pganalyze Settings page for your organization under the API keys tab - The
DB_HOSTis the hostname / endpoint of your RDS instance (for Amazon Aurora you can use the cluster endpoint in many cases, see for details below) - The
DB_NAMEis the database name on the Postgres instance you want to monitor - The
DB_USERNAMEandDB_PASSWORDshould be the monitoring user we created in Step 2 - The
DB_SSLROOTCERTandDB_SSLMODEis the recommended SSL connection configuration that you can usually keep as specified above
Note: The pganalyze collector allows for more optional settings (e.g. AWS access keys, multiple database names)
Handling Amazon Aurora clusters vs instances
In the case of Amazon Aurora, the collector automatically resolves cluster endpoints to the underlying writer instance.
DB_HOST=mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.comThis will only monitor the writer instance. If you also want to monitor a reader instance, you'll need to use the Multiple Instances method above.
CONFIG_CONTENTS="[pganalyze]
api_key = 'your_pga_organization_api_key'
[writer_instance]
db_host = mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com
...
[reader_instance]
db_host = mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com
...
"Alternatively, you can run a separate Docker container to monitor a reader instance.
Create a new configuration file (e.g. named pganalyze_collector.replica.env) and use the cluster-ro endpoint as the DB_HOST:
DB_HOST=mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.comIf you have a cluster with multiple readers, you either need to add each instance
endpoint to the content of CONFIG_CONTENTS (e.g. add each sections like [reader_instance1], [reader_instance2]),
or run one pganalyze collector Docker container for each instance.
Test snapshot
Then run the following:
docker run --env-file pganalyze_collector.env quay.io/pganalyze/collector:stable testOnce 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 →