adding helix eps count for telegraf

This commit is contained in:
m0duspwnens
2020-02-11 14:55:44 -05:00
parent 99b1a15306
commit 8b835284ef
2 changed files with 26 additions and 0 deletions

View File

@@ -655,6 +655,7 @@
"/scripts/checkfiles.sh",
"/scripts/broloss.sh",
"/scripts/oldpcap.sh",
"/scripts/helixeps.sh",
]
data_format = "influx"
{% endif %}

View File

@@ -0,0 +1,25 @@
#!/bin/bash
PREVCOUNTFILE='/tmp/helixevents.txt'
EVENTCOUNTCURRENT="$(curl -s localhost:9600/_node/stats | jq '.pipelines.eval.events.out')"
if [ ! -z "$EVENTCOUNTCURRENT" ]; then
if [ -f "$PREVCOUNTFILE" ]; then
EVENTCOUNTPREVIOUS=`cat $PREVCOUNTFILE`
else
echo "${EVENTCOUNTCURRENT}" > $PREVCOUNTFILE
exit 0
fi
echo "${EVENTCOUNTCURRENT}" > $PREVCOUNTFILE
EVENTS=$((EVENTCOUNTCURRENT - EVENTCOUNTPREVIOUS))
if [ "$EVENTS" -lt 0 ]; then
EVENTS=0
fi
echo "helixeps eps=${EVENTS}"
fi
exit 0