Created
December 23, 2018 18:32
-
-
Save neofob/56327c81832e989035d1297ef8194671 to your computer and use it in GitHub Desktop.
Testing graphite metrics of temper USB sensor
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
#!/usr/bin/env bash | |
# https://github.com/wiryonolau/temper/tree/patch-1 | |
# __author__: tuan t. pham | |
METRIC_PREFIX=${METRIC_PREFIX:=$HOSTNAME} | |
METRIC_NAME=${METRIC_NAME:=ambient} | |
SEND=${SEND:=0} | |
GRAPHITE_HOST=${GRAPHITE_HOST:=localhost} | |
GRAPHITE_PORT=${GRAPHITE_PORT:=2003} | |
OUT_MSG=$(echo "${METRIC_PREFIX}.${METRIC_NAME} `temper.py | awk '{print $7}' | sed -s 's/C$//'` `date +%s`") | |
if [ "${SEND}" = 1 ]; then | |
echo $OUT_MSG | nc $GRAPHITE_HOST $GRAPHITE_PORT | |
else | |
echo $OUT_MSG | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment