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

Agent2 runs postgresql function, but has no permission, pg_ls_waldir

    XMLWordPrintable

Details

    • Incident report
    • Status: Closed
    • Trivial
    • Resolution: Cannot Reproduce
    • 5.0.10
    • None
    • Agent2 plugin (N)
    • None

    Description

      Steps to reproduce:

      1. Using Zabbix Agent2 to monitor Postgresql 11 on debian 10

      Result:

      Postgresql wal items are not populated, because  the agent doesn't have permissions to run the required function.

      In the postgresql log file:

      2021-04-01 11:31:45.022 CEST [1111] [email protected] ERROR:  permission denied for function pg_ls_waldir
      2021-04-01 11:31:45.022 CEST [1111] [email protected] STATEMENT:  SELECT row_to_json(T)
      				    FROM (
      						SELECT
      							pg_wal_lsn_diff(pg_current_wal_lsn(),'0/00000000') AS WRITE,
      							count(*)
      						FROM pg_ls_waldir() AS COUNT
      						) T;
      
      

      Expected:
      Wal items are populated.

       

      Possible solution, seems to work for me:

      Just like the advice in https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/postgresql_agent2.

      Give the user required permission on this function:

      GRANT EXECUTE ON FUNCTION pg_catalog.pg_ls_waldir TO zbx_monitor ;
      

      Now the wal items are populated.

      Attachments

        Activity

          People

            zalex_ua Oleksii Zagorskyi
            janssensm Michiel Janssens
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: