$ select application_name,
pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), sent_lsn)) send_lag,
pg_size_pretty(pg_wal_lsn_diff(sent_lsn, replay_lsn)) replay_lag,
replay_lag
from pg_stat_replication;
$ select slot_name, slot_type, active,
case when not pg_is_in_recovery() then pg_size_pretty(pg_current_wal_lsn() - restart_lsn) end as current_lag_bytes,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import argparse | |
import csv | |
import datetime | |
import os | |
import paramiko | |
import re | |
import subprocess |