This commit is contained in:
garnier-quentin 2019-10-24 14:54:19 +02:00
parent d4cc8cbf70
commit 9d7d6fd816
1 changed files with 9 additions and 9 deletions

View File

@ -90,13 +90,13 @@ sub new {
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
"query:s@" => { name => 'query' }, 'query:s@' => { name => 'query' },
"instance:s" => { name => 'instance' }, 'instance:s' => { name => 'instance' },
"aggregation:s" => { name => 'aggregation', default => 'average' }, 'aggregation:s' => { name => 'aggregation', default => 'average' },
"output:s" => { name => 'output' }, 'output:s' => { name => 'output' },
"multiple-output:s" => { name => 'multiple_output' }, 'multiple-output:s' => { name => 'multiple_output' },
"warning-status:s" => { name => 'warning_status', default => '' }, 'warning-status:s' => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '' }, 'critical-status:s' => { name => 'critical_status', default => '' },
}); });
return $self; 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})); $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}}}->{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) { 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(); $self->{output}->option_exit();
} }
} }