NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

ONTAP Rest API Discussions

Getting All snapmirror relationships slowly from ONTAP API

Louis_Chang
4,527 Views

Hello, I am trying to use python script to get "all snapmirrror relationships" from ONTAP API, when I run the script that it's took very long time to finished(around 30-50 minutes ), but using "snapmirror show" via ssh that it's very quickly to finished job(around 3-5 seconds ).

 

Is anyone else has same problem?

 

====================================================================

SSH cmd example:

ssh [email protected] "snapmirror show"

 

====================================================================

python script code:

 

#!/usr/bin/python [2/148]
import requests
import json
import urllib3
urllib3.disable_warnings()

auth_user = "admin"
auth_pass = "12345678"
api_url="https://10.255.1.10/api/snapmirror/relationships/"

headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}

r = requests.get(api_url, auth=(auth_user,auth_pass), headers=headers, verify=False)

rs = r.json()

total = rs["records"]

for r in rs["records"]:
#print api_url + r["uuid"]
api_url_list = api_url + r["uuid"]
print api_url_list
r1 = requests.get(api_url_list, auth=(auth_user,auth_pass), headers=headers, verify=False)
rs1 = r1.json()
#print rs1
print rs1["source"]["path"]
print rs1["destination"]["path"]
print rs1["healthy"]
print "===================================="

3 REPLIES 3

GidonMarcus
4,510 Views

What ONTAP version you are on? I would open a support request as that doesn't seem right... 

Gidi Marcus (Linkedin) - Storage and Microsoft technologies consultant - Hydro IT LTD - UK

Louis_Chang
4,481 Views

My ONTAP OS is 9.7P9.

Louis_Chang
4,479 Views

My ONTAP OS is 9.7P9.

Public