From 105056061af7fb4a2ddb757cffc9b23295fb0616 Mon Sep 17 00:00:00 2001 From: CPbN <40244829+CPbN@users.noreply.github.com> Date: Thu, 7 Nov 2019 12:01:13 +0100 Subject: [PATCH] Compute index without additional mod --- database/influxdb/mode/query.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/database/influxdb/mode/query.pm b/database/influxdb/mode/query.pm index c1c7fd7d8..438fc74ef 100644 --- a/database/influxdb/mode/query.pm +++ b/database/influxdb/mode/query.pm @@ -25,7 +25,6 @@ use base qw(centreon::plugins::templates::counter); use strict; use warnings; use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); -use List::MoreUtils qw(first_index); sub custom_status_perfdata { my ($self, %options) = @_; @@ -152,7 +151,7 @@ sub manage_selection { foreach my $result (@{$queries_results}) { next if (!defined($result->{tags}->{$self->{option_results}->{instance}})); - my $column_index = first_index { $_ eq $self->{custom_keys}[$query_index] } @{$result->{columns}}; + my ($column_index) = grep { $result->{columns}[$_] eq $self->{custom_keys}[$query_index] } (0 .. @{$result->{columns}}-1); my $value; $value = $options{custom}->compute(aggregation => $self->{option_results}->{aggregation}, values => $result->{values}, column => $column_index) if (defined($result->{values})); $self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{instance} = $result->{tags}->{$self->{option_results}->{instance}};