Files
securityonion/salt/common/telegraf/scripts/suriloss.sh
2018-11-28 10:15:42 -05:00

16 lines
356 B
Bash

#!/bin/bash
SURILOG=$(tac /var/log/suricata/stats.log | grep kernel | head -4)
declare RESULT=($SURILOG)
CURRENTDROP=${RESULT[4]}
PASTDROP=${RESULT[14]}
DROPPED=$(($CURRENTDROP - $PASTDROP))
CURRENTPACKETS=${RESULT[9]}
PASTPACKETS=${RESULT[19]}
TOTAL=$(($CURRENTPACKETS - $PASTPACKETS))
LOSS=$(echo $DROPPED $TOTAL / p | dc)
echo "suridrop drop=$LOSS"