Skip to content

Instantly share code, notes, and snippets.

@rbocchinfuso
Created March 5, 2014 15:41
Show Gist options
  • Save rbocchinfuso/9369708 to your computer and use it in GitHub Desktop.
Save rbocchinfuso/9369708 to your computer and use it in GitHub Desktop.
Quick shell script to quickly gather a CSV with RP CG replication stats
RP="192.168.100.101"
out="./cg_stats.out"
groups="./groups.in"
#plink -l admin -pw admin $RP "get_groups" | egrep -v "Production|DRSite|Copies|Groups" | sed -e '/^$/d' | awk -F\: '{print $1}' | sed '$d' > $GroupTmp
echo "CGName,JournalUsage,JournalLag,ReplicationLag,CurrentProtectionWindow,PredictedProtectionWindow"
echo "CGName,JournalUsage,JournalLag,ReplicationLag,CurrentProtectionWindow,PredictedProtectionWindow" > $out
for name in `cat $groups`; do
#JournalTotal=`plink -l admin -pw admin $RP "get_group_statistics $name" | egrep "Total:" | tail -n1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'`
JournalUsage=`plink -l admin -pw admin $RP "get_group_statistics $name" | egrep "Usage:" | tail -n1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'`
JournalLag=`plink -l admin -pw admin $RP "get_group_statistics $name" | egrep "Journal lag:" | tail -n1 | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}'`
ReplicaLag=`plink -l admin -pw admin $RP "get_group_statistics $name" | egrep "Time:" | tail -n1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'`
CurProtectWindow=`plink -l admin -pw admin $RP "get_group_statistics $name" | egrep "Value:" | head -n1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'`
PredictedProtectWindow=`plink -l admin -pw admin $RP "get_group_statistics $name" | egrep "Value:" | tail -n1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'`
echo $name,$JournalUsage,$JournalLag,$ReplicaLag,$CurProtectWindow,$PredictedProtectWindow
echo $name,$JournalUsage,$JournalLag,$ReplicaLag,$CurProtectWindow,$PredictedProtectWindow >> $out
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment