PostgreSQL PI in Foglight serves the primary function of providing comprehensive monitoring and performance analysis capabilities for PostgreSQL database environments. It continuously monitors various performance metrics of PostgreSQL databases in near real-time (every 1 min). It collects data on metrics such as wait statistics, memory utilization, disk I/O, query execution times, and more. For PostgresSQL PI to function properly, configurations on monitored PostgreSQL instances are necessary.
Prerequisites to monitor PostgreSQL PI:
Install a PostgreSQL agent from the Databases dashboard. For more information, refer to Ease of Installation
Configure the track_activities parameter. It enables the collection of information on the currently executing command of each session, along with its identifier and the time when that command began execution. It is ON by default in most of the PostgreSQL versions. It can be configured in postgresql.conf by editing config file or by SET command:
After parameter is set, PostgreSQL service should be restarted.
Configure the track_activity_query_size parameter that specifies the amount of memory reserved for storing the text of the currently executing command for each active session.
If this value is specified without units, it is taken as bytes. The default value is 1024 bytes (1kb) and maximum value is 1048576 bytes (1MB). Recommended is 4096 bytes (4kb). It can be configured only by editing config file postgresql.conf: track_activity_query_size = 4096.
To enable PostgreSQL PI for an agent: