Last active
August 29, 2015 14:01
-
-
Save daniel-garcia/c10ba959eb76764f0a77 to your computer and use it in GitHub Desktop.
example load average poster to internal consumer URL
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
#!/bin/bash | |
interval=1 | |
echo "posting loadavg at $interval second(s) interval" | |
while : | |
do | |
now=`date +%s` | |
value=`cat /proc/loadavg | cut -d ' ' -f 1` | |
data="{\"control\":{\"type\":null,\"value\":null},\"metrics\":[{\"metric\":\"loadavg\",\"timestamp\":$now,\"value\":$value,\"tags\":{\"name\":\"value\"}}]}" | |
output=`curl -s -XPOST -H "Content-Type: application/json" -d "$data" "$CONTROLPLANE_CONSUMER_URL"` | |
if ! [[ "$output" == *OK* ]] | |
then | |
echo "failure"; | |
fi | |
sleep $interval | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment