Recoverpoint replication reporting with vmax splitter

Guys, Have you ever thought of automating the RP replication status and send status via email or post it to any reporting platform. Since the splitter impacts the VMAX FA's and there is an overhead of 13% on the utilization its good idea to see if the replication is driving the utilization of vmax FA.

There are ways of pulling iops/read/write using symstat but its utilization (Director CPU utilization etc) which plays a significant role. As it crosses 80% we start seeing the increase in device response time. However, to measure FA utilization we will have to go through SMAS UI then pull out the reports. Its manual effort. But there is a way to automate it through REST API.

You can get the details what type of objects are supported by pointing to :

https://smc server:8443/univmax/restapi

Coming to the point, getting recoverpoint consistency group status fully automated doesn't seems to be tough. Lets get through the steps.

1. Hash your SSH keys of the unix host to the recoverpoint cluster IP. This is to ensure we can run scripts in non interactive mode.
2. Run the below script or schedule it, I will provide comments whenever required:

========Script starts ==================

#!/bin/bash

HOST="IP of the host running our json script, it could be local if python is setup correctly"
File=/tmp/i1
Out=/tmp/i11
Out.tmp1=/tmp/i112
Out.tmp2=/tmp/i113
Group=/tmp/i111
Flag=0
Process=/tmp/PRCSS
Tmp=/tmp/$$
JSon=/tmp/json
###List of FA port on vmax for which you have to pull the reports
FAPort=/root/script/FA.port
RPHOST="IP of RP cluster"
MAIL="Where you want to send email"

#Functions

clean ()
{
rm -f $File $Out $Out.tmp1 $Out.tmp2 $Group $Process $JSon
}

parse ()
{
rm -f $Out
rm -f $Out.tmp1
rm -f $Out.tmp2
Flag=0
for name in `cat $File`; do
        if `echo $name | egrep Replication > /dev/null`; then
                Flag=0
        elif `echo $name | egrep Journal > /dev/null`; then
                Flag=1
        elif [ $Flag = 0 ]; then
        echo $name >> $Out
                Flag=0
        else
                Flag=1
fi
done
echo "Prod Volume=====DR Volume==" >> $Tmp
cat $Out | egrep 844 | awk -F\| '{print $1"|"$2}' > $Out.tmp1
cat $Out | egrep 795 | awk -F\| '{print $1"|"$2}' > $Out.tmp2
paste $Out.tmp1 $Out.tmp2 >> $Tmp
}

ProcessFA_JSon ()
{
for name in `cat $FAPort `; do
ssh $HOST "/usr/bin/python /root/script/json.sh FA-$name" | egrep PERCENT_BUSY| awk -F\: '{print $2}' | awk -F\, '{print $1}'> $JSon;
echo -n "FA-"$name":::: " >> $Tmp;
cat $JSon | awk '{sum+=$1} END {print sum/48}' >> $Tmp
done
}


########### Main starts  ####################################
#############################################################

clean

echo > $Tmp
echo "==============================================================" >> $Tmp
echo >> $Tmp

Val=""
echo "Group Statistics for Consistency group" >> $Tmp
echo "==============================================================" >> $Tmp
echo >> $Tmp

#get the group list
ssh -l admin $RP_HOST "get_groups" | egrep -v "Production|DRSite|Copies|Groups" | sed -e '/^$/d' | awk -F\: '{print $1}' | sed '$d'  > $Group

for name in `cat $Group`; do

echo -n $name":: " >> $Tmp
if [ x`/usr/bin/ssh -l admin $RP_HOST "get_group_statistics $name" | egrep Init | awk '{print $1}'| awk -F: '{print $1}'` = xInit ]; then
        Progress=`/usr/bin/ssh -l admin $RP_HOST "get_group_statistics $name" | egrep Progress | awk '{print $2}'`
        echo "Init : $Progress" >> $Tmp
elif [ x`/usr/bin/ssh -l admin $RP_HOST "get_group_statistics $name" | egrep pre-replication | awk '{print $3}'` = xpre-replication ] && [ x`/usr/bin/ssh -l admin $RP_HOST "get_group_statistics $name" | egrep Link | awk '{print $3}'` = xNone ]; then

        echo "Error: Please check" >> $Tmp
elif [ x`/usr/bin/ssh -l admin $RP_HOST "get_group_statistics $name" |  egrep Group| awk '{print $2}'` = xNone ]; then
        echo "Not Active" >> $Tmp
else
        echo "Active" >> $Tmp
fi
done

echo "==============================================================" >> $Tmp
echo >> $Tmp
echo "FA utilization (Avg utilization in last 4 hrs for Diagnostic ) " >> $Tmp
ProcessFA_JSon

#Group configuration

echo >> $Tmp
echo "===================GROUP CONFIGURATION================" >> $Tmp

for name in `cat $Group`; do
ssh -l admin $RP_HOST "get_group_volumes group=$name" | egrep "Journal volumes|Replication volumes|SYMMETRIX" | awk '{print $1"|"$6"|"$7}' > $File
echo "$name:::   ">> $Tmp
parse
echo >> $Tmp
done
cat $Tmp | mailx -s "VMAX Recoverpoint status as of `date`" $MAIL

rm -f $Tmp
clean
exit
========== Script ends =========================

Json script is written in python to pull out reports for FA utilization

========== Script starts ========================

#!/usr/bin/python
### Created by Rupesh for VMAx FA required for Recoverpoint reporting
### 1/30 called from keystrokes server

import requests, json, pprint, time, socket, sys
target_url = "https://smc server:8443/univmax/restapi/performance/FEDirector/metrics"
   
requestObj = {'feDirectorParam':
            {'endDate': int(time.time()*1000), #End time to specify is now.
             'startDate': int(time.time()*1000)-(3600*1000*4), #start time is 240 minutes before that
             'symmetrixId': 'VMAX SID', #symmetrix ID (full 12 digits)
             'directorId' : sys.argv[1] ,
             'metrics': ['PERCENT_BUSY'] #array of what metrics we want
            
            }
          }
         
requestJSON = json.dumps(requestObj, sort_keys=True, indent=4) #turn this into a JSON string
print requestJSON

headers = {'content-type': 'application/json','accept':'application/json'} #set the headers for how we want the response

#make the actual request, specifying the URL, the JSON from above, standard basic auth, the headers and not to verify the SSL cert.
r = requests.post(target_url, requestJSON, auth=('smc', 'smc'), headers=headers, verify=False)


#take the raw response text and deserialize it into a python object.
try:
    responseObj = json.loads(r.text)
except:
    print "Exception"
    print r.text
print json.dumps(responseObj, sort_keys=False, indent=4)


=========== Script ends =========================

Finally the list of FA ports that are called in ProcessFA_JSon () function. A plain text file.

5E
6E
7E
8E
9E
10E
11E
12E

Please ensure its converted to unix format, dos2unix .....

Json script was copied from site, dont remember but thanks to the person who posted it. I have modified as per my requirement.

This is all needed to scehdule a daily report or hourly in cron. 
Hope this is useful in some way.

Comments

  1. Very informative blog... I found very useful information for DR replication. Thanks for sharing

    ReplyDelete

Post a Comment

Popular posts from this blog

zpool and power path partial compatibility

Move LVM from multiple local and iscsi disk to SAN

Clariion storage processor IP address change