Created
May 14, 2016 20:32
-
-
Save zglozman/af4886652a1dff38859274efe20840a0 to your computer and use it in GitHub Desktop.
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
#!/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