[check_postgres] [commit] Handle cae where ROUND gives us -0
instead of 0 for three actions.
check_postgres at bucardo.org
check_postgres at bucardo.org
Wed Oct 8 15:57:55 UTC 2008
Committed by Greg Sabino Mullane <greg at endpoint.com>
Handle cae where ROUND gives us -0 instead of 0 for three actions.
Thanks to Glyn Astill for helping to track this down.
Bump version to 2.3.3 and release.
---
check_postgres.pl | 27 ++++++++++++++++-----------
check_postgres.pl.asc | 6 +++---
check_postgres.pl.html | 9 ++++++++-
index.html | 8 ++++----
4 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/check_postgres.pl b/check_postgres.pl
index bf5515b..f0b5e01 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.3.2';
+our $VERSION = '2.3.3';
use vars qw/ %opt $PSQL $res $COM $SQL $db /;
@@ -2840,7 +2840,7 @@ sub check_query_time {
$SQL = q{SELECT datname, max(COALESCE(ROUND(EXTRACT(epoch FROM now()-query_start)),0)) }.
qq{FROM pg_stat_activity WHERE current_query <> '<IDLE>'$USERWHERECLAUSE GROUP BY 1};
- $info = run_command($SQL, { regex => qr{\s*.+?\s+\|\s+\d+}, emptyok => 1 } );
+ $info = run_command($SQL, { regex => qr{\s*.+?\s+\|\s+\-?\d+}, emptyok => 1 } );
my $found = 0;
for $db (@{$info->{db}}) {
@@ -2852,8 +2852,8 @@ sub check_query_time {
$found = 1;
my $max = 0;
- SLURP: while ($db->{slurp} =~ /(.+?)\s+\|\s+(\d+)\s*/gsm) {
- my ($dbname,$current) = ($1,$2);
+ SLURP: while ($db->{slurp} =~ /(.+?)\s+\|\s+(\-?\d+)\s*/gsm) {
+ my ($dbname,$current) = ($1, int $2);
next SLURP if skip_item($dbname);
$max = $current if $current > $max;
}
@@ -2900,7 +2900,7 @@ sub check_txn_time {
$SQL = q{SELECT datname, max(COALESCE(ROUND(EXTRACT(epoch FROM now()-xact_start)),0)) }.
qq{FROM pg_stat_activity WHERE xact_start IS NOT NULL $USERWHERECLAUSE GROUP BY 1};
- my $info = run_command($SQL, { regex => qr[\s+\|\s+\d+], emptyok => 1 } );
+ my $info = run_command($SQL, { regex => qr[\s+\|\s+\-?\d+], emptyok => 1 } );
my $found = 0;
for $db (@{$info->{db}}) {
@@ -2915,8 +2915,8 @@ sub check_txn_time {
}
$found = 1;
my $max = -1;
- SLURP: while ($db->{slurp} =~ /(.+?)\s+\|\s+(\d+)\s*/gsm) {
- my ($dbname,$current) = ($1,$2);
+ SLURP: while ($db->{slurp} =~ /(.+?)\s+\|\s+(\-?\d+)\s*/gsm) {
+ my ($dbname,$current) = ($1, int $2);
next SLURP if skip_item($dbname);
$max = $current if $current > $max;
}
@@ -2973,7 +2973,7 @@ sub check_txn_idle {
$SQL = q{SELECT datname, max(COALESCE(ROUND(EXTRACT(epoch FROM now()-query_start)),0)) }.
qq{FROM pg_stat_activity WHERE current_query = '<IDLE> in transaction'$USERWHERECLAUSE GROUP BY 1};
- my $info = run_command($SQL, { regex => qr[\s*.+?\s+\|\s+\d+], emptyok => 1 } );
+ my $info = run_command($SQL, { regex => qr[\s*.+?\s+\|\s+\-?\d+], emptyok => 1 } );
my $found = 0;
for $db (@{$info->{db}}) {
@@ -2996,8 +2996,8 @@ sub check_txn_idle {
}
$found = 1;
- SLURP: while ($db->{slurp} =~ /(.+?)\s+\|\s+(\d+)\s*/gsm) {
- my ($dbname,$current) = ($1,$2);
+ SLURP: while ($db->{slurp} =~ /(.+?)\s+\|\s+(\-?\d+)\s*/gsm) {
+ my ($dbname,$current) = ($1, int $2);
next SLURP if skip_item($dbname);
$max = $current if $current > $max;
}
@@ -3549,7 +3549,7 @@ sub check_sequence {
=head1 NAME
B<check_postgres.pl> - a Postgres monitoring script for Nagios, MRTG, and others
-This documents describes check_postgres.pl version 2.3.2
+This documents describes check_postgres.pl version 2.3.3
=head1 SYNOPSIS
@@ -4692,6 +4692,11 @@ Items not specifically attributed are by Greg Sabino Mullane.
=item B<Version 2.3.2>
+ Account for cases where some rounding queries give -0 instead of 0.
+ Thanks to Glyn Astill for helping to track this down.
+
+=item B<Version 2.3.2>
+
Always quote identifiers in check_replicate_row action.
=item B<Version 2.3.1>
diff --git a/check_postgres.pl.asc b/check_postgres.pl.asc
index 39f0eb1..f4cd75f 100644
--- a/check_postgres.pl.asc
+++ b/check_postgres.pl.asc
@@ -1,6 +1,6 @@
-----BEGIN PGP SIGNATURE-----
-iEYEABEDAAYFAkjsw6cACgkQvJuQZxSWSshhtQCfTE8t7CFn2Xfmtt8E/GoTvyOI
-kvoAoNYdHSGahtDWRINR8oRqEU+XOaqB
-=xyuQ
+iEYEABEDAAYFAkjs2EQACgkQvJuQZxSWSsh7YwCg9OZB6Ed76caurDAJo4xuTE6U
+xS0AoKRLXITOrMGymNgxa5Ue7GkHpBVb
+=8U4w
-----END PGP SIGNATURE-----
diff --git a/check_postgres.pl.html b/check_postgres.pl.html
index 43ea6c3..868944f 100644
--- a/check_postgres.pl.html
+++ b/check_postgres.pl.html
@@ -90,7 +90,7 @@
<hr />
<h1><a name="name">NAME</a></h1>
<p><strong>check_postgres.pl</strong> - a Postgres monitoring script for Nagios, MRTG, and others
-This documents describes check_postgres.pl version 2.3.2</p>
+This documents describes check_postgres.pl version 2.3.3</p>
<p>
</p>
<hr />
@@ -1123,6 +1123,13 @@ feature requests, and commit notices, send email to <a href="mailto:check_postgr
<dd>
<pre>
+ Account for cases where some rounding queries give -0 instead of 0.
+ Thanks to Glyn Astill for helping to track this down.</pre>
+</dd>
+<dt><strong><strong>Version 2.3.2</strong></strong></dt>
+
+<dd>
+<pre>
Always quote identifiers in check_replicate_row action.</pre>
</dd>
<dt><strong><a name="item_version_2_2e3_2e1"><strong>Version 2.3.1</strong></a></strong></dt>
diff --git a/index.html b/index.html
index 2632930..9423a64 100644
--- a/index.html
+++ b/index.html
@@ -21,14 +21,14 @@ h1 {
<h1>check_postgres.pl</h1>
-<p><b>check_postgres.pl</b> 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 <a href="http://www.endpoint.com/">End Point Corporation</a> and is BSD-licensed. The latest version is <b>2.3.2</b>, and was released on October 08, 2008.</p>
+<p><b>check_postgres.pl</b> 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 <a href="http://www.endpoint.com/">End Point Corporation</a> and is BSD-licensed. The latest version is <b>2.3.3</b>, and was released on October 08, 2008.</p>
<ul>
- <li><a href="/check_postgres/check_postgres.pl.html">Documentation for check_postgres 2.3.2</a></li>
+ <li><a href="/check_postgres/check_postgres.pl.html">Documentation for check_postgres 2.3.3</a></li>
</ul>
<ul>
- <li><a href="/check_postgres/check_postgres.pl">Download check_postgres.pl 2.3.2</a></li>
- <li><a href="/check_postgres/check_postgres.pl.asc">PGP signature for check_postgres.pl 2.3.2</a></li>
+ <li><a href="/check_postgres/check_postgres.pl">Download check_postgres.pl 2.3.3</a></li>
+ <li><a href="/check_postgres/check_postgres.pl.asc">PGP signature for check_postgres.pl 2.3.3</a></li>
</ul>
<p>The latest development version can be downloaded via git:</p>
--
1.5.5.4
More information about the Check_postgres
mailing list