Configuring PostgreSQL monitoring

Configure the Monitoring Agent for PostgreSQL so that the agent can collect data from the PostgreSQL database that is being monitored.

Before you begin

You must install the PostgreSQL JDBC driver before you install the PostgreSQL agent. The path to PostgreSQL JDBC driver is required at the time of agent configuration.

JDBC type 4 driver is the most recent version and hence must be preferred. User can install the subtype of JDBC 4 version according to the JDK version the agent uses. For more information about mapping JDBC version to JDK version, see PostgreSQL JDBC Driver.

A few of the attributes that are collected by the agent rely on the pg_stat_statements extension. To add pg_stat_statements, first install the postgresql-contrib package. You must modify the postgresql.conf configuration file for the PostgreSQL server to load the pg_stat_statements extension.
  1. Open the postgresql.conf file in a text editor and update the shared_preload_libraries line:
    shared_preload_libraries = 'pg_stat_statements'
    pg_stat_statements.track_utility = false
    listen_addresses='<host_ip_address>'
    Where the <host_ip_address> is the IP address of the Virtual machine where PostgreSQL agent is installed. You can modify the value of <host_ip_address> parameter as *, which means that it can accept IP addresses of all hosts.
    These changes are required to monitor SQL statements, except utility commands.
    Note: The status of pg_stat_statements.track_utility is set or modified by a superuser only.
  2. Restart the PostgreSQL server after you update and save the postgresql.conf.
  3. Run the following SQL command by using psql that must be connected to the same database that would be provided later in the agent configuration for JDBC connectivity:
    create extension pg_stat_statements; 
    select pg_stat_statements_reset();
    Note: The command create extension and function pg_stat_statements_reset() are run by a superuser only.
    The view pg_stat_statements needs to be enabled for specific database, for more details refer pg_stat_statements.

The pg_hba.conf file contains authentication settings of PostgreSQL database. When the auth-method parameter value is set to ident in the pg_hba.conf file, the PostgreSQL agent cannot connect to the PostgreSQL database. Ensure that the authentication settings for the auth-method parameter are correct. For example, you can set these values for auth-method parameter: md5, trust, or password.

About this task

The PostgreSQL agent is a multiple instance agent. You must create the first instance and start the agent manually. The managed system name includes the instance name that you specify, for example, instance_name:host_name. The managed system name is limited to 32 characters. The instance name that you specify is limited to 28 characters, minus the length of your host name. For example, if you specify PostgreSQL2 as your instance name, your managed system name is PostgreSQL2:hostname.
Important: If you specify a long instance name, the managed system name is truncated and the host name is not displayed completely.

The product version and the agent version often differ. The directions here are for the most current release of this agent. For information about how to check the version of an agent in your environment, see Agent version command. For information about the agent version list and what's new for each version, see the Change history.