check_pg_replication_lag: Check for the critical conditions before the warning condition

Otherwise critical conditions are only reported as warnings.

(imported from commit 3e0e21f952e206e8df5b971633a8b0981540efc7)
This commit is contained in:
Zev Benjamin 2013-08-26 15:32:03 -04:00
parent 44ecd09ac7
commit 50c98c2da2
1 changed files with 6 additions and 6 deletions

View File

@ -56,15 +56,9 @@ recv_diff = primary_offset - secondary_recv_offset
replay_diff = secondary_recv_offset - secondary_replay_offset
# xlog segments are normally 16MB each. These thresholds are pretty arbitrary.
if recv_diff > 16 * 1024**2:
report('WARNING', 'secondary is %d bytes behind on receiving xlog' % (recv_diff,))
if recv_diff > 5 * 16 * 1024**2:
report('CRITICAL', 'secondary is %d bytes behind on receiving xlog' % (recv_diff,))
if replay_diff > 16 * 1024**2:
report('WARNING', 'secondary is %d bytes behind on applying received xlog' % (replay_diff))
if replay_diff > 5 * 16 * 1024**2:
report('CRITICAL', 'secondary is %d bytes behind on applying received xlog' % (replay_diff))
@ -74,5 +68,11 @@ if recv_diff < 0:
if replay_diff < 0:
report('CRITICAL', 'secondary is %d bytes ahead on applying received xlog' % (replay_diff,))
if recv_diff > 16 * 1024**2:
report('WARNING', 'secondary is %d bytes behind on receiving xlog' % (recv_diff,))
if replay_diff > 16 * 1024**2:
report('WARNING', 'secondary is %d bytes behind on applying received xlog' % (replay_diff))
report('OK', ('secondary is %d bytes behind on receiving and %d bytes behind on applying xlog'
% (recv_diff, replay_diff)))