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

PostgreSQL Plugin is not working with complicated custom SQL queries

XMLWordPrintable

    • Sprint 85 (Feb 2022), Sprint 86 (Mar 2022)
    • 1

      Steps to reproduce:

      1. Install and run Zabbix Agent 2 
      2.  Configure PostgreSQL custom queries directory, place query.sql file with read permissions for zabbix user, attached, restart the agent
      3. Check SQL query with
      zabbix_get -s <ip> -p <port> -k pgsql.custom.query["tcp://127.0.0.1:5432","zbx_monitor","zabbix123","zabbix","query"]

      Result:

      [{"json_object_agg":"eyAiemFiYml4X3Byb3h5IiA6IHsiZGF0bmFtZSI6InphYmJpeF9wcm94eSIsInF1ZXJ5X3RpbWVfbWF4IjowLCJ0eF90aW1lX21heCI6MCwibXJvX3RpbWVfbWF4IjowLCJxdWVyeV90aW1lX3N1bSI6MCwidHhfdGltZV9zdW0iOjAsIm1yb190aW1lX3N1bSI6MCwicXVlcnlfc2xvd19jb3VudCI6MCwidHhfc2xvd19jb3VudCI6MCwibXJvX3Nsb3dfY291bnQiOjB9LCAicG9zdGdyZXMiIDogeyJkYXRuYW1lIjoicG9zdGdyZXMiLCJxdWVyeV90aW1lX21heCI6MCwidHhfdGltZV9tYXgiOjAsIm1yb190aW1lX21heCI6MCwicXVlcnlfdGltZV9zdW0iOjAsInR4X3RpbWVfc3VtIjowLCJtcm9fdGltZV9zdW0iOjAsInF1ZXJ5X3Nsb3dfY291bnQiOjAsInR4X3Nsb3dfY291bnQiOjAsIm1yb19zbG93X2NvdW50IjowfSwgInphYmJpeCIgOiB7ImRhdG5hbWUiOiJ6YWJiaXgiLCJxdWVyeV90aW1lX21heCI6MCwidHhfdGltZV9tYXgiOjAsIm1yb190aW1lX21heCI6MCwicXVlcnlfdGltZV9zdW0iOjAsInR4X3RpbWVfc3VtIjowLCJtcm9fdGltZV9zdW0iOjAsInF1ZXJ5X3Nsb3dfY291bnQiOjAsInR4X3Nsb3dfY291bnQiOjAsIm1yb19zbG93X2NvdW50IjowfSB9"}]

      Expected:
      Correct SQL query result

      Checking with psql has the correct result

      sudo -u zabbix psql -U zbx_monitor -d zabbix < /var/lib/zabbix/postgres/query.sql                                                                                                                              json_object_agg                              -----------------------------------------------------------------------------------------------------------------------------------------------------------------
       { "zabbix_proxy" : {"datname":"zabbix_proxy","query_time_max":0,"tx_time_max":0,"mro_time_max":0,"query_time_sum":0,"tx_time_sum":0,"mro_time_sum":0,"query_slow_count":0,"tx_slow_count":0,"mro_slow_count":0}, "postgres" : {"datname":"postgres","query_time_max":0,"tx_time_max":0,"mro_time_max":0,"query_time_sum":0,"tx_time_sum":0,"mro_time_sum":0,"query_slow_count":0,"tx_slow_count":0,"mro_slow_count":0}, "zabbix" : {"datname":"zabbix","query_time_max":0,"tx_time_max":0,"mro_time_max":0,"query_time_sum":0,"tx_time_sum":0,"mro_time_sum":0,"query_slow_count":0,"tx_slow_count":0,"mro_slow_count":0} }
      

       

       

            esneiders Eriks Sneiders
            igorbach Igor Gorbach
            Team INT
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: