summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2009-07-10 16:25:35 +0000
committerGreg Sabino Mullane2009-07-10 16:25:35 +0000
commit3df096a137ea42061552338204f207f2020c70b1 (patch)
treea707f519fc875ca37adf19ba8f0e19ef076f2207 /check_postgres.pl
parentc5ede9831cf1122ecf8e601c3c5914250e836c86 (diff)
Allow last_analzye to work well with exclusions and perflimits. Per report by Jeff Frost.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl8
1 files changed, 7 insertions, 1 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 9f4bdb1ca..f82abbf73 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -3170,7 +3170,7 @@ sub check_last_vacuum_analyze {
.q{WHERE relkind = 'r' AND n.oid = c.relnamespace AND n.nspname <> 'information_schema' }
.q{ORDER BY 3) AS foo};
if ($opt{perflimit}) {
- $SQL .= " ORDER BY 3 DESC LIMIT $opt{perflimit}";
+ $SQL .= ' ORDER BY 3 DESC';
}
if ($USERWHERECLAUSE) {
@@ -3194,6 +3194,7 @@ sub check_last_vacuum_analyze {
my $maxptime = '?';
my ($minrel,$maxrel) = ('?','?'); ## no critic
my $mintime = 0; ## used for MRTG only
+ my $count = 0;
SLURP: while ($db->{slurp} =~ /(\S+)\s+\| (\S+)\s+\|\s+(\-?\d+) \| (.+)\s*$/gm) {
my ($schema,$name,$time,$ptime) = ($1,$2,$3,$4);
$maxtime = -3 if $maxtime == -1;
@@ -3211,6 +3212,9 @@ sub check_last_vacuum_analyze {
$mintime = $time;
$minrel = "$schema.$name";
}
+ if ($opt{perflimit}) {
+ last if ++$count >= $opt{perflimit};
+ }
}
if ($MRTG) {
$stats{$db->{dbname}} = $mintime;
@@ -7381,6 +7385,8 @@ Items not specifically attributed are by Greg Sabino Mullane.
Check and display the database for each match in the bloat check (Cédric Villemain)
Handle 'too many connections' FATAL error in the backends check with a critical,
rather than a generic error (Greg, idea by Jürgen Schulz-Brüssel)
+ Do not allow perflimit to interfere with exclusion rules in the vacuum and
+ analyze tests. (Greg, bug reported by Jeff Frost)
=item B<Version 2.9.1> (June 12, 2009)