From ea1324e4988525c4acd1185a0f53cb3d32225adf Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Fri, 9 Oct 2020 11:54:39 -0400 Subject: [PATCH] fix LOSS calc line --- salt/telegraf/scripts/zeekcaptureloss.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/telegraf/scripts/zeekcaptureloss.sh b/salt/telegraf/scripts/zeekcaptureloss.sh index dded2ee81..a2e350212 100644 --- a/salt/telegraf/scripts/zeekcaptureloss.sh +++ b/salt/telegraf/scripts/zeekcaptureloss.sh @@ -18,7 +18,7 @@ if [ -f "$ZEEKLOG" ]; then if [ -f "$LASTCAPTURELOSSLOG" ]; then LASTTS=$(cat $LASTCAPTURELOSSLOG) if [[ "$LASTTS" != "$CURRENTTS" ]]; then - LOSS=$(tail -$WORKERS $ZEEKLOG | awk -F, '{print $NF}' | sed 's/}//' | awk -F: '{LOSS += $2 / $WORKERS END { print LOSS}') + LOSS=$(tail -$WORKERS $ZEEKLOG | awk -F, '{print $NF}' | sed 's/}//' | awk -v WORKERS=$WORKERS -F: '{LOSS += $2 / WORKERS} END { print LOSS}') echo "zeekcaptureloss loss=$LOSS" fi fi