IA PostgreSQL - wrong values have been found.
search cancel

IA PostgreSQL - wrong values have been found.

book

Article ID: 405044

calendar_today

Updated On:

Products

DX Application Performance Management

Issue/Introduction

We are using IA with PostgreSQL extension and some of metric had unexpected wrong values. All select were repaired in out environment according posgres team recommendation, and works, but should be repaired in agent installation too. 

First wrong query is for "Resource Utilization:Max Connections"
SELECT CAST(max_val AS INTEGER),name from pg_settings where name like 'max_connections'
- incorrect is max_val value - it's maximal allowed value, but not really set, setting should be used
SELECT CAST(setting AS INTEGER),name from pg_settings where name like 'max_connections'


Second for "Resource Utilization:Max Connections In Use (%)" is similar, but there must be use NUMERIC instead of integer, otherwise result will be zero all time (it's true for our version of postgres - PostgreSQL 15.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), 64-bit
SELECT (active_conn/max_val)*100 as perc from ( select CAST(max_val AS INTEGER),name , (select sum(numbackends) from pg_stat_database) as active_conn from pg_settings where name like 'max_connections') as SETTING_SUMMARY

SELECT (active_conn/setting)*100 as perc from ( select CAST(setting AS NUMERIC),name , (select sum(numbackends) from pg_stat_database) as active_conn from pg_settings where name like 'max_connections') as SETTING_SUMMARY

Environment

Infrastructure Agent with Postgres extension.

Cause

DE640603

Resolution

A defect has been logged and will be further verified by Development. In case of successful validation, it will be added in the next release.