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

Details

    • Problem report
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 5.0.0
    • 5.0.3rc1, 5.2.0alpha1, 5.2 (plan)
    • Templates (T)
    • Debian/buster, postgresql-12 12.3-1.pgdg100+1
    • Team INT
    • Sprint 66 (Jul 2020), Sprint 67 (Aug 2020)
    • 0.25

    Description

      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
      
      

      Attachments

        Issue Links

          Activity

            People

              afayantsev Anton Fayantsev
              vas_mpeks Victor Sudakov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: