Last active
January 8, 2018 15:00
-
-
Save pharaujo/873bb53704367129b816a6a37db1cc1c to your computer and use it in GitHub Desktop.
Pure bash OpenTSP site feed client (for debugging)
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 | |
# | |
# Accepts OpenTSDB line protocol connections | |
# Responds to `version` requests | |
# Outputs everything else to stdout | |
tsdb_connector() { nc -l -k 0 4545 ; } | |
coproc TSDB { tsdb_connector; } | |
while IFS='' read -ru ${TSDB[0]} line; do | |
if [ "$line" == "version" ]; then | |
echo "Built on <unknown> (bash_tsp_client)" >&${TSDB[1]} | |
else | |
echo "$line" | |
fi | |
done | |
# 1-liner: | |
# ( tsdb_connector() { nc -l -k 0 4545 ; } ; coproc TSDB { tsdb_connector; } ; while IFS='' read -ru ${TSDB[0]} line; do if [ "$line" == "version" ]; then echo "Built on <unknown> (bash_tsp_client)" >&${TSDB[1]} ; else echo "$line" ; fi; done; ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment