mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-04-19 08:55:15 +00:00
added latency to net-test (#43)
- added a simple latency test to the function launch_iperf (will display in table + output in json) - added two locations (AT & GER) to the IPERF_LOCS
This commit is contained in:
parent
c84049d22d
commit
7eefdda781
15
yabs.sh
15
yabs.sh
@ -645,10 +645,14 @@ function iperf_test {
|
||||
fi
|
||||
echo -en "\r\033[0K"
|
||||
done
|
||||
|
||||
# Run a latency test via ping -c1 command -> will return "xx.x ms"
|
||||
LATENCY_RUN="$(ping -c1 $URL | grep -Po 'time=.*' | sed s/'time='//)"
|
||||
|
||||
# parse the resulting send and receive speed results
|
||||
IPERF_SENDRESULT="$(echo "${IPERF_RUN_SEND}" | grep SUM | grep receiver)"
|
||||
IPERF_RECVRESULT="$(echo "${IPERF_RUN_RECV}" | grep SUM | grep receiver)"
|
||||
LATENCY_RESULT="$(echo "${LATENCY_RUN}")"
|
||||
}
|
||||
|
||||
# launch_iperf
|
||||
@ -664,8 +668,8 @@ function launch_iperf {
|
||||
echo -e
|
||||
echo -e "iperf3 Network Speed Tests ($MODE):"
|
||||
echo -e "---------------------------------"
|
||||
printf "%-15s | %-25s | %-15s | %-15s\n" "Provider" "Location (Link)" "Send Speed" "Recv Speed"
|
||||
printf "%-15s | %-25s | %-15s | %-15s\n"
|
||||
printf "%-15s | %-25s | %-15s | %-15s | %-15s\n" "Provider" "Location (Link)" "Send Speed" "Recv Speed"
|
||||
printf "%-15s | %-25s | %-15s | %-15s | %-15s\n" "-----" "-----" "----" "----" "----"
|
||||
|
||||
# loop through iperf locations array to run iperf test using each public iperf server
|
||||
for (( i = 0; i < IPERF_LOCS_NUM; i++ )); do
|
||||
@ -678,14 +682,15 @@ function launch_iperf {
|
||||
IPERF_SENDRESULT_UNIT=$(echo $IPERF_SENDRESULT | awk '{ print $7 }')
|
||||
IPERF_RECVRESULT_VAL=$(echo $IPERF_RECVRESULT | awk '{ print $6 }')
|
||||
IPERF_RECVRESULT_UNIT=$(echo $IPERF_RECVRESULT | awk '{ print $7 }')
|
||||
LATENCY_VAL=$(echo $LATENCY_RESULT)
|
||||
# if the results are blank, then the server is "busy" and being overutilized
|
||||
[[ -z $IPERF_SENDRESULT_VAL || "$IPERF_SENDRESULT_VAL" == *"0.00"* ]] && IPERF_SENDRESULT_VAL="busy" && IPERF_SENDRESULT_UNIT=""
|
||||
[[ -z $IPERF_RECVRESULT_VAL || "$IPERF_RECVRESULT_VAL" == *"0.00"* ]] && IPERF_RECVRESULT_VAL="busy" && IPERF_RECVRESULT_UNIT=""
|
||||
# print the speed results for the iperf location currently being evaluated
|
||||
printf "%-15s | %-25s | %-15s | %-15s\n" "${IPERF_LOCS[i*5+2]}" "${IPERF_LOCS[i*5+3]}" "$IPERF_SENDRESULT_VAL $IPERF_SENDRESULT_UNIT" "$IPERF_RECVRESULT_VAL $IPERF_RECVRESULT_UNIT"
|
||||
printf "%-15s | %-25s | %-15s | %-15s | %-15s\n" "${IPERF_LOCS[i*5+2]}" "${IPERF_LOCS[i*5+3]}" "$IPERF_SENDRESULT_VAL $IPERF_SENDRESULT_UNIT" "$IPERF_RECVRESULT_VAL $IPERF_RECVRESULT_UNIT" "$LATENCY_VAL"
|
||||
if [ ! -z $JSON ]; then
|
||||
JSON_RESULT+='{"mode":"'$MODE'","provider":"'${IPERF_LOCS[i*5+2]}'","loc":"'${IPERF_LOCS[i*5+3]}
|
||||
JSON_RESULT+='","send":"'$IPERF_SENDRESULT_VAL' '$IPERF_SENDRESULT_UNIT'","recv":"'$IPERF_RECVRESULT_VAL' '$IPERF_RECVRESULT_UNIT'"},'
|
||||
JSON_RESULT+='","send":"'$IPERF_SENDRESULT_VAL' '$IPERF_SENDRESULT_UNIT'","recv":"'$IPERF_RECVRESULT_VAL' '$IPERF_RECVRESULT_UNIT'","latency":"'$LATENCY_VAL'"},'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@ -728,6 +733,8 @@ if [ -z "$SKIP_IPERF" ]; then
|
||||
"ping.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv4" \
|
||||
"ping6.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv6" \
|
||||
"speedtest-nl-oum.hybula.net" "5201-5206" "Hybula" "The Netherlands (40G)" "IPv4|IPv6" \
|
||||
"fra.speedtest.clouvider.net" "5200-5209" "Clouvider" "Frankfurt, GER (10G)" "IPv4|IPv6" \
|
||||
"lg.vie.alwyzon.net" "5200-5209" "Alwayzon" "Vienna, Austria (10G)" "IPv4|IPv6" \
|
||||
"speedtest.uztelecom.uz" "5200-5207" "Uztelecom" "Tashkent, UZ (10G)" "IPv4|IPv6" \
|
||||
"nyc.speedtest.clouvider.net" "5200-5209" "Clouvider" "NYC, NY, US (10G)" "IPv4|IPv6" \
|
||||
"dal.speedtest.clouvider.net" "5200-5209" "Clouvider" "Dallas, TX, US (10G)" "IPv4|IPv6" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user