mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-10 03:02:58 +01:00
17 lines
417 B
Bash
17 lines
417 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 |