Skip to content

Commit 40ad646

Browse files
authored
avoid duplicate perfdata for multirow custom_query
Addresses concern raised in [Issue bucardo#69](bucardo#69)
1 parent 4dd5aa2 commit 40ad646

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

check_postgres.pl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4404,6 +4404,7 @@ sub check_custom_query {
44044404
## use the second column value as the perfdata name,
44054405
## use the result value as the perfdata value.
44064406
my $perfname;
4407+
my $perfdata;
44074408
my $grandtotal = @{$db->{slurp}};
44084409
for my $r (@{$db->{slurp}}) {
44094410
my $result = $r->{result};
@@ -4418,8 +4419,11 @@ sub check_custom_query {
44184419
$goodrow++;
44194420
if ($perfname) {
44204421
if ($grandtotal > 1) {
4421-
$db->{perf} = sprintf ' %s=%s;%s;%s',
4422+
$perfdata = sprintf ' %s=%s;%s;%s',
44224423
perfname($r->{$perfname}), $result, $warning, $critical;
4424+
if ($perfdata ne $db->{perf}){
4425+
$db->{perf} .= $perfdata;
4426+
}
44234427
} else {
44244428
$db->{perf} .= sprintf ' %s=%s;%s;%s',
44254429
perfname($perfname), $r->{$perfname}, $warning, $critical;

0 commit comments

Comments
 (0)