summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorNicolas Thauvin2011-06-27 14:55:06 +0000
committerGuillaume Lelarge2011-06-27 14:59:27 +0000
commitccfbebf822895ab25a41c882b0e50cf181dfcc57 (patch)
treed8b8ccbc28cba9f427e34e487db0a899fef5cc25 /check_postgres.pl
parentd6da997978e8dda4a831f7e3c930f8d006b656dd (diff)
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.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl5
1 files 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] });