From c85f5b30a1059a0312f1f28ea99f4748c8622bca Mon Sep 17 00:00:00 2001 From: Matthew Mellor Date: Tue, 19 Sep 2017 15:18:19 -0700 Subject: [PATCH] Experimental support for parallel and iperf3 comment out corresponding (output=) line on 17 or 20 --- iperfsensor.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/iperfsensor.sh b/iperfsensor.sh index dbe28e6..09c93c9 100644 --- a/iperfsensor.sh +++ b/iperfsensor.sh @@ -12,13 +12,18 @@ # "-r" since we're expecting to parse results of a test in both directions # "2>&1" redirect stderr to stdout to prevent errors from contaminating the xml output # Warning: There is no input sanitization, so be mindful of what you pass in. -output=$(iperf $* -f m -P 1 -r 2>&1) + +## non-iperf3 command +# output=$(iperf $* -f m -P 30 -T -r 2>&1) + +## iperf3 command +output=$(iperf3 $* -f m -P 30 -T -R 2>&1) error=$? # Parse iPerf output. First find lines with the word MBytes, then (treating space as # delimiters) return the fourth-from-last and second-from-last fields (which are # Transfer and Bandwidth, respectively). This yields two pairs of values. -results=$(echo -e "$output" | grep "MBytes" | awk '{ print $(NF-3), $(NF-1) }') +results=$(echo -e "$output" | grep -E "SUM.*MBytes" | awk '{ print $(NF-3), $(NF-1) }') # Take those values and convert to bytes, which are needed when using PRTG "SpeedNet" units. # bc isn't installed by default on Tomato, so use awk for floating point arithmetic. # printf is used to avoid scientific notation that may otherwise arise.