$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 /;
$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}}) {
$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;
}
$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}}) {
}
$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;
}
$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}}) {
}
$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;
}
=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
=over 4
+=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.
<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 />
<dl>
<dt><strong><a name="item_version_2_2e3_2e2"><strong>Version 2.3.2</strong></a></strong></dt>
+<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>
<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>