Last active
February 28, 2019 09:17
-
-
Save index0h/aed9e57b936077d20186e53c011aeac0 to your computer and use it in GitHub Desktop.
statsd_feeding.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
METRIC_NAME='test.metric' | |
STATSD_HOST='statsd.host' | |
STATSD_PORT='8125' | |
DELAY_MCS=100000 | |
# "c" - counter, will aggregate as sum | |
# "t" - timer, will aggregate as avg | |
# "g" - gauge, will aggregate as last | |
AGGREGATION="c" | |
while true | |
do | |
DATA=`date +%S%1N | sed 's/^0*//'` | |
if [[ -z "${DATA}" ]]; then | |
DATA="0" | |
fi | |
echo "${METRIC_NAME}:${DATA}|${AGGREGATION}" | nc -u -w0 "${STATSD_HOST}" "${STATSD_PORT}" | |
usleep 100000 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment