Script checks lag against provided source in the cases when local
database is offline (not available for queries) and/or when remote
primary database is not directly reachable over network.
On passing, improve README wording slightly.
1) In the primary_conninfo can be set to а custom of "application_name" value. In this case, application_name will not equal the value of "walreceiver".
2) Exclude "pg_basebackup" from the query result.
Make it possible to provide optional thresholds for replicas.
Improve address handling, enforce square brackets for the IPv6 addresses
(per RFC3986).
Provide much more details in the help section.
On passing, reorganize code and move address handling into own function.
- add extended Usage message
- add possibility to specify several replicas via comma
- add possibility to specify lag in KB and MB
- pretty-print lag as KB, MB, GB instead of plain bytes
Now it is not neccessary to comment out checks when servers exchange
their roles during switchover.
Also cascading replicas can be monitored now, we're checking lag between
current cascaded replica and it's remote.
Details:
- for MASTER (can be cascading replica) use either
pg_current_wal_lsn() or pg_last_wal_receive_lsn()
- for REPLICA use either pg_last_wal_receive_lsn()
or return NULL in cases database is open (not in replicaiton)
- trim trailing newline via `tr -d '\n'`
2) remove debug output of psqlCmd var\
3) replace command to determine postgresql major version\4) split "read -p" command to separate echo+read\
5) disable pg checks if unable to connect to postgres
Adjust `check_replication_lag.pl` script to work with 10+ databases.
Script now checks database version (extra query to master) and
uses proper funciton calls, as appropriate.
Get rid of previously created `check_replication_lag_wal.pl` script.