Shell script to list current website IP

If your sites are in multiple geographical locations, this script will show where a site currently is being served from. It colors the output based on location.

#!/bin/bash
# where_are_you.sh
#do a dig against the company name servers and spit out the current IP of the sites.

array=( www.site.com www.site2.com www.site3.com www.site99.com )

for i in “${array[@]}”
do
dig @ns.server.company $i a | grep -v ‘;’ |grep $i | awk ‘{ if ( substr($5, 1, 8) == “x.x.x” ) printf “%-30s %s\n”, “\033[1;32;40m”$5,$1; else printf “%-30s %s\n”, “\033[1;34;40m”$5,$1 }’

done | sort -n
tput sgr0

Uptime and SLA Breakdown

If it’s up…​ A.K.A​ It’s down for…per year​
90%​ n/a​ 876 hours​
95%​ n/a​ 438 hours​
99%​ two 9’s​ 87 hours, 36 minutes​
99.9%​ three 9’s​ 8 hours, 45 minutes​
99.99%​ four 9’s​ 52 minutes, 33.6 seconds​
99.999%​ five 9’s​ 5 minutes, 15.36 seconds​
99.9999%​ six 9’s​ 31.68 seconds