fix check_iperf3 numbers
This commit is contained in:
parent
88a51a70f7
commit
0c11d3a94e
|
@ -19,6 +19,11 @@ if ! command -v iperf3 &>/dev/null; then
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! command -v jq &>/dev/null; then
|
||||||
|
echo "UNKNOWN - jq is not installed"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
print_help
|
print_help
|
||||||
fi
|
fi
|
||||||
|
@ -81,7 +86,8 @@ if ! echo "$RESULT" | jq -e '.end.sum.bits_per_second' >/dev/null; then
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
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")
|
SPEED=$(printf "%.0f" "$SPEED_RAW")
|
||||||
|
|
||||||
if (($(echo "$SPEED < $CRITICAL" | bc -l))); then
|
if (($(echo "$SPEED < $CRITICAL" | bc -l))); then
|
||||||
|
|
Loading…
Reference in New Issue