PostgreSQL monitoring integration
The New Relic PostgreSQL on-host integration receives and sends inventory metrics from your PostgreSQL instance to the New Relic platform, where you can aggregate and visualize key performance metrics. Data from instances, databases, and clusters helps you find the source of problems.
Important
For best results, regularly update the integration package and the infrastructure agent.
PostgreSQL users and permissions
If you also want to obtain table and index-related metrics (for example, table size and index size), the PostgreSQL role used by the integration (new_relic
) also needs SELECT
permissions on the tables from which it will gather metrics from. For example, to allow the integration to collect metrics from all the tables and indexes present in the database (in the public schema
), use the following:
GRANT SELECT ON ALL TABLES IN SCHEMA public TO new_relic;
If you also want to obtain query-level metrics from the PostgreSQL custom query config file, the PostgreSQL role used by the integration (new_relic
) needs to be added to the (pg_read_all_stats
) role. This is due to the user leveraging the (pg_stat_statements
) extension.
GRANT pg_read_all_stats TO new_relic;
Enabling the pg_stat_statements
extension may require you to manually create it from a query prompt:
CREATE EXTENSION pg_stat_statements;
The postgresql-config.yml
file
The postgresql-config.yml
file is the integration's YAML-format configuration where you can place required login credentials and configure how data is collected. Which options you change depend on your setup and preference. The configuration file has common settings applicable to all integrations, such as interval
, timeout
, inventory_source
.
Specific settings related to PostgreSQL are defined using the env section of the postgresql-config.yml
file. These settings control the connection to your PostgreSQL instance as well as other security settings and features.
See these more complex config examples.
For more about the general structure of on-host integration configuration, see On-host integration configuration overview.
Metrics collected by the integration
The PostgreSQL integration collects the following metrics. Some metric names are prefixed with a category indicator and a period, such as db.
or index.
.