From 9b39dcbd1bd64a424a6320e1e5bf9d6689900f53 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 7 Jul 2020 14:54:40 +0200 Subject: [PATCH] patch mssql transactions --- database/mssql/mode/transactions.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/database/mssql/mode/transactions.pm b/database/mssql/mode/transactions.pm index 7e56bf99c..5ff5ba40e 100644 --- a/database/mssql/mode/transactions.pm +++ b/database/mssql/mode/transactions.pm @@ -24,6 +24,7 @@ use base qw(centreon::plugins::templates::counter); use strict; use warnings; +use centreon::plugins::misc; use Digest::MD5 qw(md5_hex); sub prefix_database_output { @@ -85,18 +86,19 @@ sub manage_selection { $self->{global} = {}; $self->{database} = {}; foreach my $row (@$result) { - if ($row->[0] =~ /_Total/) { + my $name = centreon::plugins::misc::trim($row->[0]); + if ($name eq '_Total') { $self->{global}->{transactions} = $row->[1]; next; } if (defined($self->{option_results}->{filter_database}) && $self->{option_results}->{filter_database} ne '' && - $row->[0] !~ /$self->{option_results}->{filter_database}/) { - $self->{output}->output_add(long_msg => "skipping '" . $row->[0] . "': no matching filter.", debug => 1); + $name !~ /$self->{option_results}->{filter_database}/) { + $self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1); next; } - $self->{database}->{ $row->[0] } = { - display => $row->[0], + $self->{database}->{ $name } = { + display => $name, transactions => $row->[1] }; }