Administrators guru Posted August 7 Administrators Posted August 7 I put together this script that checks the status of everything prior to the change and then run it after the change and then download the two log files and open in something like VSCode and do a compare to see if the change you did on the GTM changed the status of something. It has helped me and I hope it helps you. I'm sure there is something better but this is what I know how to do. ** USE AT YOUR OWN RISK ** #!/bin/bash ## Author: Cowboy Denny ## Last Modified: 2024.05.06 ## RUN THIS FILE ON THE GTM in the /var/tmp directory ## GTM: Change Verify BEFORE & AFTER change deployment ## RUN with: bash gtmchgverify.sh unset totalgtmwips; unset totalgtmwipsa; unset totalgtmwipsu; unset totalgtmwipso; unset totalgtmwipsd; unset totalgtmwipsun; unset totalgtmpools; unset totalgtmpoolsa; unset totalgtmpoolsu; unset totalgtmpoolso; unset totalgtmpoolsd; unset totalgtmpoolsun; unset totalgtmdc; unset totalgtmdca; unset totalgtmdcu; unset totalgtmdco; unset totalgtmdcd; unset totalgtmdcun; unset totalgtmiquery; unset totalgtmiqueryc; unset totalgtmpp; unset totalgtmppa; unset totalgtmppu; unset totalgtmppo; unset totalgtmppd; unset totalgtmppun; unset totalgtmsrv; unset totalgtmsrva; unset totalgtmsrvu; unset totalgtmsrvo; unset totalgtmsrvd; unset totalgtmsrvun; unset totalgtmlist; unset totalgtmlista; unset totalgtmlistu; unset totalgtmlisto; unset totalgtmlistd; unset totalgtmlistun; unset gtmchgfilename; clear echo "GTM: Data Gathering has started... this takes about 60-90 seconds" gtmchgfilename=/var/tmp/$(echo $HOSTNAME | cut -d'.' -f1)-$(date +%Y%m%d_%H%M)-STATUS.log; date > $gtmchgfilename; echo "SERVER specific INFO for hostname...." >> $gtmchgfilename; tmsh list sys global-settings hostname | grep hostname >> $gtmchgfilename; echo "F5 running version...." >> $gtmchgfilename; tmsh -q show sys software status >> $gtmchgfilename; echo "Master Key is..." >> $gtmchgfilename; f5mku -K >> $gtmchgfilename; echo ""; echo "1/3 PATIENCE while we gather statistics" ##WIDE IPS export totalgtmwips=$(tmsh -q -c 'cd / ; show gtm wideip recursive' | grep -c 'Gtm::WideIp'); export totalgtmwipsa=$(tmsh -q -c 'cd / ; show gtm wideip recursive' | egrep 'Gtm::WideIp|Availability'| grep -c 'available'); export totalgtmwipsu=$(tmsh -q -c 'cd / ; show gtm wideip recursive' | egrep 'Gtm::WideIp|Availability'| grep -c 'unavailable'); export totalgtmwipso=$(tmsh -q -c 'cd / ; show gtm wideip recursive' | egrep 'Gtm::WideIp|Availability'| grep -c 'offline'); export totalgtmwipsd=$(tmsh -q -c 'cd / ; show gtm wideip recursive' | egrep 'Gtm::WideIp|Availability'| grep -c 'disabled'); export totalgtmwipsun=$(tmsh -q -c 'cd / ; show gtm wideip recursive' | egrep 'Gtm::WideIp|Availability'| grep -c 'unknown'); ##POOLS export totalgtmpools=$(tmsh -q -c 'cd / ; show gtm pool recursive' | grep -c 'Gtm::Pool'); export totalgtmpoolsa=$(tmsh -q -c 'cd / ; show gtm pool recursive' | egrep 'Gtm::Pool|Availability'| grep -c 'available'); export totalgtmpoolsu=$(tmsh -q -c 'cd / ; show gtm pool recursive' | egrep 'Gtm::Pool|Availability'| grep -c 'unavailable'); export totalgtmpoolso=$(tmsh -q -c 'cd / ; show gtm pool recursive' | egrep 'Gtm::Pool|Availability'| grep -c 'offline'); export totalgtmpoolsd=$(tmsh -q -c 'cd / ; show gtm pool recursive' | egrep 'Gtm::Pool|Availability'| grep -c 'disabled'); export totalgtmpoolsun=$(tmsh -q -c 'cd / ; show gtm pool recursive' | egrep 'Gtm::Pool|Availability'| grep -c 'unknown'); #DATACENTERS export totalgtmdc=$(tmsh show gtm datacenter | grep -c 'Gtm::Datacenter'); export totalgtmdca=$(tmsh show gtm datacenter | egrep 'Gtm::Datacenter|Availability'| grep -c 'available'); export totalgtmdcu=$(tmsh show gtm datacenter | egrep 'Gtm::Datacenter|Availability'| grep -c 'unavailable'); export totalgtmdco=$(tmsh show gtm datacenter | egrep 'Gtm::Datacenter|Availability'| grep -c 'offline'); export totalgtmdcd=$(tmsh show gtm datacenter | egrep 'Gtm::Datacenter|Availability'| grep -c 'disabled'); export totalgtmdcun=$(tmsh show gtm datacenter | egrep 'Gtm::Datacenter|Availability'| grep -c 'unknown'); #IQUERY export totalgtmiquery=$(tmsh show gtm iquery | grep -c 'Gtm::IQuery'); export totalgtmiqueryc=$(tmsh show gtm iquery | egrep 'Gtm::IQuery|State'| grep -c 'connected'); #PROBERPOOLS export totalgtmpp=$(tmsh show gtm prober-pool | grep -c 'Gtm::Prober Pool'); export totalgtmppa=$(tmsh show gtm prober-pool | egrep 'Gtm::Prober Pool|Availability'| grep -c 'available'); export totalgtmppu=$(tmsh show gtm prober-pool | egrep 'Gtm::Prober Pool|Availability'| grep -c 'unavailable'); export totalgtmppo=$(tmsh show gtm prober-pool | egrep 'Gtm::Prober Pool|Availability'| grep -c 'offline'); export totalgtmppd=$(tmsh show gtm prober-pool | egrep 'Gtm::Prober Pool|Availability'| grep -c 'disabled'); export totalgtmppun=$(tmsh show gtm prober-pool | egrep 'Gtm::Prober Pool|Availability'| grep -c 'unknown'); #SERVERS export totalgtmsrv=$(tmsh show gtm server | grep -c 'Gtm::Server'); export totalgtmsrva=$(tmsh show gtm server | egrep 'Gtm::Server|Availability'| grep -c 'available'); export totalgtmsrvu=$(tmsh show gtm server | egrep 'Gtm::Server|Availability'| grep -c 'unavailable'); export totalgtmsrvo=$(tmsh show gtm server | egrep 'Gtm::Server|Availability'| grep -c 'offline'); export totalgtmsrvd=$(tmsh show gtm server | egrep 'Gtm::Server|Availability'| grep -c 'disabled'); export totalgtmsrvun=$(tmsh show gtm server | egrep 'Gtm::Server|Availability'| grep -c 'unknown'); #LISTENERS export totalgtmlist=$(tmsh show gtm listener | grep -c 'Gtm::Listener'); export totalgtmlista=$(tmsh show gtm listener | egrep 'Gtm::Listener|Availability'| grep -c 'available'); export totalgtmlistu=$(tmsh show gtm listener | egrep 'Gtm::Listener|Availability'| grep -c 'unavailable'); export totalgtmlisto=$(tmsh show gtm listener | egrep 'Gtm::Listener|Availability'| grep -c 'offline'); export totalgtmlistd=$(tmsh show gtm listener | egrep 'Gtm::Listener|Availability'| grep -c 'disabled'); export totalgtmlistun=$(tmsh show gtm listener | egrep 'Gtm::Listener|Availability'| grep -c 'unknown'); echo "2/3 PATIENCE adding the stats gathered to $gtmchgfilename" echo "**************************" >> $gtmchgfilename; echo "* STATS for $HOSTNAME *" >> $gtmchgfilename; echo "***********************" >> $gtmchgfilename; echo " Total GTMWideIPs:$totalgtmwips - Available:$totalgtmwipsa - Unavailable:$totalgtmwipsu - Offline:$totalgtmwipso - Disabled:$totalgtmwipsd - Unknown:$totalgtmwipsun" >> $gtmchgfilename; echo " Total GTMPools:$totalgtmpools - Available:$totalgtmwipsa - Unavailable:$totalgtmwipsu - Offline:$totalgtmwipso - Disabled:$totalgtmwipsd - Unknown:$totalgtmwipsun" >> $gtmchgfilename; echo " Total GTMDataCenters:$totalgtmdc - Available:$totalgtmdca - Unavailable:$totalgtmdcsu - Offline:$totalgtmdco - Disabled:$totalgtmdcd - Unknown:$totalgtmdcun" >> $gtmchgfilename; echo " Total iQueryStats:$totalgtmiquery - Connected:$totalgtmiqueryc" >> $gtmchgfilename; echo " Total ProberPools:$totalgtmpp - Available:$totalgtmppa - Unavailable:$totalgtmppu - Offline:$totalgtmppo - Disabled:$totalgtmppd - Unknown:$totalgtmppun" >> $gtmchgfilename; echo " Total Servers:$totalgtmsrv - Available:$totalgtmsrva - Unavailable:$totalgtmsrvu - Offline:$totalgtmsrvo - Disabled:$totalgtmsrvd - Unknown:$totalgtmsrvun" >> $gtmchgfilename; echo " Total Listeners:$totalgtmlist - Available:$totalgtmlista - Unavailable:$totalgtmlistu - Offline:$totalgtmlisto - Disabled:$totalgtmlistd - Unknown:$totalgtmlistun" >> $gtmchgfilename; echo "3/3 PATIENCE final step is to gather details to help troubleshoot to $gtmchgfilename" echo "*************************************************************************************************************" echo "now exporting all GTM WideIPs to file" echo "********" >> $gtmchgfilename; echo "WIDE-IPs" >> $gtmchgfilename; echo "********" >> $gtmchgfilename; tmsh -q -c 'cd / ; show gtm wideip recursive' | egrep 'Gtm::WideIp|Availability :|State|Reason' >> $gtmchgfilename; echo "*************************************************************************************************************" echo "now exporting all GTM Pools to file" echo "********" >> $gtmchgfilename; echo "*POOLsv*" >> $gtmchgfilename; echo "********" >> $gtmchgfilename; tmsh -q -c 'cd / ; show gtm pool recursive' | egrep 'Gtm::Pool|Availability|State|Reason' >> $gtmchgfilename; echo "*************************************************************************************************************" echo "now exporting all DataCenters to file" echo "***********" >> $gtmchgfilename; echo "DATACENTERS" >> $gtmchgfilename; echo "***********" >> $gtmchgfilename; tmsh show gtm datacenter | egrep 'Gtm::Datacenter|Availability|State|Reason' >> $gtmchgfilename; echo "*************************************************************************************************************" echo "now exporting all iQuery to file" echo "***********" >> $gtmchgfilename; echo "**IQUERY***" >> $gtmchgfilename; echo "***********" >> $gtmchgfilename; tmsh show gtm iquery | egrep 'Gtm::IQuery|Server|Data Center|State|version' >> $gtmchgfilename; echo "*************************************************************************************************************" echo "now exporting all ProberPool to file" echo "***********" >> $gtmchgfilename; echo "PROBER-POOL" >> $gtmchgfilename; echo "***********" >> $gtmchgfilename; tmsh show gtm prober-pool | egrep 'Gtm::Prober Pool|Availability|State|Reason' >> $gtmchgfilename; echo "*************************************************************************************************************" echo "now exporting all Servers to file" echo "***********" >> $gtmchgfilename; echo "**SERVER***" >> $gtmchgfilename; echo "***********" >> $gtmchgfilename; tmsh show gtm server | egrep 'Gtm::Server|Availability|State|Reason' >> $gtmchgfilename; echo "*************************************************************************************************************" echo "now exporting all Listeners to file" echo "***********" >> $gtmchgfilename; echo "**LISTENER*" >> $gtmchgfilename; echo "***********" >> $gtmchgfilename; tmsh show gtm listener | egrep 'Gtm::Listener|Availability|State|Reason' >> $gtmchgfilename; echo "****************************************************************************************************************" echo "" date >> $gtmchgfilename; echo "Done with $HOSTNAME change data gathering. NOTE for more info look at output file: $gtmchgfilename " unset totalgtmwips; unset totalgtmwipsa; unset totalgtmwipsu; unset totalgtmwipso; unset totalgtmwipsd; unset totalgtmwipsun; unset totalgtmpools; unset totalgtmpoolsa; unset totalgtmpoolsu; unset totalgtmpoolso; unset totalgtmpoolsd; unset totalgtmpoolsun; unset totalgtmdc; unset totalgtmdca; unset totalgtmdcu; unset totalgtmdco; unset totalgtmdcd; unset totalgtmdcun; unset totalgtmiquery; unset totalgtmiqueryc; unset totalgtmpp; unset totalgtmppa; unset totalgtmppu; unset totalgtmppo; unset totalgtmppd; unset totalgtmppun; unset totalgtmsrv; unset totalgtmsrva; unset totalgtmsrvu; unset totalgtmsrvo; unset totalgtmsrvd; unset totalgtmsrvun; unset totalgtmlist; unset totalgtmlista; unset totalgtmlistu; unset totalgtmlisto; unset totalgtmlistd; unset totalgtmlistun; unset gtmchgfilename; echo "Now exiting" exit
Recommended Posts