revert influxdb

This commit is contained in:
garnier-quentin 2019-10-24 15:15:56 +02:00
parent 3c6580281a
commit c3b7c3858d
1 changed files with 6 additions and 5 deletions

View File

@ -144,18 +144,19 @@ sub manage_selection {
foreach my $label (keys %{$self->{queries}}) {
push @queries, $self->{queries}->{$label};
}
my $queries_results = $options{custom}->query(queries => \@queries) if (scalar(@queries) > 0);
my $queries_results = [];
$queries_results = $options{custom}->query(queries => \@queries) if (scalar(@queries) > 0);
foreach my $result (@{$queries_results}) {
next if (!defined($result->{tags}->{$self->{option_results}->{instance}}));
my $value;
$value = $options{custom}->compute(aggregation => $self->{option_results}->{aggregation}, values => $result->{values}) if (defined($result->{values}));
$self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{instance} = $result->{tags}->{$self->{option_results}->{instance}};
$self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{$result->{columns}[1]} = defined($value) ? $value : '';
$self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{$result->{columns}[1]} = $value;
}
if (scalar(keys %{$self->{queries_results}}) <= 0) {
$self->{output}->add_option_msg(short_msg => 'No queries found.');
$self->{output}->option_exit();