summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2009-04-08 18:08:05 +0000
committerGreg Sabino Mullane2009-04-08 18:08:05 +0000
commite6bed5d10b1b33021d49f2c435682f7b435a30a8 (patch)
treeee6c261309bbcd3bde08ae7a32e7e381b1294dd9 /check_postgres.pl
parent2b09fa5574f2b140e8d9d32d0eb6768c4d42060c (diff)
User version.rss file to get Postgres revision information, per suggestion from Guillaume Lelarge
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl14
1 files changed, 4 insertions, 10 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 220e84d5a..b0a96f0f6 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -1663,7 +1663,7 @@ sub verify_version {
## We almost always need the version, so just grab it for any limitation
$SQL = q{SELECT setting FROM pg_settings WHERE name = 'server_version'};
my $oldslurp = $db->{slurp} || '';
- $info = run_command($SQL, {noverify => 1});
+ my $info = run_command($SQL, {noverify => 1});
if (defined $info->{db}[0]
and exists $info->{db}[0]{error}
and defined $info->{db}[0]{error}
@@ -4434,10 +4434,8 @@ sub check_new_version_pg {
## Note that we only check the revision
## This also depends highly on the web page at postgresql.org not changing format
- my $site = 'www.postgresql.org';
- my $url = "http://$site/";
- my $versionre1 = qr{/docs/\d+\.\d+/static/release-(\d+)\-(\d+)\-(\d+)};
- my $versionre2 = qr{/docs/\d+\.\d+/static/release\.html#RELEASE-(\d+)\-(\d+)\-(\d+)};
+ my $url = 'http://www.postgresql.org/versions.rss';
+ my $versionre = qr{<title>(\d+)\.(\d+)\.(\d+)</title>};
my $timeout = 30;
my @get_methods = (
@@ -4454,11 +4452,7 @@ sub check_new_version_pg {
my $COM = "$meth $url";
$VERBOSE >= 1 and warn "TRYING: $COM\n";
my $info = qx{$COM 2>/dev/null};
- while ($info =~ /$versionre1/g) {
- my ($maj,$min,$rev) = ($1,$2,$3);
- $newver{"$maj.$min"} = $rev;
- }
- while ($info =~ /$versionre2/g) {
+ while ($info =~ /$versionre/g) {
my ($maj,$min,$rev) = ($1,$2,$3);
$newver{"$maj.$min"} = $rev;
}