summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck_postgres.pl39
-rw-r--r--t/02_new_version_box.t27
2 files changed, 61 insertions, 5 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 05f47198f..d14ae1b84 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -901,6 +901,7 @@ our $action_info = {
locks => [0, 'Checks the number of locks.'],
logfile => [1, 'Checks that the logfile is being written to correctly.'],
new_version_bc => [0, 'Checks if a newer version of Bucardo is available.'],
+ new_version_box => [0, 'Checks if a newer version of boxinfo is available.'],
new_version_cp => [0, 'Checks if a newer version of check_postgres.pl is available.'],
new_version_pg => [0, 'Checks if a newer version of Postgres is available.'],
new_version_tnm => [0, 'Checks if a newer version of tail_n_mail is available.'],
@@ -1598,6 +1599,9 @@ check_new_version_pg() if $action eq 'new_version_pg';
## Check for new versions of Bucardo
check_new_version_bc() if $action eq 'new_version_bc';
+## Check for new versions of boxinfo
+check_new_version_boxinfo() if $action eq 'new_version_box';
+
## Check for new versions of tail_n_mail
check_new_version_tnm() if $action eq 'new_version_tnm';
@@ -4606,6 +4610,18 @@ sub check_new_version_bc {
} ## end of check_new_version_bc
+sub check_new_version_boxinfo {
+
+ ## Check if a newer version of boxinfo is available
+
+ my $url = 'http://bucardo.org/boxinfo/latest_version.txt';
+ find_new_version('boxinfo', 'boxinfo.pl', $url);
+
+ return;
+
+} ## end of check_new_version_bc
+
+
sub check_new_version_cp {
## Check if a new version of check_postgres.pl is available
@@ -7610,11 +7626,12 @@ which determine if the output is displayed or not, where 'a' = all, 'c' = critic
=item B<--get_method=VAL>
Allows specification of the method used to fetch information for the C<new_version_cp>,
-C<new_version_pg>, C<new_version_bc>, and C<new_version_tnm> checks. The following programs are tried,
-in order, to grab the information from the web: GET, wget, fetch, curl, lynx, links. To force the use of just
-one (and thus remove the overhead of trying all the others until one of those works),
-enter one of the names as the argument to get_method. For example, a BSD box might enter
-the following line in their C<.check_postgresrc> file:
+C<new_version_pg>, C<new_version_bc>, C<new_version_box>, and C<new_version_tnm> checks.
+The following programs are tried, in order, to grab the information from the web:
+GET, wget, fetch, curl, lynx, links. To force the use of just one (and thus remove the
+overhead of trying all the others until one of those works), enter one of the names as
+the argument to get_method. For example, a BSD box might enter the following line in
+their C<.check_postgresrc> file:
get_method=fetch
@@ -8284,6 +8301,16 @@ available, a critical is returned. (Bucardo is a master to slave, and master to
replication system for Postgres: see http://bucardo.org for more information).
See also the information on the C<--get_method> option.
+=head2 B<new_version_box>
+
+(C<symlink: check_postgres_new_version_box>) Checks if a newer version of the boxinfo
+program is available. The current version is obtained by running C<boxinfo.pl --version>.
+If a major upgrade is available, a warning is returned. If a revision upgrade is
+available, a critical is returned. (boxinfo is a program for grabbing important
+information from a server and putting it into a HTML format: see
+http://bucardo.org/wiki/boxinfo for more information). See also the information on
+the C<--get_method> option.
+
=head2 B<new_version_cp>
(C<symlink: check_postgres_new_version_cp>) Checks if a newer version of this program
@@ -8984,6 +9011,8 @@ Items not specifically attributed are by Greg Sabino Mullane.
Allow "and", "or" inside arguments (David E. Wheeler)
+ Add the "new_version_box" action.
+
Fix psql version regex (Peter Eisentraut, bug #69)
=item B<Version 2.16.0> January 20, 2011
diff --git a/t/02_new_version_box.t b/t/02_new_version_box.t
new file mode 100644
index 000000000..c6920d52d
--- /dev/null
+++ b/t/02_new_version_box.t
@@ -0,0 +1,27 @@
+#!perl
+
+## Test the "new_version_box" action
+
+use 5.006;
+use strict;
+use warnings;
+use Data::Dumper;
+use Test::More tests => 1;
+use lib 't','.';
+use CP_Testing;
+
+use vars qw/$dbh $t/;
+
+my $cp = CP_Testing->new( {default_action => 'new_version_box'} );
+
+$dbh = $cp->test_database_handle();
+
+my $S = q{Action 'new_version_box'};
+my $label = 'POSTGRES_NEW_VERSION_BOX';
+
+$t=qq{$S fails when called with an invalid option};
+like ($cp->run('foobar=12'), qr{^\s*Usage:}, $t);
+
+## No other tests for now
+
+exit;