Skip to content

Instantly share code, notes, and snippets.

@Naramsim
Created November 23, 2019 15:41
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 Naramsim/a771d1ae7bff1fdec4cf12dd6012f83f to your computer and use it in GitHub Desktop.
Save Naramsim/a771d1ae7bff1fdec4cf12dd6012f83f to your computer and use it in GitHub Desktop.
curl keep alive handle stream
while read -r line; do
RESULT=$(echo "$line" | jq '.check_result.performance_data[0]')
RESULT=`echo $RESULT | sed -n 's/"rta=\(.*\)ms.*/\1/p'`
curl -i -s -X POST 'http://192.168.10.43:8086/write?db=mydb' --data-binary "cpu_load_short,host=server01,region=us-west value=$RESULT $(date +%s)000000000"
echo $RESULT
done < <(curl -s -k -u root:abc123ABC -H 'Accept: application/json' -X POST -N 'https://192.168.10.43:5665/v1/events?queue=myqueue&types=CheckResult')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment