From: Greg Sabino Mullane Date: Wed, 12 Aug 2009 10:39:33 +0000 (-0400) Subject: Add no-check_postgresrc option. X-Git-Tag: 2.11.0~18 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=a99c6725187c484c66b34586224b4eee8b350eb4;p=check_postgres.git Add no-check_postgresrc option. --- 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 + + Add the --no-check_postgresrc flag. + =item B Add Nagios perf output to the wal_files check (Cédric Villemain)