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.
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.- Open the postgresql.conf file in a text editor and update the
shared_preload_librariesline:
Where theshared_preload_libraries = 'pg_stat_statements' pg_stat_statements.track_utility = false listen_addresses='<host_ip_address>'<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 ofpg_stat_statements.track_utilityis set or modified by a superuser only. - Restart the PostgreSQL server after you update and save the postgresql.conf.
- 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 commandThe viewcreate extensionand functionpg_stat_statements_reset()are run by a superuser only.pg_stat_statementsneeds to be enabled for specific database, for more details referpg_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
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. 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.