Atatus Database Monitoring offers comprehensive monitoring for your Heroku Postgres databases, providing valuable insights into query performance, query samples, execution plans, connection details, and system statistics. Because Heroku does not give you direct host access, the Atatus Infra Agent runs on a separate machine (an EC2/GCE VM, a Heroku Dyno running the Atatus buildpack, etc.) and connects to the Heroku Postgres endpoint over SSL.

Before You Begin

Setup Database Access for the Agent

  1. Create a dedicated Heroku credential for the Agent and attach it to your database:
    This creates a new HEROKU_POSTGRESQL_<COLOR>_URL config var containing the connection URL the Atatus Agent should use.
  2. Connect to the database using the new credential and grant monitoring access:
  3. Create the explain function:
Heroku Postgres does not give you superuser access. The pg_monitor role grants the read access the Agent needs without elevated privileges.

Configure Atatus Infrastructure Agent

  1. Install the Atatus Infrastructure agent on a host that can reach your Heroku Postgres endpoint.
  2. Find the connection details from the credential you created. Run heroku config --app <YOUR_APP> and locate the HEROKU_POSTGRESQL_<COLOR>_URL value matching the atatus credential. The URL has the form:
  3. Update the PostgreSQL configuration file at /etc/atatus-infra-agent/conf.d/postgresql.d/postgresql.yml:
    Heroku Postgres requires SSL, so ssl: true is mandatory.
  4. Restart the Atatus Infra Agent:

Running the Agent on a Heroku Dyno (Optional)

If you prefer to run the Atatus Infra Agent on a Heroku Dyno via the Atatus buildpack, you can derive the agent configuration from the HEROKU_POSTGRESQL_<COLOR>_URL environment variable at release time. Place a prerun script at atatus/prerun.sh (replace IVORY with your credential’s color):
Deploy:

Collecting Custom Metrics (Optional)