PostgreSQL

Sensor (Data Collection)

Tracked Configuration

  • Port
  • Max connections
  • Version
  • Started At

Metrics

Postgres server

Metric Description
Total Committed Transactions Number of transactions that have been committed across all databases.
Total Active Connections Number of active connections across all databases.
Connection Usage Number of active connections as a fraction of the maximum number of allowed connections.

Databases

Metric Description
Committed Transactions Number of transactions that have been committed in this database.
Rolled Back Transactions Number of transactions that have been rolled back in this database.
Cache Hit Ratio Percentage of disk blocks were found already in the buffer cache, so that a read was not necessary.
Standby Conflicts Number of queries canceled due to conflicts with recovery in this database.
Tuple Read Number of index entries returned by scans on this index.
Tuple Fetch Number of live rows fetched by index scans.
Database Size Disk space used by this database.
Active Connections Number of active connections to this database.

Health Signatures

Health Description
Connection limit reached Number of active connections is more than 90% of max connections

Configuration

PostgreSQL

Please make sure track_counts, track_activities, track_io_timing are set to ‘on’ (‘yes’, ‘true’ and 1 are also fine) in PostgreSQL. More information in the PostgreSQL documentation.

To display detail query count, pgstatstatements extension must be loaded via shared_preload_libraries in postgresql.conf.

User permission

Minimal permission for monitoring is SELECT on pg_stat_database. Example how to create a user for Agent’s needs can be seen below.

create user <USERNAME> with password <PASSWORD>;
grant SELECT ON pg_stat_database to <USERNAME>;

Sensor

When the sensor connects to the PostgreSQL, it might need to authenticate itself. User credentials can be configured by enabling the configuration section below in the agent /etc/instana/configuration.yml and providing a username and password (please keep in mind, that this is a clear-text password!). In case of the password-base authentication, the authentication mechanism of the corresponding PostgreSQL user has to be md5 or a password. Please refer to the “Client Authentication” section in the PostgreSQL documentation for more information.

PostgreSQL should also contain a database with a name identical to the user name specified for the connection to be established.

com.instana.plugin.postgresql:
  user: ''
  password: ''
  database: '' # by default PostgreSQL will use 'user' as database to connect to.

The database field is used for authentication only. Changes to this file are hot reloaded (no agent restart is necessary).