Skip to content

Commit

Permalink
Correct swapped input/output and add error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Virsacer committed Dec 20, 2024
1 parent 7fd8b69 commit 7a2c387
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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%% ',
Expand Down

0 comments on commit 7a2c387

Please sign in to comment.