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

Automatically update New Relic after app deployment.

I use TeamCity to build and deploy web applications. Using curl and an additional build step, I can update New Relic when the build is deployed to production.

Add a Build Step of build runner type Command Line. The command and options are:

curl -H “x-api-key:xxxxxxxxxxxxxxxx” -d “deployment[application_id]=xxxxxx” -d “deployment[host]=%system.agent.name%” -d “deployment[description]=This deployment was sent using curl.” -d “deployment[revision]=”%build.number% https://rpm.newrelic.com/deployments.xml

This will update New Relic with the build agent and build number.

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