[Check_postgres-commit] [commit 1/4] Respesct perflimit on main output of sequence action.

check_postgres at bucardo.org check_postgres at bucardo.org
Thu Feb 4 16:33:26 UTC 2010


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

Subject: [commit 1/4] Respesct perflimit on main output of sequence action.

---
 check_postgres.pl |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/check_postgres.pl b/check_postgres.pl
index cd467b7..6970050 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -5963,6 +5963,8 @@ sub check_sequence {
 	my $MAXINT4 = 2147483647;
 	my $MAXINT8 = 9223372036854775807;
 
+	my $limit = 0;
+
 	for $db (@{$info->{db}}) {
 		my (@crit, at warn, at ok);
 		my $maxp = 0;
@@ -5987,7 +5989,9 @@ sub check_sequence {
 			$seqperf{$percent}{$seqname} = [$left, " $multidb$seqname=$percent|$slots|$used|$left"];
 			if ($percent >= $maxp) {
 				$maxp = $percent;
-				push @{$seqinfo{$percent}} => $MRTG ? [$seqname,$percent,$slots,$used,$left] : $msg;
+				if (! exists $opt{perflimit} or $limit++ < $opt{perflimit}) {
+					push @{$seqinfo{$percent}} => $MRTG ? [$seqname,$percent,$slots,$used,$left] : $msg;
+				}
 			}
 			next if $MRTG;
 
@@ -6002,7 +6006,7 @@ sub check_sequence {
 			my $msg = join ' | ' => map { $_->[0] } @{$seqinfo{$maxp}};
 			do_mrtg({one => $maxp, msg => $msg});
 		}
-		my $limit = 0;
+		$limit = 0;
 		PERF: for my $val (sort { $b <=> $a } keys %seqperf) {
 			for my $seq (sort { $seqperf{$val}{$a}->[0] <=> $seqperf{$val}{$b}->[0] or $a cmp $b } keys %{$seqperf{$val}}) {
 				last PERF if exists $opt{perflimit} and $limit++ >= $opt{perflimit};
-- 
1.6.2.2



More information about the Check_postgres-commit mailing list