Skip to content

Adding slot replication lag monitoring #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
check lag replication: return unkown status is the server is not prim…
…ary (stream sender)
  • Loading branch information
jsreynaud committed Oct 4, 2021
commit 13bda99027200fb7ab88255d69188cd346435e3b
19 changes: 19 additions & 0 deletions check_postgres.pl
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ package check_postgres;
'no-match-user' => q{No matching entries found due to user exclusion/inclusion options},
'no-match-slot' => q{No matching replication slots found due to exclusion/inclusion options},
'no-match-slotok' => q{No replication slots found},
'no-replication' => q{Not a primary server},
'no-parse-psql' => q{Could not parse psql output!},
'no-role' => q{Need psql 9.6 or higher to use --role},
'no-time-hires' => q{Cannot find Time::HiRes, needed if 'showtime' is true},
Expand Down Expand Up @@ -457,6 +458,7 @@ package check_postgres;
'no-match-user' => q{No se encuentran entradas coincidentes debido a las opciones de exclusión/inclusión},
'no-match-slot' => q{No se encuentran ranuras de replicación coincidentes debido a las opciones de exclusión/inclusión},
'no-match-slotok' => q{No se encuentran ranuras de replicación},
'no-replication' => q{No es un servidor primario},
'no-parse-psql' => q{No se pudo interpretar la salida de psql!},
'no-time-hires' => q{No se encontró Time::HiRes, necesario si 'showtime' es verdadero},
'opt-output-invalid' => q{Formato de salida inválido: debe ser 'nagios' o 'mrtg' o 'simple' o 'cacti'},
Expand Down Expand Up @@ -720,6 +722,7 @@ package check_postgres;
'no-match-user' => q{Aucune entrée trouvée à cause options d'exclusion/inclusion},
'no-match-slot' => q{Aucune fentes de réplication trouvée à cause options d'exclusion/inclusion},
'no-match-slotok' => q{Pas de fentes de réplication trouvé},
'no-replication' => q{Ce serveur n'est pas un serveur primaire},
'no-parse-psql' => q{N'a pas pu analyser la sortie de psql !},
'no-time-hires' => q{N'a pas trouvé le module Time::HiRes, nécessaire quand « showtime » est activé},
'opt-output-invalid' => q{Sortie invalide : doit être 'nagios' ou 'mrtg' ou 'simple' ou 'cacti'},
Expand Down Expand Up @@ -988,6 +991,7 @@ package check_postgres;
'no-match-user' => q{Keine passenden Einträge gefunden gemäß den Ausschluss-/Einschluss-Optionen},
'no-match-slot' => q{Keine passenden Replikationen gefunden gemäß den Ausschluss-/Einschluss-Optionen},
'no-match-slotok' => q{Keine passenden Replikations-Slots gefunden gemäß den Ausschluss-/Einschluss-Optionen},
'no-replication' => q{Not a primary server},
'no-parse-psql' => q{Konnte die Ausgabe von psql nicht verstehen!},
'no-time-hires' => q{Kann Time::HiRes nicht finden, ist aber nötig wenn 'showtime' auf 'wahr' gesetzt ist (true)},
'opt-output-invalid' => q{Ungültige Ausgabe: Muss eines sein von 'nagios' oder 'mrtg' oder 'simple' oder 'cacti'},
Expand Down Expand Up @@ -5810,6 +5814,21 @@ sub check_replication_lag {

my ($warning, $critical) = validate_range({type => 'time'});

$SQL = q{
select pg_is_in_recovery()
};
my $is_primary = run_command($SQL );
for $db (@{$is_primary->{db}}) {
for my $r (@{$db->{slurp}}) {
if ($r->{pg_is_in_recovery} eq 't') {
# The database is a standby DB: Plugin must return unkown result
add_unknown msg('no-replication');
return;
}
}
}


$SQL = q{
select slot_name,
active,
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy