Skip to content

Instantly share code, notes, and snippets.

@JohnPreston
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnPreston/a0c9f45ce753e7a3b13c to your computer and use it in GitHub Desktop.
Save JohnPreston/a0c9f45ce753e7a3b13c to your computer and use it in GitHub Desktop.
EDGE Debugging
# Run instances in AZs
for i in 1 2 3 4 ; do for j in 1 2 3 4 ; do euca-run-instances -z az_$i -n 60 -k key emi-ID -d Hello ;done done ;date
# Gets connected to every instances using the public address
for i in `euca-describe-instances verbose | grep INST | awk '{print $13}'`; do ssh -i /root/.euca/admintest.pem -o UserKnownHostsFile=/dev/null $i -o StrictHostKeyChecking=no curl -s 169.254.169.254/latest/user-data 2>/dev/null; echo ; done | wc -l
# gets information from NC about the IP and instances state
ansible nc -m shell -a 'echo -n "N*eucanted processes:"; ps faux | grep eucanetd| grep \/\/ | wc -l ; echo -n "PUB IPs :" ; ip addr sh eth0 | grep inet | grep -v inet6| wc -l; echo -n "N* VNET : "; ifconfig | grep vnet | wc -l ; echo -n "InstanceRunning :"; virsh list | grep i- | wc -l' > ips_instances_proc_`date +%Y-%m-%d_%H-%M`.log
# makes sure that the meta-data rule is set on NCs
ansible nc -m shell -a "iptables -t nat -L" | grep 8773
# terminate all instances
for i in `euca-describe-instances verbose | grep INST | awk '{print $2}'` ;do euca-terminate-instances $i ; done
# Terminate all instances in 1 call
export instances=""; for i in `cat instances_00-03` ; do export instances=`echo $instances $i`; done
euca-terminate-instances $instances
# loop checking the instances status
while true ; do euca-describe-instances verbose | awk '/^INST.*running/{print $2,$13;sum++}END{print sum}' ; sleep 5 ; done
# buggy fping but gives good info
euca-describe-instances verbose | awk '/^INST.*running/{print $13}'| xargs -t -P100 fping -a 2>&1 | awk '/ICMP/{bad++}/^[0-9.]*$/{good++}{print}END{print good,bad}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment