Microsoft Virtualization Discussions

Scheduled Task - SnapMirror Throttling


I am trying to figure out using powershell how I can script out a way to on the fly change the throttling of snapmirror relationships on our filers.  The issue we are having is that some transfers that normally finish overnight are beginning to run into the daytime and use all the available bandwidth, so if I could just set up a scheduled task to throttle this during certain hours of the day, That would be ideal.

I was considering using the Set-NaSnapmirrorSchedule.

I am curious if I were to run something like Set-NaSnapmirrorSchedule -MaxTransferRate 256, would this change the throttling on the fly for an active transfer?  And if so, would this be the only option that was changed or would it mess up the entire schedule for the active schedule since I didn't specify the -Hours, -DaysOfWeek, etc.?  The only thing I want to change is the transfer rate.


Re: Scheduled Task - SnapMirror Throttling


I find it easier to do at a global level than per snapmirror relationship.

You need to do something like this

set-naoption replication.throttle.enable on


set-naoption replication.throttle.enable off

Create two scripts and create AT jobs in windows to schedule it.


Re: Scheduled Task - SnapMirror Throttling


I ended up using the following command to basically ssh to the filer and use a standard DataONTAP command to throttle the transfer at 128 KBps:

Invoke-NaSsh -Name sourcefiler -Command "snapmirror throttle 128 destinationfiler:/volumepath"

This command doesn't change the setting in the snapmirror.conf file, it just changes the throttling for the active running snapmirror job.  That way I can set the max transfer rate to unlimited and just run a scheduled task that will run this powershell script to throttle during business hours for any jobs that spill over into the day.

When the next snapmirror job kicks off, it will default back to whatever is set in the snapmirror.conf file.

You can run Set-NaCredential prior to running that command to store your ssh credentials so that aren't prompted for them every time you want to run the script.

View solution in original post

Re: Scheduled Task - SnapMirror Throttling


I still think it's easier to turnon and turnoff with a scheduled task.  Thats just my opinion

as for setting credentials, you can store your credentials in cache, or you can write a security object and pass it to the connection

C:\PS>$password = ConvertTo-SecureString "p@ssword" -AsPlainText -Force

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "root",$password

Connect-NaController benson -Credential $cred

Re: Scheduled Task - SnapMirror Throttling


There may be some confusion about my previous post, but I did set it up with a scheduled task.(actually 2 scheduled tasks, 1 to turn on throttling, 1 to turn it off)  I've set up a scheduled task using a service account to run the one line above at 7:00 AM, and then it runs the same command again at 6:00 PM to turn off throttling (same command except instead of "128", plug in "0" to remove all throttling.)

That's a neat way to store the creds, but using netapps set-nacredential cmdlet was very easy.  It saves the creds for that particular filer in an encrypted file so that you never have to enter them again (unless you change the password for that account.)

Thanks for your help!

2021 NetApp Partner Experience Survey
PES Banner
All Community Forums