Software Development Kit (SDK) and API Discussions

Is there API to monitor SnapMirror transfer progress?

yan
NetApp
5,924 Views

We have an environment with massive data migration. Volume SnapMirrors take days to transfer. Is there ONTAP API available to monitor SnapMirror transfer progress?

 

The data is available in "snapmirror status -l "

 

#!/bin/bash

i=1

filer=$1

export filer

 

old=$(( $(ssh -l root $filer snapmirror status -l | grep Progress | grep -v "-" | awk -F" " '{print $2}' | tr "\n" "+" | xargs -I{} echo {} 0 ) ));

while [ $i -lt 2 ]

do new=$(( $(ssh -l root $filer snapmirror status -l | grep Progress | grep -v "-" | awk -F" " '{print $2}' | tr "\n" "+" | xargs -I{} echo {} 0 ) ))

KB=$(expr $new - $old)

if [ $KB -lt 0 ]

then KB=0

fi

old=$new

MB=$(expr $KB / 1024)

echo $MB

sleep 5

done

 

Thanks in advance!

1 ACCEPTED SOLUTION

rle
NetApp Alumni
5,830 Views

You can use snapmirror-get-status. Here is the documentation which can be downloaded from http://developer.netapp.com.

snapmirror-get-status [top]
Return the SnapMirror status.  This API can be issued on either the source or destination filer.
Input NameRangeTypeDescription
location
string
optional
The source location or destination location of the SnapMirror pair. Possible types are volume or qtree only. If this input is provided, only the SnapMirror relationships with a matching source or destination will be reported. The argument is invalid if the named location doesn't exist. In this case, snapmirror-status-info output will not be present. The argument can also be invalid if it is a flexclone name. (Be aware that the snapmirror-list-destinations API can return flexclone names.) Then snapmirror-get-status API will return a snapmirror-status output value with a "state" of "unknown". If the argument is not specified, all source, destination SnapMirror pairs are returned.
Output NameRangeTypeDescription
is-available
boolean
True if SnapMirror is available.
snapmirror-status
snapmirror-status-info[]
optional
An array of SnapMirror pair status.  If there are no transfers or schedules, then snapmirror-status is not returned.  Any and all pairs whose source or destination location matches the input location will be in the output.
Vfiler-enabled
Yes

Element definition: snapmirror-status-info [top]
The SnapMirror pair status.
NameRangeTypeDescription
base-snapshot
string
optional
Base snapshot name.  Only present if available.
contents
string
State of the active file system of snapmirror destinations.  Possible values are: "replica", "transitioning", and "original".
current-transfer-error
string
optional
A human readable transfer error of the current snampmirror transfer.  Present when there is a current error.
current-transfer-type
string
optional
Type of the current SnapMirror transfer.  Possible values are: initialize, store, schedule, retry, retrieve, resync, and migrate.  Only present when there is a transfer.
destination-location
string
The destination location of the SnapMirror pair.  The form is <filer>:<volume> or <filer>:/vol/<volume>/<qtree>.
inodes-replicated[0..2^64-1]integer
optional
Shows the number of inodes replicated. Present during directory processing phase.
lag-time
integer
Amount of time since the last snapmirror transfer in seconds.
last-transfer-duration
integer
Duration of the last SnapMirror transfer in seconds.
last-transfer-from
string
Source location of the last SnapMirror transfer.
last-transfer-size
integer
The size in kilo bytes (1024) of the last SnapMirror transfer.
last-transfer-type
string
optional
Last SnapMirror transfer type. Possible values are: "initialize", "store", "schedule", "retry", "retrieve", "resync", and "migrate".  Only present when there was a last transfer.
mirror-timestamp
integer
Access time in seconds since Jan 1, 1970.
replication-ops[0..2^64-1]integer
optional
Counter that is incremented for every replication operation. Present during directory processing phase.
source-location
string
The source location of the SnapMirror pair.  The form is <filer>:<volume> or <filer>:/vol/<volume>/<qtree>.
state
string
SnapMirror pair state.  Possible values are: "uninitialized", "snapmirrored", "broken-off", "quiesced", "source", and "unknown".
status
string
SnapMirror pair transfer status. Possible values are: "Idle, "Transferring", "Pending", "Aborting", "Migrating", "Quiescing", "Resyncing", "Waiting", "Syncing", "In-sync" and "Paused". In case the previous transfer was failed/aborted and had a restart checkpoint set, the status could be "Idle with restart checkpoint" or "Pending with restart checkpoint". In addition the status could be "Checking", "Fixing" and "Transferring, Checking" when "snapmirror check" command is being run on the destination volume.
transfer-progress
integer
Number of kilo bytes (1024) transfered in a current on-going transfer.
Regards,
   - Rick -

View solution in original post

3 REPLIES 3

rle
NetApp Alumni
5,831 Views

You can use snapmirror-get-status. Here is the documentation which can be downloaded from http://developer.netapp.com.

snapmirror-get-status [top]
Return the SnapMirror status.  This API can be issued on either the source or destination filer.
Input NameRangeTypeDescription
location
string
optional
The source location or destination location of the SnapMirror pair. Possible types are volume or qtree only. If this input is provided, only the SnapMirror relationships with a matching source or destination will be reported. The argument is invalid if the named location doesn't exist. In this case, snapmirror-status-info output will not be present. The argument can also be invalid if it is a flexclone name. (Be aware that the snapmirror-list-destinations API can return flexclone names.) Then snapmirror-get-status API will return a snapmirror-status output value with a "state" of "unknown". If the argument is not specified, all source, destination SnapMirror pairs are returned.
Output NameRangeTypeDescription
is-available
boolean
True if SnapMirror is available.
snapmirror-status
snapmirror-status-info[]
optional
An array of SnapMirror pair status.  If there are no transfers or schedules, then snapmirror-status is not returned.  Any and all pairs whose source or destination location matches the input location will be in the output.
Vfiler-enabled
Yes

Element definition: snapmirror-status-info [top]
The SnapMirror pair status.
NameRangeTypeDescription
base-snapshot
string
optional
Base snapshot name.  Only present if available.
contents
string
State of the active file system of snapmirror destinations.  Possible values are: "replica", "transitioning", and "original".
current-transfer-error
string
optional
A human readable transfer error of the current snampmirror transfer.  Present when there is a current error.
current-transfer-type
string
optional
Type of the current SnapMirror transfer.  Possible values are: initialize, store, schedule, retry, retrieve, resync, and migrate.  Only present when there is a transfer.
destination-location
string
The destination location of the SnapMirror pair.  The form is <filer>:<volume> or <filer>:/vol/<volume>/<qtree>.
inodes-replicated[0..2^64-1]integer
optional
Shows the number of inodes replicated. Present during directory processing phase.
lag-time
integer
Amount of time since the last snapmirror transfer in seconds.
last-transfer-duration
integer
Duration of the last SnapMirror transfer in seconds.
last-transfer-from
string
Source location of the last SnapMirror transfer.
last-transfer-size
integer
The size in kilo bytes (1024) of the last SnapMirror transfer.
last-transfer-type
string
optional
Last SnapMirror transfer type. Possible values are: "initialize", "store", "schedule", "retry", "retrieve", "resync", and "migrate".  Only present when there was a last transfer.
mirror-timestamp
integer
Access time in seconds since Jan 1, 1970.
replication-ops[0..2^64-1]integer
optional
Counter that is incremented for every replication operation. Present during directory processing phase.
source-location
string
The source location of the SnapMirror pair.  The form is <filer>:<volume> or <filer>:/vol/<volume>/<qtree>.
state
string
SnapMirror pair state.  Possible values are: "uninitialized", "snapmirrored", "broken-off", "quiesced", "source", and "unknown".
status
string
SnapMirror pair transfer status. Possible values are: "Idle, "Transferring", "Pending", "Aborting", "Migrating", "Quiescing", "Resyncing", "Waiting", "Syncing", "In-sync" and "Paused". In case the previous transfer was failed/aborted and had a restart checkpoint set, the status could be "Idle with restart checkpoint" or "Pending with restart checkpoint". In addition the status could be "Checking", "Fixing" and "Transferring, Checking" when "snapmirror check" command is being run on the destination volume.
transfer-progress
integer
Number of kilo bytes (1024) transfered in a current on-going transfer.
Regards,
   - Rick -

KENNETHKOZEL
5,831 Views

snapmirror-get-status is on c mode filers only. 7 mode uses snapmirror - status, onCommand shows progress on transfers but not sure if its very accurate with a count down of data transferred.

rle
NetApp Alumni
5,831 Views

Hi Ken,

Yan asked about APIs, not the CLI.

For 7 mode: the API is snapmirror-get-status.  For Clustered ONTAP, it is snapmirror-get-iter.

Regards,

   - Rick -

Public