Created
November 23, 2019 15:41
-
-
Save Naramsim/a771d1ae7bff1fdec4cf12dd6012f83f to your computer and use it in GitHub Desktop.
curl keep alive handle stream
This file contains hidden or 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
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