Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-27228

Multiple PostgreSQL idle sessions from Zabbix Agent 2 (postgresql plugin)

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • None
    • Agent2 plugin (G)
    • None

      Zabbix Agent 2 with PostgreSQL plugin creates multiple idle database sessions that do not close after query execution. The issue is observed in versions 6.0.33 and 6.4.0, while version 6.0.10 maintains only 1 connection as expected.

      Component Versions:
       
       

      Component Server 1 Server 2 Server 3
      Zabbix Agent 2 6.4.20 6.0.33 6.0.10
      PostgreSQL Plugin 6.4.0 6.0.13 1.2.0
      PostgreSQL Server 14.15 14.15 14.15
      OS CentOS 8 8 8

      Problem Symptoms:

      Server 1 (zabbix-agent2 v6.4.20):

      • 8 sessions from user zabbix
      • All sessions in idle state
      • Session lifetime: 2+ days
      • Sessions distributed across databases: zabbix_proxy, postgres, zabbix_db1, zabbix_db2

      Server 2 (zabbix-agent2 v6.0.33):

      • 29 sessions from user zabbix
      • All sessions in idle state
      • Session lifetime: 5-6 days
      • Sessions distributed across 12+ databases
      • Duplicate sessions to the same databases (e.g., 2 sessions to zabbix_db4)

      Server 3 (zabbix-agent2 v6.0.10):

      • 2 sessions from user zabbix
      • One active, one idle
      • Normal behavior

      Examples of Problematic Sessions:
       -- Server 2 (v6.0.33) - Duplicate sessions to zabbix_db4
      datname     | pid | backend_start | query_start | state_change | state | query
      zabbix_db4 | 2914 | 2025-11-04 17:42:42+05 | 2025-11-10 10:59:01.084798+05 | 2025-11-10 10:59:01.084806+05 | idle | SELECT 'Connected successfully' AS status
      zabbix_db4 | 2953 | 2025-11-04 17:45:01+05 | 2025-11-10 10:59:01.084765+05 | 2025-11-10 10:59:01.084776+05 | idle | SELECT 2 + 2 AS result
      Plugin Configuration (typical):
      /etc/zabbix/zabbix_agent2.d/postgresql.conf
       Plugins.PostgreSQL.System.Path=/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql Plugins.PostgreSQL.CustomQueriesPath=/etc/zabbix/scripts/psql
      Reproduction Steps:

      1. Install Zabbix Agent 2 v6.0.33+ with PostgreSQL plugin v6.0.13+
      1. Configure monitoring for multiple databases (10+) using pgsql.custom.query key (10+ queries) with 1-minute collection interval
      1. Observe idle session growth over time
      1. Sessions remain open even after several days

      Additional Observations:

      • The KeepAlive parameter does not have the expected effect
      • Connection pool management appears broken in affected versions
      • Each custom query seems to create a persistent session instead of reusing connections

            zabbix.support Zabbix Support Team
            Salavat Salavat
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: