Skip to content

Instantly share code, notes, and snippets.

@zglozman
Created May 14, 2016 20:32
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 zglozman/af4886652a1dff38859274efe20840a0 to your computer and use it in GitHub Desktop.
Save zglozman/af4886652a1dff38859274efe20840a0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#readAndEchoData{
# echo -n "[$1] "; #}
set .
set -eu
queryEnv()
{
instanceData=$(/usr/bin/curl -s http://$1/instance)
softwareConf=$(/usr/bin/curl -s http://$1/software)
version=$(echo $softwareConf| jq .version -r)
endpoint=$(echo $instanceData | jq .instanceData.endpoint -r)
endpoint=$(echo $instanceData | jq .instanceData.endpoint -r)
ipAddress=$(echo $instanceData | jq .instanceData.publicipv4 -r)
avlZone=$(echo $instanceData | jq .instanceData.avlZone -r)
printf "%15s \t %25s \t %25s \t %15s\r\n" $version $endpoint $ipAddress $avlZone
}
print_envieroment_lines()
{
echo "Env:" $1
printf "%15s \t %25s \t\t %25s\t %15s\r\n" "version" "endpoint" "ipAddress" "avlZone"
printf "%15s \t %25s \t\t %25s \t %15s\r\n" "_________" "__________" "__________" "__________"
while read ip;
do
queryEnv $ip
done
echo "--------------------------------------end---------------------------"
}
queryActiveEnvs()
{
envieroments=('lb-all.luckyqr.io' 'lb-lucky-all.luckyqr.io' 'lb-dev-all.luckyqr.io')
for i in "${envieroments[@]}"
do
dig +short $i | print_envieroment_lines $i
done
}
queryActiveEnvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment