Skip to content

Instantly share code, notes, and snippets.

@rtitle
Created May 7, 2015 16:21
Show Gist options
  • Save rtitle/ae2e673fca0be9213d2a to your computer and use it in GitHub Desktop.
Save rtitle/ae2e673fca0be9213d2a to your computer and use it in GitHub Desktop.
dxedge_elb_count
#!/bin/bash
send() {
REGION=$1
ELB=$2
SOA=$( dig SOA $ELB | grep -A1 "AUTHORITY SECTION" | tail -1| awk '{ print $5 }' )
VALUE=$( for a in $( seq 20 ); do dig $ELB @$SOA| grep "^$ELB" | grep -o '[0-9\.]*$' ; done | sort -u | wc -l)
DATE=`date +%s`
echo "aws.elb.region.$REGION.ELBHostCount.Sum $VALUE ${DATE}" | nc localhost 2003
}
send us-east-1 dxedge-prod-lb-946522505.us-east-1.elb.amazonaws.com
send us-west-2 dxedge-prod-lb-1585771072.us-west-2.elb.amazonaws.com
send eu-west-1 dxedge-prod-lb-931619715.eu-west-1.elb.amazonaws.com
send ap-southeast-1 dxedge-prod-lb-389334914.ap-southeast-1.elb.amazonaws.com
send eu-central-1 dxedge-prod-lb-404808087.eu-central-1.elb.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment