In the primary side, you have to use the view
pg_stat_replication and compare differents fields to see the drift. The function
pg_xlog_location_diff give the drift in size :
select pid, client_addr, state, sync_state,
pg_xlog_location_diff(sent_location, write_location) as write_lag,
pg_xlog_location_diff(sent_location, flush_location) as flush_lag,
pg_xlog_location_diff(sent_location, replay_location) as replay_lag
from pg_stat_replication ;
You can use the lag in monitoring tools, as gauge, to monitor your replication.
If a standby is missing, you have to check in the log's standby why.
If you use replication slots, you have to check the