diff options
author | Guillaume Lelarge | 2011-09-03 10:21:53 +0000 |
---|---|---|
committer | Guillaume Lelarge | 2011-09-03 17:55:31 +0000 |
commit | 9012739cdb908ea20506920124331ea7d08f4dca (patch) | |
tree | 139eed364f1ad28568cd25bcfb96e20c020f81cf /check_postgres.pl | |
parent | a295085d0482a6160c19b732a48bc8b2f41b40f8 (diff) |
Fix some "make test" issues
* backends test issue
Critical and warning values were wrong for the negative number check.
And the output message for the --include check was wrong too.
* check_replicate_row issue
The UPDATE must be executed on the first server only.
* fsm_pages and fsm_relations test issue
The version test (ie max_fsm_* not available on 8.4 and later releases) must be done earlier.
* doc test issue
check_standby_mode rename to make_sure_standby_mode because all check_*
functions are expected to have documentation, but check_standby_mode is an
internal function.
* another doc test issue
pgbouncer_checksum documentation wasn't at the right location.
* drop_schema_if_exists issue
There was an unexpected return in the middle of the function, and so the
schema was never dropped.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-x | check_postgres.pl | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/check_postgres.pl b/check_postgres.pl index a3418489e..7d9f2b0d8 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -1243,7 +1243,7 @@ if ($opt{showtime}) { ## Check the current database mode our $STANDBY = 0; -check_standby_mode() if $opt{'assume-standby-mode'}; +make_sure_standby_mode() if $opt{'assume-standby-mode'}; ## We don't (usually) want to die, but want a graceful Nagios-like exit instead sub ndie { @@ -1511,7 +1511,7 @@ sub do_mrtg_stats { do_mrtg({one => $one, two => $two, msg => $msg}); } -sub check_standby_mode { +sub make_sure_standby_mode { ## Checks if database in standby mode ## Requires $ENV{PGDATA} or --datadir @@ -1570,7 +1570,7 @@ sub check_standby_mode { return; -} ## end of check_standby_mode +} ## end of make_sure_standby_mode sub finishup { @@ -2461,7 +2461,7 @@ sub run_command { sub setup_target_databases { ## Build a list of all databases to connect to. - ## Returns a list of all such databases with conenction information: + ## Returns a list of all such databases with connection information: ## -- dbuser, --dbpass, --dbservice, --port, --dbname, --host ## ## Items are determined by host, port, and db arguments @@ -2484,7 +2484,7 @@ sub setup_target_databases { ## --host=a,b --host=x --port=5432,5433 --dbuser=alice --dbuser=bob --db=baz ## Connects three times: a-5432-alice-baz b-5433-alice-baz x-5433-bob-baz - ## Returns a list of targets as as hashref + ## Returns a list of targets as a hashref my $arg = shift || {}; @@ -5897,7 +5897,7 @@ sub check_replicate_row { ndie msg('rep-wrongvals', $value1, $val1, $val2); } - $info1 = run_command($update, { failok => 1 } ); + $info1 = run_command($update, { dbnumber => 1, failok => 1 } ); ## Make sure the update worked if (! defined $info1->{db}[0]) { @@ -8628,31 +8628,6 @@ tool that can send mail when interesting events appear in your Postgres logs. See: http://bucardo.org/wiki/Tail_n_mail for more information). See also the information on the C<--get_method> option. -=head2 B<pgbouncer_checksum> - -(C<symlink: check_postgres_pgbouncer_checksum>) Checks that all the -pgBouncer settings are the same as last time you checked. -This is done by generating a checksum of a sorted list of setting names and -their values. Note that you shouldn't specify the database name, it will -automatically default to pgbouncer. Either the I<--warning> or the I<--critical> option -should be given, but not both. The value of each one is the checksum, a -32-character hexadecimal value. You can run with the special C<--critical=0> option -to find out an existing checksum. - -This action requires the Digest::MD5 module. - -Example 1: Find the initial checksum for pgbouncer configuration on port 6432 using the default user (usually postgres) - - check_postgres_pgbouncer_checksum --port=6432 --critical=0 - -Example 2: Make sure no settings have changed and warn if so, using the checksum from above. - - check_postgres_pgbouncer_checksum --port=6432 --warning=cd2f3b5e129dc2b4f5c0f6d8d2e64231 - -For MRTG output, returns a 1 or 0 indicating success of failure of the checksum to match. A -checksum must be provided as the C<--mrtg> argument. The fourth line always gives the -current checksum. - =head2 B<pgb_pool_cl_active> =head2 B<pgb_pool_cl_waiting> @@ -8727,6 +8702,31 @@ the fourth line gives the name of the database, plus the current max_client_conn. If more than one database has been queried, the one with the highest number of connections is output. +=head2 B<pgbouncer_checksum> + +(C<symlink: check_postgres_pgbouncer_checksum>) Checks that all the +pgBouncer settings are the same as last time you checked. +This is done by generating a checksum of a sorted list of setting names and +their values. Note that you shouldn't specify the database name, it will +automatically default to pgbouncer. Either the I<--warning> or the I<--critical> option +should be given, but not both. The value of each one is the checksum, a +32-character hexadecimal value. You can run with the special C<--critical=0> option +to find out an existing checksum. + +This action requires the Digest::MD5 module. + +Example 1: Find the initial checksum for pgbouncer configuration on port 6432 using the default user (usually postgres) + + check_postgres_pgbouncer_checksum --port=6432 --critical=0 + +Example 2: Make sure no settings have changed and warn if so, using the checksum from above. + + check_postgres_pgbouncer_checksum --port=6432 --warning=cd2f3b5e129dc2b4f5c0f6d8d2e64231 + +For MRTG output, returns a 1 or 0 indicating success of failure of the checksum to match. A +checksum must be provided as the C<--mrtg> argument. The fourth line always gives the +current checksum. + =head2 B<prepared_txns> (C<symlink: check_postgres_prepared_txns>) Check on the age of any existing prepared transactions. |