summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2009-08-12 10:39:33 +0000
committerGreg Sabino Mullane2009-08-12 10:39:33 +0000
commita99c6725187c484c66b34586224b4eee8b350eb4 (patch)
tree615beb1023e98f794e96d2b5d256dd82197f8022 /check_postgres.pl
parentb32479e6d18df80ad548873a670f099f5ca89402 (diff)
Add no-check_postgresrc option.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl31
1 files changed, 23 insertions, 8 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index bce5cd44f..827d37065 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -578,15 +578,25 @@ $opt{timeout} = 30;
## Command line options always overwrite these
## Format of these files is simply name=val
-my $rcfile;
-if (-e '.check_postgresrc') {
- $rcfile = '.check_postgresrc';
-}
-elsif (-e "$ENV{HOME}/.check_postgresrc") {
- $rcfile = "$ENV{HOME}/.check_postgresrc";
+## This option must come before the GetOptions call
+for my $arg (@ARGV) {
+ if ($arg eq '--no-check_postgresrc') {
+ $opt{'no-check_postgresrc'} = 1;
+ last;
+ }
}
-elsif (-e '/etc/check_postgresrc') {
- $rcfile = '/etc/check_postgresrc';
+
+my $rcfile;
+if (! $opt{'no-check_postgresrc'}) {
+ if (-e '.check_postgresrc') {
+ $rcfile = '.check_postgresrc';
+ }
+ elsif (-e "$ENV{HOME}/.check_postgresrc") {
+ $rcfile = "$ENV{HOME}/.check_postgresrc";
+ }
+ elsif (-e '/etc/check_postgresrc') {
+ $rcfile = '/etc/check_postgresrc';
+ }
}
if (defined $rcfile) {
open my $rc, '<', $rcfile or die qq{Could not open "$rcfile": $!\n};
@@ -648,6 +658,7 @@ die $USAGE unless
'test',
'symlinks',
'debugoutput=s',
+ 'no-check_postgresrc',
'action=s',
'warning=s',
@@ -7674,6 +7685,10 @@ Items not specifically attributed are by Greg Sabino Mullane.
=over 4
+=item B<Version 2.11.0>
+
+ Add the --no-check_postgresrc flag.
+
=item B<Version 2.10.1>
Add Nagios perf output to the wal_files check (Cédric Villemain)