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

pgsql.replication.lag.sql

XMLWordPrintable

    • Icon: Patch request Patch request
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • None
    • 5.4.3
    • Templates (T)
    • /var/lib/zabbix/postgresql/pgsql.replication.lag.sql

      Hi!
      I have recovered from backup pgsql server (Point in time recovery).

      postgres=# select pg_last_xact_replay_timestamp();
       pg_last_xact_replay_timestamp 
      -------------------------------
       2021-06-26 22:11:23.259069+03
      

      Item "Replication: lag in seconds":

      pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.DB}"]
      

      And looks like trigger not working correctly for me.
      I got errors event like

      PostgreSQL: Streaming lag with {#MASTER} is too high (over {$PG.REPL_LAG.MAX.WARN} in 5m)
      

      In my case I change user parameter SQL from

      CASE WHEN pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn()
      

      to

      CASE WHEN pg_last_wal_receive_lsn() is NULL or pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn()
      

      And it corrects the issue.

      Hope you can update this script.
      Thank you!

            vkhaliev Vyacheslav Khaliev
            Gubskii Alexey
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: