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

PostgreSQL template incorrect calculation

    XMLWordPrintable

Details

    • Team INT
    • Sprint 79 (Aug 2021), Sprint 80 (Sep 2021), Sprint 81 (Oct 2021)
    • 1

    Description

      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.

      Attachments

        Activity

          People

            mchudinov Maxim Chudinov
            dotneft Alexey Pustovalov
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: