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

PostgreSQL plugin - pgsql.autovacuum.count

XMLWordPrintable

    • 0.5

      Hi.

      The PostgreSQL plugin has a metric pgsql.autovacuum.count which uses a simple query

      SELECT count(*) 
      
      FROM pg_catalog.pg_stat_activity 
      
      WHERE query like '%%autovacuum%%' 
      
      AND state <> 'idle' AND pid <> pg_catalog.pg_backend_pid()
      

      With such  query, the metric may return incorrect result, because any process can execute a request, incl. any user whose text contains the word "autovacuum" (a simple example of "select 'autovacuum'") and the agent will count it, but it will be incorrect.

      To fix it need to add an additional condition:

       "WHERE backend_type = 'autovacuum worker'"
      

      to make sure that the query is being executed by the worker process autovacuum and not by the user.

      The backend_type column appeared in version 10

            azazuks Andrejs Zazuks
            AntonG Anton Glushakov
            Team INT
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: