From 3c6580281acd6da29cc0d82f88ed83aa87327d18 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 24 Oct 2019 14:54:19 +0200 Subject: [PATCH] Fix #1690 --- database/influxdb/mode/query.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/database/influxdb/mode/query.pm b/database/influxdb/mode/query.pm index e0b774df6..3710fa7ac 100644 --- a/database/influxdb/mode/query.pm +++ b/database/influxdb/mode/query.pm @@ -90,13 +90,13 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - "query:s@" => { name => 'query' }, - "instance:s" => { name => 'instance' }, - "aggregation:s" => { name => 'aggregation', default => 'average' }, - "output:s" => { name => 'output' }, - "multiple-output:s" => { name => 'multiple_output' }, - "warning-status:s" => { name => 'warning_status', default => '' }, - "critical-status:s" => { name => 'critical_status', default => '' }, + 'query:s@' => { name => 'query' }, + 'instance:s' => { name => 'instance' }, + 'aggregation:s' => { name => 'aggregation', default => 'average' }, + 'output:s' => { name => 'output' }, + 'multiple-output:s' => { name => 'multiple_output' }, + 'warning-status:s' => { name => 'warning_status', default => '' }, + 'critical-status:s' => { name => 'critical_status', default => '' }, }); return $self; @@ -153,11 +153,11 @@ sub manage_selection { $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]} = $value; + $self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{$result->{columns}[1]} = defined($value) ? $value : ''; } if (scalar(keys %{$self->{queries_results}}) <= 0) { - $self->{output}->add_option_msg(short_msg => "No queries found."); + $self->{output}->add_option_msg(short_msg => 'No queries found.'); $self->{output}->option_exit(); } }