fix influxdb query mode

This commit is contained in:
Colin Gagnaire 2019-06-12 14:56:43 +02:00
parent b6a0625b53
commit dbec7823b1
2 changed files with 2 additions and 2 deletions

View File

@ -179,7 +179,7 @@ sub query {
$self->{output}->add_option_msg(short_msg => "API returns error '" . $results->{results}[0]->{error} . "'"); $self->{output}->add_option_msg(short_msg => "API returns error '" . $results->{results}[0]->{error} . "'");
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
push @{$data}, @{$results->{results}[0]->{series}}; push @{$data}, @{$results->{results}[0]->{series}} if (defined($results->{results}[0]->{series}));
} }
return $data; return $data;

View File

@ -125,7 +125,7 @@ sub check_options {
$self->{custom_keys} = []; $self->{custom_keys} = [];
$self->{queries} = {}; $self->{queries} = {};
foreach my $query (@{$self->{option_results}->{query}}) { foreach my $query (@{$self->{option_results}->{query}}) {
next if ($query !~ /^(.*),(.*)/); next if ($query !~ /^(.*?),(.*)$/);
$self->{queries}->{$1} = $2; $self->{queries}->{$1} = $2;
push @{$self->{maps_counters}->{queries_results}[0]->{set}->{key_values}}, { name => $1 }; push @{$self->{maps_counters}->{queries_results}[0]->{set}->{key_values}}, { name => $1 };
push @{$self->{custom_keys}}, $1; push @{$self->{custom_keys}}, $1;