You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Do the check on replay delay in case SR has disconnected because it way too far behind
4841
4869
my$msg = qq{$rep_delta};
4842
-
if (length$criticaland$rep_delta > $critical) {
4870
+
if ($psql_version >= 9.1) {
4871
+
$msg .= qq{ and $time_delta seconds}
4872
+
}
4873
+
if ((length$criticalorlength$ctime) and (!length$criticalorlength$criticaland$rep_delta > $critical) and (!length$ctimeorlength$ctimeand$time_delta > $ctime)) {
4843
4874
add_critical $msg;
4844
4875
}
4845
-
elsif (length$warningand$rep_delta > $warning) {
4876
+
elsif ((length$warningorlength$wtime) and(!length$warningorlength$warningand$rep_delta > $warning) and (!length$wtimeorlength$wtimeand$time_delta > $wtime)) {
4846
4877
add_warning $msg;
4847
4878
}
4848
4879
else {
@@ -8812,15 +8843,34 @@ =head2 B<hitratio>
8812
8843
=head2B<hot_standby_delay>
8813
8844
8814
8845
(C<symlink: check_hot_standby_delay>) Checks the streaming replication lag by computing the delta
8815
-
between the xlog position of a master server and the one of the slaves connected to it. The slave_
8816
-
server must be in hot_standby (e.g. read only) mode, therefore the minimum version to use this_
8817
-
action is Postgres 9.0. The I<--warning> and I<--critical> options are the delta between xlog
8818
-
location. These values should match the volume of transactions needed to have the streaming
8819
-
replication disconnect from the master because of too much lag.
8820
-
8821
-
You must provide information on how to reach the second database by a connection
8822
-
parameter ending in the number 2, such as "--dbport2=5543". If if it not given,
8823
-
the action fails.
8846
+
between the xlog position of a master server and the one of the slaves connected to it, and/or the
8847
+
last transaction timestamp received by the slave. The slave server must be in hot_standby (e.g. read
8848
+
only) mode, therefore the minimum version to use this action is Postgres 9.0. To support transaction
8849
+
timestamps the minimum version is Postgres 9.1.
8850
+
8851
+
The I<--warning> and I<--critical> options are either the delta between xlog positions in bytes,
8852
+
units of time to compare timestamps, or both.
8853
+
8854
+
Byte values should be based on the volume of transactions needed to have the streaming replication
8855
+
disconnect from the master because of too much lag, determined by the Postgres configuration variable
8856
+
B<wal_keep_segments>. For units of time, valid units are 'seconds', 'minutes', 'hours', or 'days'.
8857
+
Each may be written singular or abbreviated to just the first letter. When specifying both, in the
8858
+
form 'I<bytes> and I<time>', both conditions must be true for the threshold to be met.
8859
+
8860
+
You must provide information on how to reach the databases by providing a comma separated list to the
8861
+
--dbost and --dbport parameters, such as "--dbport=5432,5543". If not given, the action fails.
8862
+
8863
+
Example 1: Warn a database with a local replica on port 5433 is behind on any xlog replay at all
Example 3: Allow replica1 to be 1 WAL segment behind, if the master is momentarily seeing more activity than the streaming replication connection can handle, or 10 minutes behind, if the master is seeing very little activity and not processing any transactions, but not both, which would indicate a lasting problem with the replication connection.
8872
+
8873
+
check_hot_standby_delay --dbhost=master,replica1 --warning='1048576 and 2 min' --critical='16777216 and 10 min'
0 commit comments