Created
August 15, 2011 10:51
-
-
Save mo6020/1146029 to your computer and use it in GitHub Desktop.
Sanitized NetApp scripts pulled from Will Foster on G+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# finds clonebases without flexclone dependencies | |
# replace orahome/appltop with what makes sense for you | |
FILER="YOURFILER" | |
for vol in $(ssh root@$FILER df -h | grep clonebase | egrep -v '(snapshot|orahome|appltop)' | awk -F'/' '{print $3}'); do | |
ssh root@YOURFILER vol status $vol | \ | |
awk ' | |
/^clonebase/ {printf "%s: ",$1} | |
/Volume has clones/ {gsub(/,/, ""); for(i=4;i<=NF;i++){printf "%s ", $i}} | |
END {printf "\n"} | |
' | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get speeds of snapmirror transfers in KB based on an interval | |
# compare readings from snap delta amount transferred and do the math for us | |
FILER=$1 | |
SLEEP_INTERVAL=30 | |
function getstats { | |
(ssh -a root@$FILER snapmirror status -l) | awk ' | |
$1 == "Source:" {split($2,flop,":"); source=foo[2]} | |
$1 == "Destination:" {split($2,flop,":"); destination=foo[2]} | |
$1 == "Status:" {status=$2} | |
$1 == "Progress:" {progress=$2} | |
$1 == "State:" {state=$2; | |
if ( status == "Transferring" ){ | |
if ( state == "Source" ){ | |
printf "%s=%d\n", source, progress; | |
} else { | |
printf "%s=%d\n", destination, progress; | |
} | |
}} | |
' | |
} | |
function calculate_speed { | |
old=$1 | |
new=$2 | |
interval=$3 | |
declare keys | |
declare old_arr | |
i=0 | |
for flop in $old; do | |
keys[$i]=${flop%=*} | |
old_arr[$i]=${flop#*=} | |
i=$(($i+1)) | |
done | |
i=0 | |
for flop in $new; do | |
echo "${keys[$i]}: $(( (${flop#*=} - ${old_arr[$i]}) / $interval )) KB/s" | |
i=$(($i+1)) | |
done | |
} | |
echo -n "Getting first statistics... " | |
run1="$(getstats)" | |
echo "done." | |
echo -n "Sleeping for $SLEEP_INTERVAL seconds... " | |
sleep $SLEEP_INTERVAL | |
echo "OK" | |
echo -n "Getting second statistics... " | |
run2="$(getstats)" | |
echo "done." | |
calculate_speed "$run1" "$run2" $SLEEP_INTERVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment