Created
January 14, 2014 23:10
-
-
Save pgrandin/8427789 to your computer and use it in GitHub Desktop.
time_api
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
#!/bin/bash | |
[ -f /usr/bin/nc.openbsd ] || ACCEPT_KEYWORDS=~amd64 emerge -q openbsd-netcat | |
url="http://169.254.169.254/2008-02-01/meta-data/public-ipv4" | |
if [[ "$1" == "-n" ]]; then | |
url="http://169.254.169.254/openstack/latest/meta_data.json" | |
fi | |
PORT=2003 | |
SERVER=172.16.128.252 | |
while true; do | |
START_TIME=$SECONDS | |
for i in `seq 1 10`; do | |
wget -q -O - $url > /dev/null | |
done | |
t=$(($SECONDS - $START_TIME)) | |
printf "\r$t " | |
echo "local.ec2_api_response_time $t `date +%s`" | nc.openbsd ${SERVER} ${PORT}; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment