search
top

Retrieving NFS Export Data on Isilon with RESTful API and PowerShell

Introduction

In an earlier post we covered using RESTful API calls to EMC Isilon to retrieve quota data. In this post we will make the same calls but gather data on NFS exports for screen output as well and optional CSV output.

Prerequisites

To be able to execute RESTful API calls to Isilon you will need to create an account and add the appropriate roles. For GET operations a read-only account is all that you will need. For this post we will create a local group and grant Platform API and NFS read-only roles.

The Code

So now lets get down to the meat of the post and the code we need to execute the RESTful API calls in PowerShell for Isilon.

 

 

Let’s take a deeper look into the code example what it is doing. The first part of the script is setting the security to be able to connect to your Isilon array. This code is not original, I found this at code from blogs.msdn.com. Just copy and paste this section and change the username and password. This will work for any other RESTful API in PowerShell using Basic Authentication.

Next section of the code we will setup our URI (Uniform Resource Identifier).  we will identify three variables called $baseurl, $resourceurl and $uri. The $baseurl is the https ip address of the Isilon node you want to run the query against. For the $resourceurl variable we will be using the /platform/1/nfs/exports resource path. You can get a list of all available resource available from EMC RestfulAPI documentation for Isilon. The final $uri is the combining of the two previous variables.

Next section of the code we are going to create an object and make a Invoke-RestMethod cmdlet and GET action using security for authentication.

Now we are ready to get the output.

 

The output from the scripts.

restfulnfsisilon

There are more fields available for output. By not adding the select statement we will get the full output available.

From the available output we can add much more to the output. All you have to do is to add the fields to the select statement.

Download the code from getisilonqutas. File is a txt, just rename to .ps1

Conclusion

So we have explored making a basic Restful API call to Isilon to get specific NFS export information. You can also change the output by exploring the different fields available from the output.

7 Responses to “Retrieving NFS Export Data on Isilon with RESTful API and PowerShell”

  1. Jery says:

    Hi,
    Thanks for the useful info. I am not a storage techie so would like to get your help with something.

    Is there a way to get the logical and physical size of a particular folder?

    For example : /ifs/data/XXxxxx/XXXX/Redirected//username

    Thanks in advance,
    Jery.

    • newlife007 says:

      At the command line you can get the size of a directory by running du -sh /ifs/data/XXxxxx/XXXX/Redirected//username that will give you the total used for the directory in question and all it’s subs. Not sure what you are refferring to with logical and physical since Isilon is a scale out nas and storage from all nodes are shared. If you are using quotas you can use the isi quota quotas view –path=/ifs/data/XXxxxx/XXXX/Redirected//username –type=directory and that will give you something to what you are looking for.

  2. Jery says:

    Hi,
    Thanks for the prompt response.
    du -sh /ifs/data/XXxxxx/XXXX/Redirected/username gave the required output. Is it possible to run this from windows machine using powershell and RESTful api?
    When we used the api to list quotas we got the below info.
    usage : @{inodes=64; logical=10892288; physical=18095104}
    I think this is equivalent to the “Size” and “Size on Disk” when we view the properties in a windows explorer.

    Once again thanks a lot for all your kind help.
    Jery

  3. Jery says:

    Hi,
    Thanks for the prompt response.
    du -sh /ifs/data/XXxxxx/XXXX/Redirected/username gave the required output. Is it possible to run this from windows machine using powershell and RESTful api?
    When we used the api to list quotas we got the below info.
    usage : @{inodes=64; logical=10892288; physical=18095104}
    I think this is equivalent to the “Size” and “Size on Disk” when we view the properties in a windows explorer.

    Once again thanks a lot for all your kind help.
    Jery

    • newlife007 says:

      Jery,
      That may not be possible with Isilon RestAPI but what you could do is map a drive to Isilon on your system and then use PowerShell cmdlets (Get-ChildItem, and wmi calls to do the same as dh -sh command. Give me a bit and I maybe able to get you a script to do so.

      Mark

      • Jery says:

        Hi newlife007,

        Thanks for the response. I did try that but it gives me only the “Size” not the “Size on Disk” which is the actual usage. I think the best way for us would be to turn on quotas and get the info from that. By the way, I was able to leverage the POSH-SSH module for powershell and get the du -Ash and du -sh to get the info. Will post the script if you are interested.

        Thanks again for all the help.
        Jery.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top