Software Development Kit (SDK) and API Discussions

Automate listing of all vFilers and SVMs on list of NAS

Livewire18
5,016 Views

Does anyone know of any script (any language) that can retrieve a list of all vFilers (from 7-mode boxes) and SVMs (from C-mode boxes)? At my work, we have Netapp boxes all over the world with at least a few thousand vFiler's and SVM's. I am trying to determine an easy way of gathering all of these (along with Base names) for our support team. This would allow us to open an excel spreadsheet or another app, and find the vfiler or SVM in question and quickly know which Base it is on. Currently, we do this manually and add the vfiler or SVM to a spreadsheet, but they get missed a lot by the implementation team. This could be something as simple as capturing plink text, powershell, or even WFA. I just need to find out if something alreayd exists before I spend a lot of time developing something myself. 

 

Thanks in advance!

1 ACCEPTED SOLUTION

mbeattie
4,945 Views

Hi there,

 

It sounds like you have a large enterprise environment...therefore i'm assuming that you also use OnCommand Unified Manager (AKA DFM) to manage and monitor your storage systems globally? If you are not then i'd recommend you consider doing so. You can use the DFM command line (assuming you are running version 5.X) and if you are running version 6 vApp appliance then you can use PowerShell and invoke a SQL query. See my post here:

 

http://community.netapp.com/t5/Developer-Network-Articles-and-Resources/Query-OCUM6-Database-using-PowerShell/ta-p/98184

 

Anyway here is how you would do this in DFM 5.X

 

C:>dfm vfiler list | find /i "vflier1" (where vfiler1 is the name of the vfiler you are searching for...the command will return the results showing what controller the vfiler is located on and it's DFM object ID)

 

Same concept applies to clustered data ONTAP (although there will be seperate instance of OnCommand for cDOT systems). Command line syntax is the same. EG

 

C:\>dfm vserver list
ID   Virtual Server            Cluster                             Deleted
---- ------------------------- ----------------------------------- -------
 134 nvaunsw100                nclaunsw01.testlab.local            No
 469 nvaunsw101                nclaunsw02.testlab.local            No
 481 nvaunsw150                nclaunsw01.testlab.local            No
 133 nvaunsw200                nclaunsw01.testlab.local            No
 470 nvaunsw201                nclaunsw02.testlab.local            No

C:\>dfm vserver list | find /i "nvaunsw100"
 134 nvaunsw100                nclaunsw01.testlab.local            No

 

Given the size and distributed locations of your storage systems i'd also recommend you add the storage controllers to DFM groups by locations (this will improve the performance of your queries in large environment as you can specifiy the DFM object ID in your query to limit the results by location).

 

C:\>dfm group list
ID   Group Name                               Group Type     Group Status
---- ---------------------------------------- -------------- -------------
 131 testlab                                  Host           Normal

C:\>dfm controller list 131
ID   Type                     Host Name                           Host Address                              ProductId    Deleted
---- ------------------------ ----------------------------------- ----------------------------------------- ------------ --------
 136 Controller               ncaunsw010                          192.168.100.21                            4082367724   No
 337 Controller               ncaunsw020                          192.168.100.31                            4082367724   No

 

Alternately if you just want a nice .csv file that you can open in excel then just run one of the default reports and output to a csv file. EG:

 

C:\>dfm report view -F csv vservers > vservers.csv
C:\>dfm report view -F csv clusters-all > clusters.csv

 

Also there is an easy of doing this in WFA by using an runtime SQL for the workflow input so that when you select your vfiler\vserver it will automatically enumerate the controller\clustername for you so you don't have to think about it. Let me know if your interested in this and i'll email it to you.

 

Hope this gives you a few more options and ideas.

 

Cheers

 

/matt

 

 

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

View solution in original post

4 REPLIES 4

asulliva
5,004 Views

Hello!

 

The hardest part of this operation is going to be connecting to all of the 7-mode controllers and clusters, once you have that done it's just a one-liner to collect the info you want:

 

# clustered Data ONTAP
Get-NcVserver | ?{ $_.VserverType -eq "data" } | Select NcController,Vserver

# 7-mode
Get-NaVfiler | ?{ $_.Name  -ne "vfiler0" } | Select AdminHost,Name

 For authenticating to each of the systems, I would recommend using either a CSV with the username/password combination (good when each system has a different password), or create a number of PSCredential objects which can be used as needed (good when you only have a few different passwords across all systems).

 

Hope that helps!

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

mbeattie
4,946 Views

Hi there,

 

It sounds like you have a large enterprise environment...therefore i'm assuming that you also use OnCommand Unified Manager (AKA DFM) to manage and monitor your storage systems globally? If you are not then i'd recommend you consider doing so. You can use the DFM command line (assuming you are running version 5.X) and if you are running version 6 vApp appliance then you can use PowerShell and invoke a SQL query. See my post here:

 

http://community.netapp.com/t5/Developer-Network-Articles-and-Resources/Query-OCUM6-Database-using-PowerShell/ta-p/98184

 

Anyway here is how you would do this in DFM 5.X

 

C:>dfm vfiler list | find /i "vflier1" (where vfiler1 is the name of the vfiler you are searching for...the command will return the results showing what controller the vfiler is located on and it's DFM object ID)

 

Same concept applies to clustered data ONTAP (although there will be seperate instance of OnCommand for cDOT systems). Command line syntax is the same. EG

 

C:\>dfm vserver list
ID   Virtual Server            Cluster                             Deleted
---- ------------------------- ----------------------------------- -------
 134 nvaunsw100                nclaunsw01.testlab.local            No
 469 nvaunsw101                nclaunsw02.testlab.local            No
 481 nvaunsw150                nclaunsw01.testlab.local            No
 133 nvaunsw200                nclaunsw01.testlab.local            No
 470 nvaunsw201                nclaunsw02.testlab.local            No

C:\>dfm vserver list | find /i "nvaunsw100"
 134 nvaunsw100                nclaunsw01.testlab.local            No

 

Given the size and distributed locations of your storage systems i'd also recommend you add the storage controllers to DFM groups by locations (this will improve the performance of your queries in large environment as you can specifiy the DFM object ID in your query to limit the results by location).

 

C:\>dfm group list
ID   Group Name                               Group Type     Group Status
---- ---------------------------------------- -------------- -------------
 131 testlab                                  Host           Normal

C:\>dfm controller list 131
ID   Type                     Host Name                           Host Address                              ProductId    Deleted
---- ------------------------ ----------------------------------- ----------------------------------------- ------------ --------
 136 Controller               ncaunsw010                          192.168.100.21                            4082367724   No
 337 Controller               ncaunsw020                          192.168.100.31                            4082367724   No

 

Alternately if you just want a nice .csv file that you can open in excel then just run one of the default reports and output to a csv file. EG:

 

C:\>dfm report view -F csv vservers > vservers.csv
C:\>dfm report view -F csv clusters-all > clusters.csv

 

Also there is an easy of doing this in WFA by using an runtime SQL for the workflow input so that when you select your vfiler\vserver it will automatically enumerate the controller\clustername for you so you don't have to think about it. Let me know if your interested in this and i'll email it to you.

 

Hope this gives you a few more options and ideas.

 

Cheers

 

/matt

 

 

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

Livewire18
4,936 Views

Thanks for the info. Yes, we do use DFM. We also use WFA (Workflow Automation) which attaches to DFM. I have actually created a PHP page that will display MySQL query results from WFA. I think this is the probably going to be the easiest solution for me because of all the info that WFA collects. This allows me to get all filers, vfilers, clusters, SVM's, and other info including serial numbers, and aggr space info. 

mbeattie
4,923 Views

Hi

 

no worries, also here are the SQL queries you can use on your WFA workflows to enable a drop down list of running vfilers which will automatically enumerate the cluster based on the vserver that is selected. If you are not certain how to implement these in WFA send me a message i'll email it to you.

 

SQL Query for cluster input:

 

SELECT

   cluster.name AS 'cluster_name',

   cluster.primary_address AS 'primary_address'

FROM

   cm_storage.cluster

WHERE

   id = (

      SELECT

         vserver.cluster_id

      FROM

         cm_storage.vserver

      WHERE

         vserver.name = '${VserverName}'

      )

 

SQL Query for vserver input:

 

SELECT

   vserver.name

FROM

   cm_storage.vserver

WHERE

   type = 'data'

AND

   admin_state = 'running'

ORDER BY

   vserver.name ASC

 

hope that helps

 

/matt

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