[check_postgres] [commit] Adjust last_vacuum_analyze a bit.

check_postgres at bucardo.org check_postgres at bucardo.org
Wed Apr 22 20:33:18 UTC 2009


Committed by Greg Sabino Mullane <greg at endpoint.com>

Adjust last_vacuum_analyze a bit.

---
 check_postgres.pl |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/check_postgres.pl b/check_postgres.pl
index 7525738..7e34046 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -3077,13 +3077,20 @@ sub check_last_vacuum_analyze {
 			next;
 		}
 
-		my $maxtime = -2;
+		## -1 means no tables found at all
+		## -2 means exclusion rules took effect
+		## -3 means no tables were ever vacuumed/analyzed
+		my $maxtime = -1;
 		my $maxptime = '?';
 		my ($minrel,$maxrel) = ('?','?'); ## no critic
 		my $mintime = 0; ## used for MRTG only
 		SLURP: while ($db->{slurp} =~ /(\S+)\s+\| (\S+)\s+\|\s+(\-?\d+) \| (.+)\s*$/gm) {
 			my ($schema,$name,$time,$ptime) = ($1,$2,$3,$4);
-			next SLURP if skip_item($name, $schema);
+			$maxtime = -3 if $maxtime == -1;
+			if (skip_item($name, $schema)) {
+				$maxtime = -2 if $maxtime < 1;
+				next SLURP;
+			}
 			$db->{perf} .= " $schema.$name=$time" if $time >= 0;
 			if ($time > $maxtime) {
 				$maxtime = $time;
@@ -3100,10 +3107,11 @@ sub check_last_vacuum_analyze {
 			$statsmsg{$db->{dbname}} = msg('vac-msg', $db->{dbname}, $minrel);
 			next;
 		}
+
 		if ($maxtime == -2) {
 			add_unknown msg('no-match-table');
 		}
-		elsif ($maxtime == -1) {
+		elsif ($maxtime < 0) {
 			add_unknown $type eq 'vacuum' ? msg('vac-nomatch-v') : msg('vac-nomatch-a');
 		}
 		else {
-- 
1.6.0.5



More information about the Check_postgres mailing list