Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rb:dnsaddresschange [24/01/2011 12:27] andrew created |
rb:dnsaddresschange [10/10/2013 14:21] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | [root@gy-asp-mon01 dnschecks]# pwd | ||
- | /usr/local/SiteScope/dnschecks | ||
- | [root@gy-asp-mon01 dnschecks]# cat datacashtest.sh | ||
#!/bin/bash | #!/bin/bash | ||
#written Andrew Stringer, 11/1/11 onwards. A date which is a palindrome. | #written Andrew Stringer, 11/1/11 onwards. A date which is a palindrome. | ||
Line 22: | Line 19: | ||
PORT=443 | PORT=443 | ||
#Data Cash host | #Data Cash host | ||
- | DCHOST=mars.transaction.datacash.com | + | DCHOST=mars.transaction.xxxsitexxx.com |
| | ||
- | #Find out auth dns server for Data Cash | + | #Find out auth dns server for WebSite |
- | DCAUTHDNS=`ssh -q -i ~/.ssh/id_dsa -l scope gy-asp-inet01 "dig +noall +authority ${DCHOST}" | grep ".co.uk" | awk '{print $5}'` | + | DCAUTHDNS=`ssh -q -i ~/.ssh/id_dsa -l scope server01 "dig +noall +authority ${DCHOST}" | grep ".co.uk" | awk '{print $5}'` |
echo "DC Auth DNS is ${DCAUTHDNS}" >> ${LOGFILE} | echo "DC Auth DNS is ${DCAUTHDNS}" >> ${LOGFILE} | ||
| | ||
| | ||
EMAIL=${BASE}/emailtmp-$$ | EMAIL=${BASE}/emailtmp-$$ | ||
- | MAILTO=ww-noc@igt.com | + | MAILTO=noc@zzz.com |
SENDEMAIL=no | SENDEMAIL=no | ||
| | ||
Line 46: | Line 43: | ||
| | ||
| | ||
- | echo "Testing Data Cash DNS:- " >> ${EMAIL} | + | echo "Testing WebSite zzz Cash DNS:- " >> ${EMAIL} |
echo "======================= " >> ${EMAIL} | echo "======================= " >> ${EMAIL} | ||
echo "" >> ${EMAIL} | echo "" >> ${EMAIL} | ||
| | ||
- | echo "Expected ipaddresses are 92.43.40.20, 92.43.42.20 or 195.224.203.20 (old)" >> ${EMAIL} | + | echo "Expected ipaddresses are xx.yy.40.20, zz.ww.42.20 or xx.vv.203.20 (old)" >> ${EMAIL} |
echo "" >> ${EMAIL} | echo "" >> ${EMAIL} | ||
| | ||
Line 59: | Line 56: | ||
| | ||
#Get Datacash current ipaddress | #Get Datacash current ipaddress | ||
- | ssh -q -i ~/.ssh/id_dsa -l scope gy-asp-inet01 "dig @${DCAUTHDNS} ${DCHOST}" > ${DCAUTHTEMP} | + | ssh -q -i ~/.ssh/id_dsa -l scope server01 "dig @${DCAUTHDNS} ${DCHOST}" > ${DCAUTHTEMP} |
#get ipaddress from tmp file | #get ipaddress from tmp file | ||
CURRENTIP=`cat ${DCAUTHTEMP} | grep -v ";" | grep ${DCHOST} | awk '{print $5}' ` | CURRENTIP=`cat ${DCAUTHTEMP} | grep -v ";" | grep ${DCHOST} | awk '{print $5}' ` | ||
Line 70: | Line 67: | ||
| | ||
| | ||
- | #Get cached Datacash ipaddress from inet01 | + | #Get cached Datacash ipaddress from server01 |
- | ssh -q -i ~/.ssh/id_dsa -l scope gy-asp-inet01 "dig ${DCHOST}" > ${DCCACHETEMP} | + | ssh -q -i ~/.ssh/id_dsa -l scope server01 "dig ${DCHOST}" > ${DCCACHETEMP} |
CURRENTCACHEIP=`cat ${DCCACHETEMP} | grep -v ";" | grep ${DCHOST} | awk '{print $5}' ` | CURRENTCACHEIP=`cat ${DCCACHETEMP} | grep -v ";" | grep ${DCHOST} | awk '{print $5}' ` | ||
CURRENTCACHEIPTIME=`cat ${DCCACHETEMP} | grep Query | awk '{print $4, $5}'` | CURRENTCACHEIPTIME=`cat ${DCCACHETEMP} | grep Query | awk '{print $4, $5}'` | ||
- | echo "Cached ip from inet01 is ${CURRENTCACHEIP} and it took ${CURRENTCACHEIPTIME}" >> ${LOGFILE} | + | echo "Cached ip from server01 is ${CURRENTCACHEIP} and it took ${CURRENTCACHEIPTIME}" >> ${LOGFILE} |
| | ||
| | ||
Line 114: | Line 111: | ||
| | ||
| | ||
- | echo "Testing Data Cash tcp connection on port ${PORT}:-" >> ${EMAIL} | + | echo "Testing Website Cash tcp connection on port ${PORT}:-" >> ${EMAIL} |
echo "==============================================" >> ${EMAIL} | echo "==============================================" >> ${EMAIL} | ||
echo "" >> ${EMAIL} | echo "" >> ${EMAIL} | ||
Line 120: | Line 117: | ||
| | ||
#Do tcp connection test | #Do tcp connection test | ||
- | #This has to be done on gy-asp-app01 because the RVB app servers are the only servers allowed to | + | #This has to be done on server-app01 because the zzz app servers are the only servers allowed to |
- | #connect to Data Cash. | + | #connect to website Cash. |
| | ||
#Use ipaddress derived above from Auth dns $CURRENTIP, not name $DCHOST which will be resolved locally. | #Use ipaddress derived above from Auth dns $CURRENTIP, not name $DCHOST which will be resolved locally. | ||
- | #Run test from app01 as mon01 has no access | + | #Run test from app01 as www01 has no access |
- | TCPCONNETION=`ssh -q -i ~/.ssh/id_dsa -l scope gy-asp-app01 "/export/home/scope/scripts/datacash/datacash-check.sh ${CURRENTIP} ${PORT}"` | + | TCPCONNETION=`ssh -q -i ~/.ssh/id_dsa -l scope server-app01 "/export/home/scope/scripts/datacash/datacash-check.sh ${CURRENTIP} ${PORT}"` |
| | ||
echo $TCPCONNETION | grep -i yes 2>&1 > /dev/null | echo $TCPCONNETION | grep -i yes 2>&1 > /dev/null | ||
Line 132: | Line 129: | ||
if [ ${TCPOPEN} -eq 0 ] | if [ ${TCPOPEN} -eq 0 ] | ||
then | then | ||
- | echo "Data Cash is listening on ${CURRENTIP}:${PORT}." >> ${EMAIL} | + | echo "Website Cash is listening on ${CURRENTIP}:${PORT}." >> ${EMAIL} |
- | echo "Data Cash https is listening on ${CURRENTIP}:${PORT}." >> ${LOGFILE} | + | echo "Website Cash https is listening on ${CURRENTIP}:${PORT}." >> ${LOGFILE} |
#SENDEMAIL=yes | #SENDEMAIL=yes | ||
else | else | ||
- | echo "Data Cash is closed on ${CURRENTIP}:${PORT}." >> ${EMAIL} | + | echo "Website Cash is closed on ${CURRENTIP}:${PORT}." >> ${EMAIL} |
- | echo "Data Cash https is closed on ${CURRENTIP}:${PORT}." >> ${LOGFILE} | + | echo "Website Cash https is closed on ${CURRENTIP}:${PORT}." >> ${LOGFILE} |
SENDEMAIL=yes | SENDEMAIL=yes | ||
fi | fi | ||
Line 144: | Line 141: | ||
then | then | ||
| | ||
- | TCPCONNETIONCACHE=`ssh -q -i ~/.ssh/id_dsa -l scope gy-asp-app01 "/export/home/scope/scripts/datacash/datacash-check.sh ${CURRENTCACHEIP} ${PORT}"` | + | TCPCONNETIONCACHE=`ssh -q -i ~/.ssh/id_dsa -l scope server-app01 "/export/home/scope/scripts/datacash/datacash-check.sh ${CURRENTCACHEIP} ${PORT}"` |
| | ||
echo $TCPCONNETIONCACHE | grep -i yes 2>&1 > /dev/null | echo $TCPCONNETIONCACHE | grep -i yes 2>&1 > /dev/null | ||
Line 151: | Line 148: | ||
if [ ${TCPCACHEOPEN} -eq 0 ] | if [ ${TCPCACHEOPEN} -eq 0 ] | ||
then | then | ||
- | echo "Data Cash is listening on ${CURRENTCACHEIP}:${PORT}." >> ${EMAIL} | + | echo "website Cash is listening on ${CURRENTCACHEIP}:${PORT}." >> ${EMAIL} |
- | echo "Data Cash https is listening on ${CURRENTCACHEIP}:${PORT}." >> ${LOGFILE} | + | echo "website Cash https is listening on ${CURRENTCACHEIP}:${PORT}." >> ${LOGFILE} |
#SENDEMAIL=yes | #SENDEMAIL=yes | ||
else | else | ||
- | echo "Data Cash is closed on ${CURRENTCACHEIP}:${PORT}." >> ${EMAIL} | + | echo "website Cash is closed on ${CURRENTCACHEIP}:${PORT}." >> ${EMAIL} |
- | echo "Data Cash https is closed on ${CURRENTCACHEIP}:${PORT}." >> ${LOGFILE} | + | echo "website Cash https is closed on ${CURRENTCACHEIP}:${PORT}." >> ${LOGFILE} |
SENDEMAIL=yes | SENDEMAIL=yes | ||
fi | fi | ||
Line 175: | Line 172: | ||
#echo ${SENDEMAIL} >> ${EMAIL} | #echo ${SENDEMAIL} >> ${EMAIL} | ||
echo "Sending notification mail at `date +%H:%M:%S`." >> ${EMAIL} | echo "Sending notification mail at `date +%H:%M:%S`." >> ${EMAIL} | ||
- | mail ${MAILTO} -s "Data Cash DNS and connection Test" < ${EMAIL} | + | mail ${MAILTO} -s "website Cash DNS and connection Test" < ${EMAIL} |
else | else | ||
#don't send mail, so mail command is commented out. Left in for testing | #don't send mail, so mail command is commented out. Left in for testing | ||
Line 183: | Line 180: | ||
| | ||
echo "Sending notification mail at `date +%H:%M:%S`." >> ${EMAIL} | echo "Sending notification mail at `date +%H:%M:%S`." >> ${EMAIL} | ||
- | #mail ${MAILTO} -s "Data Cash DNS and connection Test" < ${EMAIL} | + | #mail ${MAILTO} -s "website Cash DNS and connection Test" < ${EMAIL} |
fi | fi | ||
| |