Where are my sites hosted?

I have 5 public websites (2 different datacenters)

  1. production datacenter
  2. Backup datacenter.

I have a global site selector which will load balance the site based on availability and load. I would like to have a script that can tell me exactly where my sites are in 2 columns.

example....

www.site1.com 10.1.1.1 (public IPs of course)
www.site2.com 172.16.0.0 (public IPs of course)

Thanks in advance for your help.

I'm using ubuntu 9.10

hits: arrange the result with nslookup

nslookup www.site1.com

#!/bin/bash
# where_are_you.sh
#do a dig against the public DNS servers and spit out the current IP of the sites.
array=( www.site1.com
www.site2.com
www.site3.com
)

for i in "${array[@]}"
do
dig @4.2.2.2 $i a | grep -v ';' |grep $i | awk '{print $5," "$1}'
done