Postgres Monitor Logo
Alpha Release

Demo Account

demo@postgresmonitor.com

Configuring & Setting Up Your Agent

Page Outline

Overview

The Postgres Monitor agent collects data from PostgreSQL databases to help identify, troubleshoot and improve database performance.

The agent's default settings are recommended for collecting the most useful data but some teams may want to disable collecting certain types of data.

Collected Data

  • Redacted queries with aggregated statistics
  • Redacted EXPLAIN plans for logged slow queries
  • Table and index schemas with aggregated statistics
  • Connection statistics
  • Replication statistics
  • PgBouncer statistics
  • Heroku logged statistics (ex. load avg and disk metrics)
  • Postgres metadata (ex. database version and pg_settings)

Setting up Heroku Logs

Heroku writes useful metrics and slow queries from Postgres to your application's logs.

Sending these Heroku PostgreSQL logs to the agent will allow the agent to report server health metrics such as Load Avg and IOPS, as well as logged slow queries and EXPLAIN plans.

To enable Heroku logging for the agent, follow the Attach Logs instructions for Account Setup.

Environment Variables

The agent is configured by environment variables which control what data is collected.

For Heroku, you would set a given environment variable with:

$ heroku -a <agent-name> config:set ENV_VAR=value

POSTGRES_MONITOR_API_KEY

The Postgres Monitor API key. This key is set automatically by the Postgres Monitor Heroku add-on. Rotating API keys in the Postgres Monitor dashboard will automatically update your API key for you.

LOG_LEVEL

The agent log level.

Default: info

Valid values: debug, info, warn, error

LOG_POSTGRES_LOGS

Enable/disable logging of PostgreSQL logs.

The agent can be set up during account setup to listen to PostgreSQL logs. These logs contain useful information such as slow queries or errors. By default, these PostgreSQL logs are not logged by the agent.

Default: false

Valid values: true, false

MONITOR_AGENT_QUERIES

Enable/disable collection of Postgres Monitor's agent queries. By default, agent queries to PostgreSQL's statistics and information tables are ignored.

Default: false

Valid values: true, false

MONITOR_PGBOUNCER

Enable/disable collection of PgBouncer statistics. By default, statistics are only reported if PgBouncer is installed and in use on the PostgreSQL server.

Default: true

Valid values: true, false

MONITOR_QUERY_STATS

Enable/disable collection of query statistics from pg_stat_statements.

Default: true

Valid values: true, false

MONITOR_REPLICATION

Enable/disable collection of replication statistics. By default, statistics are only reported if replication is running.

Default: true

Valid values: true, false

MONITOR_SCHEMA

Enable/disable collection of table & index schemas. Data includes columns as well as table & index statistics.

Default: true

Valid values: true, false

MONITOR_SETTINGS

Enable/disable collection of settings from pg_settings.

Default: true

Valid values: true, false