From ffef495ced3cf333f56792cb8ad8b3c56d35f58a Mon Sep 17 00:00:00 2001 From: Florian Asche Date: Thu, 27 Mar 2014 00:34:13 +0100 Subject: [PATCH] Refs #5389: Fix Output --- apps/hddtemp/mode/listdrives.pm | 4 ++-- apps/hddtemp/mode/temperature.pm | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/hddtemp/mode/listdrives.pm b/apps/hddtemp/mode/listdrives.pm index 4e2f5c311..d67e5ace7 100644 --- a/apps/hddtemp/mode/listdrives.pm +++ b/apps/hddtemp/mode/listdrives.pm @@ -110,7 +110,7 @@ sub run { my $drive_display = ''; my $drive_display_append = ''; foreach my $name (sort(keys %{$self->{result}})) { - $drive_display .= $drive_display_append . 'name = ' . $name . ' [state = ' . $self->{result}->{$name}->{temperature} . $self->{result}->{$name}->{unit} . ']'; + $drive_display .= $drive_display_append . 'name = ' . $name . ' [temperature = ' . $self->{result}->{$name}->{temperature} . $self->{result}->{$name}->{unit} . ']'; $drive_display_append = ', '; } @@ -132,7 +132,7 @@ sub disco_show { $self->manage_selection(); foreach my $name (sort(keys %{$self->{result}})) { $self->{output}->add_disco_entry(name => $name, - state => $self->{result}->{$name}->{temperature} + temperature => $self->{result}->{$name}->{temperature} ); } } diff --git a/apps/hddtemp/mode/temperature.pm b/apps/hddtemp/mode/temperature.pm index 829b5b17d..9533a8bc2 100644 --- a/apps/hddtemp/mode/temperature.pm +++ b/apps/hddtemp/mode/temperature.pm @@ -139,12 +139,16 @@ sub run { foreach my $name (sort(keys %{$self->{result}})) { my $exit = $self->{perfdata}->threshold_check(value => $self->{result}->{$name}->{temperature}, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - $self->{output}->output_add(long_msg => sprintf("Harddrive '%s' Temperature : %s", $name, - $self->{result}->{$name}->{temperature})); + $self->{output}->output_add(long_msg => sprintf("Harddrive '%s' Temperature : %s%s", + $name, + $self->{result}->{$name}->{temperature}, + $self->{result}->{$name}->{unit})); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1) || (defined($self->{option_results}->{name}) && !defined($self->{option_results}->{use_regexp}))) { $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Harddrive '%s' Temperature : %s", $name, - $self->{result}->{$name}->{temperature})); + short_msg => sprintf("Harddrive '%s' Temperature : %s%s", + $name, + $self->{result}->{$name}->{temperature}, + $self->{result}->{$name}->{unit})); } my $extra_label = '';