[ZBXNEXT-8699] An ability to control statements cache and query execution mode parameters in PostgreSQL plugin of Zabbix agent 2 Created: 2023 Sep 12  Updated: 2024 Apr 10  Resolved: 2023 Dec 19

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent2 plugin (G)
Affects Version/s: 6.0.21, 6.4.6, 7.0.0alpha4
Fix Version/s: 6.0.25rc1, 6.4.10rc1, 7.0.0alpha9, 7.0 (plan)

Type: Change Request Priority: Medium
Reporter: Denis Rasikhov Assignee: Eriks Sneiders
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

zabbix_server 6.0.21
zabbix_agent2 6.0.21

Debian 12 Bookworm
PgBouncer 1.18.0 (default Debian repo)
postgresql-15 15.3-0+deb12u1 (default Debian repo)

AlmaLinux 9.2 (Turquoise Kodkod)
PgBouncer 1.20.1 (epel)
PostgreSQL: postgresql-server-15.3-1.module_el9.2.0+32+f3c125b5.x86_64 (from dnf module v15)


Issue Links:
Causes
causes ZBX-23837 zabbix-agent2 upgrade saturates postg... Closed
Team: Team INT
Sprint: Sprint 106 (Nov 2023), Sprint 107 (Dec 2023)
Story Points: 1

 Description   

During the work on the ZBX-18938 it was noted that the plugin uses prepared statements enabled by default, which breaks monitoring of PostgreSQL instances through PgBouncer (most likely other proxying/pooling alternatives will be affected as well).

To reproduce the issue:

1) Install PostgreSQL.
2) Install PgBouncer and set it to the transaction pooling mode by default.
3) Install Zabbix server/frontend, use the PgBouncer socket file or port for the connection.
4) Install Zabbix agent 2, set up the host for monitoring.
5) At first, monitoring will work normally. Now restart the postgresql service - in Zabbix server log you'll see 'prepared statement "lrupsc_*" does not exist (SQLSTATE 26000)' errors like described in ZBX-18938.
6) Restart either the pgbouncer or zabbix-agent2 service - the problem will go away.

So we should probably consider the addition of plugin parameters that will allow to control this behaviour (for all connections by default and per named session as well): https://pkg.go.dev/github.com/jackc/pgx/v5#ConnConfig



 Comments   
Comment by Eriks Sneiders [ 2023 Dec 06 ]

Implemented inĀ 

Comment by Martins Valkovskis [ 2023 Dec 18 ]

Updated documentation:

  • What's new: 6.0.25, 6.4.10
  • PostgreSQL plugin parameters: 6.0, 6.4, 7.0 ('Plugins.PostgreSQL.Default.CacheMode' and 'Plugins.PostgreSQL.Sessions.<SessionName>.CacheMode' added)
Generated at Sat May 31 04:01:19 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.