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

pgsql.dbstat.sql from the official Template DB PostgreSQL causes error

XMLWordPrintable

    • Sprint 66 (Jul 2020), Sprint 67 (Aug 2020)
    • 0.25

      Steps to reproduce:

      1. Install the Template according to its README
      2. Increase zabbix-agent debug level to 4
      3. In the agent log, look for the error "psql:/var/lib/zabbix/postgresql/pgsql.dbstat.sql:17: ОШИБКА: имя поля не может быть NULL (which means "column name cannot be NULL")

      The reason of the error is the new development described in https://rjuju.github.io/postgresql/2019/04/18/new-in-pg12-statistics-checksums-errors.html

      As a side effect, pg_stat_database will also now show available statistics for shared objects (such as the pg_database table for instance), in a new row with datid valued to 0, and a NULL datname. Those were always accumulated, but weren’t displayed in any system view until now.

      Patch:

      A simple patch solves the problem

      index d874658ccc..9a6e4c4de8 100644
      --- a/templates/db/postgresql/postgresql/pgsql.dbstat.sql
      +++ b/templates/db/postgresql/postgresql/pgsql.dbstat.sql
      @@ -14,4 +14,4 @@ SELECT json_object_agg(datname, row_to_json(T)) FROM (
                              temp_files,
                              temp_bytes,
                              deadlocks
      -       FROM pg_stat_database) T
      +       FROM pg_stat_database where datname is not null) T
      
      

            afayantsev Anton Fayantsev (Inactive)
            vas_mpeks Victor Sudakov
            Team INT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: