diff options
author | Greg Sabino Mullane | 2009-08-03 15:48:27 +0000 |
---|---|---|
committer | Greg Sabino Mullane | 2009-08-03 15:48:27 +0000 |
commit | bd82d9f1d1ba81728efb2804fe27003ed4f00022 (patch) | |
tree | 9738934f628363760a2fdc211a6eab855a6166b3 | |
parent | 7ba6edb208ebd4fa3bb9c38955559d33daebd3d4 (diff) |
Proper Nagios perf output for the backends check (Cédric Villemain)
Test adjustments for same (Greg Sabino Mullane)
-rwxr-xr-x | check_postgres.pl | 18 | ||||
-rw-r--r-- | t/02_backends.t | 4 |
2 files changed, 18 insertions, 4 deletions
diff --git a/check_postgres.pl b/check_postgres.pl index 45f060881..8b40bf844 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -2358,7 +2358,21 @@ sub check_backends { $limit ||= $2; my ($current,$dbname) = ($1,$3); ## Always want perf to show all - $db->{perf} .= " '$dbname'=$current"; + my $nwarn=$w2; + my $ncrit=$e2; + if ($e1){ + $ncrit = $limit-$e2; + } + elsif ($e3) { + $ncrit = (int $e2*$limit/100) + } + if ($w1){ + $nwarn = $limit-$w2; + } + elsif ($w3) { + $nwarn = (int $w2*$limit/100) + } + $db->{perf} .= " '$dbname'=$current;$nwarn;$ncrit;0;$limit"; next SLURP if skip_item($dbname); $total += $current; } @@ -7561,7 +7575,7 @@ Items not specifically attributed are by Greg Sabino Mullane. For same_schema, compare view definitions, and compare languages. Make script into a global executable via the Makefile.PL file. Better output when comparing two databases. - Proper Nagios output syntax for autovac_freeze (Cédric Villemain) + Proper Nagios output syntax for autovac_freeze and backends checks (Cédric Villemain) =item B<Version 2.9.5> (July 24, 2009) diff --git a/t/02_backends.t b/t/02_backends.t index f794b3700..37380bd08 100644 --- a/t/02_backends.t +++ b/t/02_backends.t @@ -51,7 +51,7 @@ SKIP: { like ($result, qr{^$label OK: \(host:$host\) 2 of 10 connections \(20%\)}, $t); $t=qq{$S returned correct performance data}; - like ($result, qr{ \| time=(\d\.\d\d) 'ardala'=0 'beedeebeedee'=0 'postgres'=2 'template0'=0 'template1'=0\s$}, $t); + like ($result, qr{ \| time=(\d\.\d\d) 'ardala'=0;9;9;0;10 'beedeebeedee'=0;9;9;0;10 'postgres'=2;9;9;0;10 'template0'=0;9;9;0;10 'template1'=0;9;9;0;10\s$}, $t); } $t=qq{$S fails when called with an invalid option}; @@ -174,7 +174,7 @@ SKIP: { like ($cp->run('--include=postgres --exclude=postgres'), qr{^$label OK: .+3 of 10}, $t); $t=qq{$S returned correct performance data with include}; - like ($cp->run('--include=postgres'), qr{ \| time=(\d\.\d\d) 'ardala'=0 'beedeebeedee'=0 'postgres'=3}, $t); + like ($cp->run('--include=postgres'), qr{ \| time=(\d\.\d\d) 'ardala'=0;9;9;0;10 'beedeebeedee'=0;9;9;0;10 'postgres'=3;9;9;0;10}, $t); } my %dbh; |