From ccfbebf822895ab25a41c882b0e50cf181dfcc57 Mon Sep 17 00:00:00 2001 From: Nicolas Thauvin Date: Mon, 27 Jun 2011 16:55:06 +0200 Subject: [PATCH] Fix the archive_ready action The .ready files are not in the pg_xlog directory, but in the pg_xlog/archive_ready one. This patch adds another argument to the check_wal_files() function so that it could find the subdirectory in which it has to look for files. --- check_postgres.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check_postgres.pl b/check_postgres.pl index d4d224ccd..847a17a75 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -2817,7 +2817,7 @@ sub check_archive_ready { ## Critical and warning are the number of files ## Example: --critical=10 - return check_wal_files('.ready'); + return check_wal_files('/archive_status', '.ready'); } ## end of check_archive_ready @@ -7805,12 +7805,13 @@ sub check_wal_files { ## Critical and warning are the number of files ## Example: --critical=40 + my $subdir = shift || ''; my $extrabit = shift || ''; my ($warning, $critical) = validate_range({type => 'positive integer', leastone => 1}); ## Figure out where the pg_xlog directory is - $SQL = qq{SELECT count(*) AS count FROM pg_ls_dir('pg_xlog') WHERE pg_ls_dir ~ E'^[0-9A-F]{24}$extrabit$'}; ## no critic (RequireInterpolationOfMetachars) + $SQL = qq{SELECT count(*) AS count FROM pg_ls_dir('pg_xlog$subdir') WHERE pg_ls_dir ~ E'^[0-9A-F]{24}$extrabit\$'}; ## no critic (RequireInterpolationOfMetachars) my $info = run_command($SQL, {regex => qr[\d] }); -- 2.30.2