Network and Storage Protocols

Help on python script for gathering info.

ansible_netapp_Provision

Hi,

 

I am not sure if i should reach out for Python stuff but i hope you may help out.. which is really helpful.

 

Normally below script will execute for given one cluster.

Requirement: I would like to run same script for multiple clusters at a single execute ( like I need to call all clusters from one file e.g   C:\Users\u630850\cluster_list.txt ) and then execute. Since I am not familiar with loops, I am reaching out for assistance.  Thank you. 🙂

 

print("\n ~~ This script is to gather volume list for one cluster ~~\n")
cluster = input('Enter ONTAP Cluster Name:')

if (str(is_valid_hostname(cluster))=="True"):
username = input('Enter cluster login userid:')
password = getpass.getpass()
print("\nValidating connection.. please wait..\n")

conn = HostConnection(cluster, username, password, verify=False)
config.CONNECTION = conn

try:
for volume in Volume.get_collection(**{"fields": '*', "state": 'offline', "svm.name": '*'}, max_records=500):

 

1 ACCEPTED SOLUTION

Thank you for your response and suggestion. I will look for AIQUM.

 

Meanwhile may i get for my current scenario which i posted for?  Thank you

View solution in original post

2 REPLIES 2

mbeattie

Hi,

 

If your intention is to enumerate a list of offline volumes amongst your clusters have you considered that it would be far more efficient to invoke a single REST API call to Active IQ Unified Manager (AIQUM)? If you have several clusters in your environment and you are not using AIQUM to monitor them then i'd advise installing it.

 

The additional benefits of this approach are:

 

  • Results will be dynamically updated as your environment changes (EG clusters are added or removed from AIQUM) then you won't have to manually update your cluster list input file.
  • AIQUM manages the credentials to query each cluster into a single repository so you will not be prompted for credentials to connect to each cluster or have to delegate a common local user account on each cluster for API reporting purposes.

 

The REST API call is:

 

https://<%hostname%>/api/datacenter/storage/volumes?state=offline

 

Hope that gives you some ideas

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Thank you for your response and suggestion. I will look for AIQUM.

 

Meanwhile may i get for my current scenario which i posted for?  Thank you

Public