From: Greg Sabino Mullane Date: Thu, 4 Feb 2010 16:00:11 +0000 (-0500) Subject: For query_time action, show the offending database. X-Git-Tag: 2.13.2~3 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=7df087300dfaa085a03d6d7b8ccd6090f3db64de;p=check_postgres.git For query_time action, show the offending database. --- diff --git a/check_postgres.pl b/check_postgres.pl index 8b75c471c..c75ace1e2 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -3898,10 +3898,14 @@ sub check_query_time { $found = 1; my $max = 0; - SLURP: while ($db->{slurp} =~ /(.+?)\s+\|\s+(\-?\d+)\s*/gsm) { + my $maxdb = '?'; + SLURP: while ($db->{slurp} =~ /\s*(.+?)\s+\|\s+(\-?\d+)\s*/gsm) { my ($dbname,$current) = ($1, int $2); next SLURP if skip_item($dbname); - $max = $current if $current > $max; + if ($current > $max) { + $max = $current; + $maxdb = $dbname; + } } if ($MRTG) { $stats{$db->{dbname}} = $max; @@ -3913,6 +3917,8 @@ sub check_query_time { $db->{perf} .= "$critical" if length $critical; my $msg = msg('qtime-msg', $max); + $msg .= " db=$maxdb"; + if (length $critical and $max >= $critical) { add_critical $msg; }