From bb7dba4a388f69cabd5d968b1da50ca46f15f7a8 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Tue, 26 Aug 2014 14:07:17 +0200 Subject: [PATCH] Fix local mode traffic linux --- os/linux/local/mode/traffic.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/os/linux/local/mode/traffic.pm b/os/linux/local/mode/traffic.pm index 49883de20..eed977b78 100644 --- a/os/linux/local/mode/traffic.pm +++ b/os/linux/local/mode/traffic.pm @@ -237,11 +237,13 @@ sub run { $in_prct = sprintf("%.2f", $in_prct); $out_prct = sprintf("%.2f", $out_prct); } else { + $in_prct = '-'; + $out_prct = '-'; + } + if ($self->{option_results}->{units} ne '%') { my $exit1 = $self->{perfdata}->threshold_check(value => $in_absolute_per_sec, threshold => [ { label => 'critical-in', 'exit_litteral' => 'critical' }, { label => 'warning-in', exit_litteral => 'warning' } ]); my $exit2 = $self->{perfdata}->threshold_check(value => $out_absolute_per_sec, threshold => [ { label => 'critical-out', 'exit_litteral' => 'critical' }, { label => 'warning-out', exit_litteral => 'warning' } ]); $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); - $in_prct = '-'; - $out_prct = '-'; } ########### @@ -353,7 +355,7 @@ Threshold critical in percent for 'out' traffic. =item B<--units> -Units of thresholds (Default: '%') ('%', 'B'). +Units of thresholds (Default: 'B') ('%', 'B'). Percent can be used only if --speed is set. =item B<--name>