From 7acf998ee6da6e07a14de3f78bd197fe18bd5bb7 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 6 Nov 2008 13:31:36 -0500 Subject: [PATCH] Fix for old versions of File::Temp by Chris Butler --- check_postgres.pl | 13 +++++++++---- check_postgres.pl.asc | 6 +++--- check_postgres.pl.html | 9 ++++++++- index.html | 8 ++++---- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/check_postgres.pl b/check_postgres.pl index 094483771..5044cd9d2 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -28,7 +28,7 @@ $Data::Dumper::Varname = 'POSTGRES'; $Data::Dumper::Indent = 2; $Data::Dumper::Useqq = 1; -our $VERSION = '2.4.1'; +our $VERSION = '2.4.2'; use vars qw/ %opt $PSQL $res $COM $SQL $db /; @@ -303,7 +303,7 @@ if ($opt{showtime}) { ## We don't (usually) want to die, but want a graceful Nagios-like exit instead sub ndie { - File::Temp::cleanup(); + eval { File::Temp::cleanup(); }; my $msg = shift; chomp $msg; print "ERROR: $msg\n"; @@ -1139,7 +1139,7 @@ sub run_command { close $errfh or ndie qq{Could not close $errorfile: $!\n}; close $tempfh or ndie qq{Could not close $tempfile: $!\n}; - File::Temp::cleanup(); + eval { File::Temp::cleanup(); }; $info->{hosts} = keys %host; @@ -3725,7 +3725,7 @@ sub show_dbstats { =head1 NAME B - a Postgres monitoring script for Nagios, MRTG, Cacti, and others -This documents describes check_postgres.pl version 2.4.1 +This documents describes check_postgres.pl version 2.4.2 =head1 SYNOPSIS @@ -4942,6 +4942,11 @@ Items not specifically attributed are by Greg Sabino Mullane. =over 4 +=item B + + Wrap File::Temp::cleanup() calls in eval, in case File::Temp is an older version. + Patch by Chris Butler. + =item B Cast numbers to numeric to support sequences ranges > bigint in check_sequence action. diff --git a/check_postgres.pl.asc b/check_postgres.pl.asc index 4089a4250..1523cb7be 100644 --- a/check_postgres.pl.asc +++ b/check_postgres.pl.asc @@ -1,6 +1,6 @@ -----BEGIN PGP SIGNATURE----- -iEYEABEDAAYFAkkR4C4ACgkQvJuQZxSWSshcOACfeVZ8AWBfSRQIORPd5pL51TUr -fGwAoOmcRxDE7BQ+IwoAwc/2OV47ea96 -=eLTc +iEYEABEDAAYFAkkTN9gACgkQvJuQZxSWSsjxVQCg6dc8cZc6axb7dfrDHaZe9eDt +HyMAoIK731LqETVlsqI59ANroNyKNid+ +=U6xS -----END PGP SIGNATURE----- diff --git a/check_postgres.pl.html b/check_postgres.pl.html index d3cec38b1..5fa7da7a0 100644 --- a/check_postgres.pl.html +++ b/check_postgres.pl.html @@ -92,7 +92,7 @@

NAME

check_postgres.pl - a Postgres monitoring script for Nagios, MRTG, Cacti, and others -This documents describes check_postgres.pl version 2.4.1

+This documents describes check_postgres.pl version 2.4.2


@@ -1203,6 +1203,13 @@ feature requests, and commit notices, send email to HISTORY

Items not specifically attributed are by Greg Sabino Mullane.

+
Version 2.4.2
+ +
+
+  Warp File::Temp::cleanup() call in eval, in case File::Temp is an older version.
+  Patch by Chris Butler.
+
Version 2.4.1
diff --git a/index.html b/index.html index ee30b96b7..11261fc72 100644 --- a/index.html +++ b/index.html @@ -21,14 +21,14 @@ h1 {

check_postgres.pl

-

check_postgres.pl is a script for checking the state of one or more Postgres databases and reporting back in a Nagios-friendly manner. It was developed by Greg Sabino Mullane of End Point Corporation and is BSD-licensed. The latest version is 2.4.1, and was released on November 05, 2008.

+

check_postgres.pl is a script for checking the state of one or more Postgres databases and reporting back in a Nagios-friendly manner. It was developed by Greg Sabino Mullane of End Point Corporation and is BSD-licensed. The latest version is 2.4.2, and was released on November 06, 2008.

The latest development version can be downloaded via git:

-- 2.39.5