dpa_postgres_replication_lag.sqlThe attached script contains three queries for measuring PostgreSQL replication lag:Count of log files not yet sentAmount of data (MB) behindTime lag in secondsDecide which metric best fits your monitoring needs, then use that query in a DPA Custom Multiple Numeric Alert. Example: