check_iperf3.sh: add perfdata
This commit is contained in:
parent
9b043801df
commit
cbc7e8e9b4
|
@ -13,39 +13,39 @@ while [[ $# -gt 0 ]]; do
|
|||
key="$1"
|
||||
|
||||
case $key in
|
||||
--server)
|
||||
SERVER="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--warning)
|
||||
WARNING_LEVEL="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--critical)
|
||||
CRITICAL_LEVEL="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--rsa-public-key)
|
||||
RSA_PUBLIC_KEY="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--username)
|
||||
USERNAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--password)
|
||||
PASSWORD="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
--server)
|
||||
SERVER="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--warning)
|
||||
WARNING_LEVEL="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--critical)
|
||||
CRITICAL_LEVEL="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--rsa-public-key)
|
||||
RSA_PUBLIC_KEY="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--username)
|
||||
USERNAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--password)
|
||||
PASSWORD="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -74,14 +74,17 @@ fi
|
|||
# Extract the receiver bitrate
|
||||
RECEIVER_BITRATE=$(echo "$OUTPUT" | grep -Eo '[0-9]+(\.[0-9]+)? Mbits/sec' | tail -1 | awk '{print $1}')
|
||||
|
||||
# Prepare performance data
|
||||
PERFDATA="receiver_bitrate=${RECEIVER_BITRATE}mb;${WARNING_LEVEL};${CRITICAL_LEVEL};0;"
|
||||
|
||||
# Check the receiver bitrate against warning and critical levels
|
||||
if (( $(echo "$RECEIVER_BITRATE < $CRITICAL_LEVEL" | bc -l) )); then
|
||||
echo "CRITICAL - Receiver Bitrate: $RECEIVER_BITRATE Mbits/sec"
|
||||
if (($(echo "$RECEIVER_BITRATE < $CRITICAL_LEVEL" | bc -l))); then
|
||||
echo "CRITICAL - Receiver Bitrate: $RECEIVER_BITRATE Mbits/sec | $PERFDATA"
|
||||
exit 2
|
||||
elif (( $(echo "$RECEIVER_BITRATE < $WARNING_LEVEL" | bc -l) )); then
|
||||
echo "WARNING - Receiver Bitrate: $RECEIVER_BITRATE Mbits/sec"
|
||||
elif (($(echo "$RECEIVER_BITRATE < $WARNING_LEVEL" | bc -l))); then
|
||||
echo "WARNING - Receiver Bitrate: $RECEIVER_BITRATE Mbits/sec | $PERFDATA"
|
||||
exit 1
|
||||
else
|
||||
echo "OK - Receiver Bitrate: $RECEIVER_BITRATE Mbits/sec"
|
||||
echo "OK - Receiver Bitrate: $RECEIVER_BITRATE Mbits/sec | $PERFDATA"
|
||||
exit 0
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue