fix check_iperf3 numbers

This commit is contained in:
Cyberes 2023-06-07 16:28:11 -06:00
parent 88a51a70f7
commit 0c11d3a94e
Signed by: cyberes
GPG Key ID: 6B4A33836A9500FE
1 changed files with 7 additions and 1 deletions

View File

@ -19,6 +19,11 @@ if ! command -v iperf3 &>/dev/null; then
exit 3
fi
if ! command -v jq &>/dev/null; then
echo "UNKNOWN - jq is not installed"
exit 3
fi
if [[ $# -eq 0 ]]; then
print_help
fi
@ -81,7 +86,8 @@ if ! echo "$RESULT" | jq -e '.end.sum.bits_per_second' >/dev/null; then
exit 3
fi
SPEED_RAW=$(echo "$RESULT" | jq '.end.sum.bits_per_second / 1000000')
STREAM_RESULT=$(echo "$RESULT" | jq '.end.streams[] | select(.udp.sender == (!0)) | .udp.bits_per_second')
SPEED_RAW=$(echo "$STREAM_RESULT" | jq 'if length > 0 then . / 1000000 else 0 end')
SPEED=$(printf "%.0f" "$SPEED_RAW")
if (($(echo "$SPEED < $CRITICAL" | bc -l))); then