From 7a2c387d0e6516d86afdb14b6a9d5a55930183b6 Mon Sep 17 00:00:00 2001 From: Virsacer Date: Thu, 26 Sep 2024 23:55:39 +0200 Subject: [PATCH] Correct swapped input/output and add error handling --- .../IFMIB/Component/InterfaceSubsystem.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins-scripts/CheckNwcHealth/IFMIB/Component/InterfaceSubsystem.pm b/plugins-scripts/CheckNwcHealth/IFMIB/Component/InterfaceSubsystem.pm index bb9366e7..272dd1f0 100644 --- a/plugins-scripts/CheckNwcHealth/IFMIB/Component/InterfaceSubsystem.pm +++ b/plugins-scripts/CheckNwcHealth/IFMIB/Component/InterfaceSubsystem.pm @@ -1184,11 +1184,11 @@ sub check { }); my $coutwarning = $self->mod_threshold($outwarning, sub { my $val = shift; - return $self->{maxInputRate} / 100 * $val; + return $self->{maxOutputRate} / 100 * $val; }); my $coutcritical = $self->mod_threshold($outcritical, sub { my $val = shift; - return $self->{maxInputRate} / 100 * $val; + return $self->{maxOutputRate} / 100 * $val; }); $self->set_thresholds( # it there are --warning/critical on the command line @@ -1294,16 +1294,16 @@ sub check { value => $self->{inputRate}, uom => $self->opts->units =~ /^(B|KB|MB|GB|TB)$/ ? $self->opts->units : undef, places => 2, - min => 0, - max => $self->{maxInputRate}, + min => $self->{maxInputRate} ? 0 : "", + max => $self->{maxInputRate} ? $self->{maxInputRate} : "", ); $self->add_perfdata( label => $self->{ifDescr}.'_traffic_out', value => $self->{outputRate}, uom => $self->opts->units =~ /^(B|KB|MB|GB|TB)$/ ? $self->opts->units : undef, places => 2, - min => 0, - max => $self->{maxOutputRate}, + min => $self->{maxOutputRate} ? 0 : "", + max => $self->{maxOutputRate} ? $self->{maxOutputRate} : "", ); } elsif ($self->mode =~ /device::interfaces::errors/) { $self->add_info(sprintf 'interface %s errors in:%.2f%% out:%.2f%% ',