Configuring PostgreSQL monitoring
You must 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 this agent. The path to this driver is required at the time of agent configuration.
JDBC type 4 driver is the new version and hence preferable. User can install the subtype of JDBC 4 version according to the JDK version the agent uses. For mapping of JDBC version to JDK version get more information at https://jdbc.postgresql.org/download.html.
The pg_hba.conf file is the PostgreSQL database file that
contains authentication settings. 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
.
For remote monitoring, pg_hba.conf file should be updated
according to SSL configuration done in postgresql.conf file.
If
SSL is off then host entry should be added:
host | <DB name> | <user name> | <Agent machine IP>/32 | <auth-method> |
If SSL is on then hostssl entry should be added
hostssl | <DB name> | <user name> | <TEMA IP>/32 | cert |
pg_stat_statements
extension. To add pg_stat_statements
first install the package
postgresql-contrib
. You must modify the postgresql.conf
configuration file in order 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_libraries
line:shared_preload_libraries = 'pg_stat_statements' pg_stat_statements.track_utility = false
These changes are required to monitor SQL statements, except utility commands.Note: The status ofpg_stat_statements.track_utility
is set or modified by a superuser only. - Update the
connection settings
section in postgresql.conf filelisten_addresses = <Agent machine IP>
here, mention specific agent IP or * to listen all IP addresses.Note: This setting is required for remote monitoring. - Restart the PostgreSQL server after you update and save the postgresql.conf.
- Run the following SQL command by using psql, that should 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 extension
and functionpg_stat_statements_reset()
are run by a superuser only.pg_stat_statements
needs to be enabled for specific database, for more details refer https://www.postgresql.org/docs/9.6/static/pgstatstatements.html.
Review hardware and software prerequisites. For the up-to-date system requirement information, see the Software Product Compatibility Reports (SPCR) for the PostgreSQL agent.
About this task
instance_name:host_name:pc
,
where pc is your two character product code. 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:PN
. 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 detailed information about the agent version list and what's new for each version, see the Change history.