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_db.postgres.database.azure.com
DB_NAME=your_database_name
DB_USERNAME=your_monitoring_user
DB_PASSWORD=your_monitoring_user_password
AZURE_SUBSCRIPTION_ID=your_subscription_id
# AZURE_DB_SERVER_NAME=your_azure_server_resource_nameFill in the values step-by-step:
-
The
PGA_API_KEYcan be found in the pganalyze Settings page for your organization, under the API Access tab - The
DB_HOSTis the hostname of your Azure Database for PostgreSQL instance, e.g.your_db.postgres.database.azure.com - The
DB_NAMEis the database on the Azure Database for PostgreSQL instance you want to monitor - The
DB_USERNAMEandDB_PASSWORDshould be the credentials of the monitoring user we created in Step 1 - The
AZURE_SUBSCRIPTION_IDis the subscription ID of your Azure Database server - (optional) The
AZURE_DB_SERVER_NAMEis the exact name of your Azure Database server resource, as shown in the Azure Portal. It is inferred from aDB_HOSTlike<server name>.postgres.database.azure.com, so leave it out in that case. Set it ifDB_HOSTis an IP address or a custom DNS record, or if you’re using Azure Cosmos DB for PostgreSQL Cluster, where it is the name of your cluster.
If the VM has multiple Managed Identities assigned, specify the client ID of the specific Managed Identity created in Step 3
using the AZURE_AD_CLIENT_ID setting.
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 →