mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 01:32:47 +01:00
18 lines
422 B
Bash
18 lines
422 B
Bash
#!/bin/bash
|
|
|
|
ZEEKLOG=$(tac /host/nsm/zeek/logs/packetloss.log | head -2)
|
|
declare RESULT=($ZEEKLOG)
|
|
CURRENTDROP=${RESULT[3]}
|
|
PASTDROP=${RESULT[9]}
|
|
DROPPED=$(($CURRENTDROP - $PASTDROP))
|
|
if [ $DROPPED == 0 ]; then
|
|
LOSS=0
|
|
echo "brodrop drop=0"
|
|
else
|
|
CURRENTPACKETS=${RESULT[5]}
|
|
PASTPACKETS=${RESULT[11]}
|
|
TOTAL=$(($CURRENTPACKETS - $PASTPACKETS))
|
|
LOSS=$(echo $DROPPED $TOTAL / p | dc)
|
|
echo "brodrop drop=$LOSS"
|
|
fi
|