Skip to content

Commit

Permalink
Create nwc_interface_broadcast
Browse files Browse the repository at this point in the history
Currently the broadcast values are calculated on the total number o packets.
This is to ask a change in order to have tha value calculated on the input/outputRate.
GR
  • Loading branch information
rampagejack2 authored Feb 25, 2019
1 parent d46f9dd commit 348eb8a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions nwc_interface_broadcast
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
} elsif ($self->mode =~ /device::interfaces::broadcast/) {
$self->add_info(sprintf 'interface %s broadcast in:%.2f out:%.2f ',
$full_descr,
$self->{broadcastInPercent} / 100 * $self->{inputRate} , $self->{broadcastOutPercent} / 100 * $self->{outputRate} );
$self->set_thresholds(
metric => $self->{ifDescr}.'_broadcast_in',
warning => $self->{maxInputRate} / 100 * 10,
critical => $self->{maxInputRate} / 100 * 20,
);
my $in = $self->check_thresholds(
metric => $self->{ifDescr}.'_broadcast_in',
value => $self->{broadcastInPercent} / 100 * $self->{inputRate},
);
$self->set_thresholds(
metric => $self->{ifDescr}.'_broadcast_out',
warning => $self->{maxOutputRate} / 100 * 10,
critical => $self->{maxOutputRate} / 100 * 20,
);
my $out = $self->check_thresholds(
metric => $self->{ifDescr}.'_broadcast_out',
value => $self->{broadcastOutPercent} / 100 * $self->{outputRate},
);
my $level = ($in > $out) ? $in : ($out > $in) ? $out : $in;
$self->add_message($level);
$self->add_perfdata(
label => $self->{ifDescr}.'_broadcast_in',
value => $self->{broadcastInPercent} / 100 * $self->{inputRate},
uom => $self->opts->units =~ /^(B|KB|MB|GB|TB)$/ ? $self->opts->units : undef,
places => 2,
min => 0,
max => $self->{maxInputRate},
);
$self->add_perfdata(
label => $self->{ifDescr}.'_broadcast_out',
value => $self->{broadcastOutPercent} / 100 * $self->{outputRate},
uom => $self->opts->units =~ /^(B|KB|MB|GB|TB)$/ ? $self->opts->units : undef,
places => 2,
min => 0,
max => $self->{maxOutputRate},
);

0 comments on commit 348eb8a

Please sign in to comment.