Skip to content

Instantly share code, notes, and snippets.

@neofob
Created December 23, 2018 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neofob/56327c81832e989035d1297ef8194671 to your computer and use it in GitHub Desktop.
Save neofob/56327c81832e989035d1297ef8194671 to your computer and use it in GitHub Desktop.
Testing graphite metrics of temper USB sensor
#!/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