-
Problem report
-
Resolution: Fixed
-
Trivial
-
4.0.30, 5.0.10
-
None
-
Sprint 79 (Aug 2021), Sprint 80 (Sep 2021), Sprint 81 (Oct 2021)
-
1
Template contains pgsql.connections.sum.sql file with the following SQL query:
... sum(CASE WHEN state = 'idle' THEN 1 ELSE 0 END) AS idle, sum(CASE WHEN state = 'idle in transaction' THEN 1 ELSE 0 END) AS idle_in_transaction, count(*) AS total, count(*)*100/(SELECT current_setting('max_connections')::int) AS total_pct, sum(CASE WHEN wait_event IS NOT NULL THEN 1 ELSE 0 END) AS waiting, (SELECT count(*) FROM pg_prepared_xacts) AS prepared FROM pg_stat_activity WHERE datid is not NULL ...
Zabbix calculates number of waiting connections using wait_event column and do not take in account column state. According PostgreSQL documentation wait_event can contain last event, not current, if state is idle.