From 580a39ed41377e6e704a377807c53b0de929d45e Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Wed, 11 Jul 2018 20:29:31 +0200 Subject: [PATCH] Plugin multibandwidth: rename environment setting for limiting the valid range --- plugins/network/multibandwidth | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/network/multibandwidth b/plugins/network/multibandwidth index 4cbfefe0..810a5725 100755 --- a/plugins/network/multibandwidth +++ b/plugins/network/multibandwidth @@ -28,7 +28,7 @@ env.hosts example.org example2.org example3.org env.samples 15 env.small_packet_size 44 env.big_packet_size 108 -env.max_mbps 15728640 +env.max_valid_bps 15728640 - env.hosts explanation: hostname or IP of the hosts to calculate the bandwidth. @@ -41,7 +41,7 @@ env.max_mbps 15728640 packets. The default is 108. The size should be chosen so that big packet roundtrip times are long enough to be accurately measured. -- env.max_mbps explanation: bing have some random spikes. This variable is used to indicate +- env.max_valid_bps explanation: bing have some random spikes. This variable is used to indicate the maximum value of mbps that can be recorded (in bps). =head1 MAGIC MARKERS @@ -112,8 +112,9 @@ for host in $hosts; do RATE="U" echo "Error: no data (timeout)" >&2 fi - if [ "$RATE" -gt "$max_mbps" ]; then - RATE="$max_mbps" + if [ -n "$max_valid_bps" ] && [ "$RATE" -gt "$max_valid_bps" ]; then + # the value is outside of the allowed range; discard it + RATE="U" fi echo "${fieldname}.value $RATE" done