only send loss if timestamp on data has changed

This commit is contained in:
m0duspwnens
2020-10-07 11:15:10 -04:00
parent d09f0f841e
commit 1106b2bf96

View File

@@ -2,7 +2,7 @@
# This script returns the average of all the workers average capture loss to telegraf / influxdb in influx format include nanosecond precision timestamp # This script returns the average of all the workers average capture loss to telegraf / influxdb in influx format include nanosecond precision timestamp
{%- set WORKERS = salt['pillar.get']('sensor:zeek_lbprocs', salt['pillar.get']('sensor:zeek_pins') | length) %} {%- set WORKERS = salt['pillar.get']('sensor:zeek_lbprocs', salt['pillar.get']('sensor:zeek_pins') | length) %}
ZEEKLOG=/host/nsm/zeek/spool/logger/capture_loss.log ZEEKLOG=/host/nsm/zeek/spool/logger/capture_loss.log
LASTCAPTURELOSSLOG=/host/nsm/zeek/logs/telegraf_lastcaptureloss.txt LASTCAPTURELOSSLOG=/host/opt/so/log/telegraf_lastcaptureloss.txt
if [ -f "$ZEEKLOG" ]; then if [ -f "$ZEEKLOG" ]; then
CURRENTTS=$(tail -1 $ZEEKLOG | jq .ts | sed 's/"//g') CURRENTTS=$(tail -1 $ZEEKLOG | jq .ts | sed 's/"//g')
if [ -f "$LASTCAPTURELOSSLOG" ]; then if [ -f "$LASTCAPTURELOSSLOG" ]; then