diff --git a/check_postgres.pl b/check_postgres.pl index b7df607d..035c5142 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -4398,9 +4398,17 @@ sub check_custom_query { my $goodrow = 0; - ## The other column tells it the name to use as the perfdata value + ## If there is a single row and at least 2 columns, + ## the other column tells it the name to use as the perfdata value + ## If there are multiple rows and at least 2 columns, + ## use the second column value as the perfdata name, + ## use the result value as the perfdata value. my $perfname; - + my $perfdata = ''; + if (! defined $db->{perf}){ + $db->{perf} = ''; + } + my $grandtotal = @{$db->{slurp}}; for my $r (@{$db->{slurp}}) { my $result = $r->{result}; if (! defined $perfname) { @@ -4413,8 +4421,16 @@ sub check_custom_query { } $goodrow++; if ($perfname) { - $db->{perf} .= sprintf ' %s=%s;%s;%s', - perfname($perfname), $r->{$perfname}, $warning, $critical; + if ($grandtotal > 1) { + $perfdata = sprintf ' %s=%s;%s;%s', + perfname($r->{$perfname}), $result, $warning, $critical; + if ($perfdata ne $db->{perf}){ + $db->{perf} .= $perfdata; + } + } else { + $db->{perf} .= sprintf ' %s=%s;%s;%s', + perfname($perfname), $r->{$perfname}, $warning, $critical; + } } my $gotmatch = 0; if (! defined $result) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy