Veritas Volume Replicator (VVR) Status Script

The Veritas Volume Replicator (VVR) Option provides organizations with a foundation for continuous data replication, enabling rapid and reliable recovery of critical applications at remote recovery sites. As an option to Veritas Storage Foundation by Symantec, Volume Replicator enables efficient replication of data over IP networks, giving organizations an extremely flexible, high-performance alternative to traditional array-based replication architectures. This flexibility lets organizations choose virtually any combination of storage devices on any major operating system, providing a consistent, easy-to-manage high availability/ disaster recovery solution throughout the data center.
 
In the event the connection between the replication nodes goes down temporary. VVR will store all the transactions in an SRL volume. When connection is restored. VVR will try to sync up all rlinks and flush the SRL.
 
One of the things that I like to know is how much data is remaining to be sent over. Having to enter multiple commands to check on all of my rlinks and doing the math just to find how much data is left. Doing this every time can become cumbersome.
 
So, for those who uses VVR and run into this issue, below is a script you can use to check the replication status.
 
Hope this helps!


#!/bin/ksh
#

AWK=/usr/bin/awk
SED=/usr/bin/sed
GREP=/usr/bin/egrep

VXDG=/usr/sbin/vxdg
VXPRINT=/usr/sbin/vxprint
VXRLINK=/usr/sbin/vxrlink

REPGROUP=${1:-NOT_DEFINED}
UNITS=${2:-GB}

if [[ "${REPGROUP}" = "NOT_DEFINED" ]]
then
   echo "Usage: $0  [KB|MB|GB]"
   exit
fi

RLINK=`${VXPRINT} -g ${REPGROUP} -Pl | ${AWK} '/^Rlink:/{print $2}'`
START=`${VXPRINT} -g ${REPGROUP} -v | ${GREP} -v srlVol | \
       ${AWK} '/^v /{ s += $5 } END { print s/2}'`
MBSTART=`echo "scale=4; ${START} / 1024" | bc`
GBSTART=`echo "scale=4; ${MBSTART} / 1024" | bc`

REMAIN=`${VXRLINK} -g ${REPGROUP} status ${RLINK} | ${SED} '{
           1d
           s/^.*\. //
           s/ Kbytes.*$//
        }'`
MBREMAIN=`echo "scale=4; ${REMAIN} / 1024" | bc`
GBREMAIN=`echo "scale=4; ${MBREMAIN} / 1024" | bc`

DPERCENT=`echo "scale=4 ; ${REMAIN} / ${START}" | bc`
PERCENT=`echo "scale=4 ; ${DPERCENT} * 100" | bc`
RPERCENT=`echo "scale=4 ; 100 - ${PERCENT}" | bc`

echo "Replication Link: $RLINK"

# Display values in selected format
case $UNITS in
   GB|Gb|gb) echo "Total to replicate: ${GBSTART}GB"
             echo "Remaing to replicate: ${GBREMAIN}GB"
             ;;
   MB|Mb|mb) echo "Total to replicate: ${GBSTART}MB"
             echo "Remaing to replicate: ${GBREMAIN}MB"
             ;;
   KB|Kb|kb) echo "Total to replicate: ${START}KB"
             echo "Remaing to replicate: ${REMAIN}KB"
             ;;
esac

echo "Percent complete: $RPERCENT"

Database Diskgroup:
Replication Link: DBrlk_to_DR
Total to replicate: 511.9667GB
Remaing to replicate: 404.2366GB
Percent complete: 21.0500

Images Diskgroup:
Replication Link: Filesrlk_to_DR
Total to replicate: 3407.5345GB
Remaing to replicate: 3308.2830GB
Percent complete: 2.9200