Using the Isilon 7.0 ReST API with PowerShell

EMC recently released Isilon 7.0 “Mavericks” version of the OneFS operating system. This release has many great new features, which you can read all about here and here. One of these great new Isilon features is the ReST API, which allows programmatic access to the platform. If you are not familiar with ReST, it stands for Representational State Transfer. This is a lightweight, platform independent and stateless method of programming web services.

PowerShell allows an easy method to access the Isilon ReST API. Working with ReST is a new for me, but I thought it might be useful for some to follow along while I am learning. Also, if anyone has tips for me on this process I welcome the knowledge.

The Isilon ReST API is not enabled by default. To enable the functionality it requires changing options on the HTTP settings page in the protocols section, see below.

Isilon_HTTP_Settings

The HTTP interface can use active directory authentication, but in this post I will use basic authentication and show examples of reading data from the cluster. I hope to show more advanced examples as I learn.

PowerShell v3 has some great built-in functionality for working with ReST API’s. The Invoke-RestMethod cmdlet is exactly the functionality required to leverage the Isilon ReST API. The first challenges when working with the API will be related to authentication and certificates. The Isilon cluster will use a self-signed certificate by default. This results in a certificate error when connecting via HTTPS and can be seen when connecting to the Isilon cluster via a browser. The following code will allow a work around to the problem by ignoring the error.

In a production environment the correct way to handle this would be to install a certificate issued by a trusted certificate authority. The next step is to setup a proper HTTP header for basic authentication.

Once this is complete all we have to do is build the proper URL and issue the request. The code below will retrieve and display the SMB and NFS settings of the cluster.

The output from the above examples is shown below. As you can see this gives a quick concise view of the protocol settings.

While this is only a simple example of retrieving data from the cluster, the possibilities are endless. When considering where we are in the transformation to cloud and automation. This type of enabling technology will be the foundation of great things to come.

Stay tuned…

Regards,

Dave

Leave a Reply

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

5 comments

  1. Tom Spreacker says:

    Dave,
    As always great work! You are correct the possibilities are endless when we are open to new standards and methods provided with next generation solutions.

  2. hari says:

    Invoke-RestMethod is not getting detect on PowerGUI. How can I get it added

  3. sanjeev says:

    Nicely written.
    I tried the given example with VMAX3 array and I get SSL error:

    Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
    At C:\Users\Administrator\script4.ps1:37 char:14
    + … SMBGlobal = Invoke-RestMethod -Uri $url -Headers $headers -Method Get …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod],

    On the same VMAX3 array Python script works fine:
    target_uri = “%s/sloprovisioning/symmetrix/%s/storagegroup” % (self.URL, self.symmID)
    resp = requests.post(target_uri,headers=self.headers, data=json.dumps(payload), verify=False,auth=HTTPBasicAuth(self.username,self.password))

    Since I am new to pwershell, I do not know what I am doing wrong.

    • dmuegge says:

      Sanjeev,

      I am not familiar with the VMAX Rest API, but I imagine it is an issue with the header or authentication based on the message.

      Regards,

      Dave

  4. Hello muegge, Thank you for the blog and it is a very helpful resource to build upon. could you please let us know how did you arrive at the resouce url? ex: $resource = ‘/platform/1/protocols/smb/settings/global’ where do you find them? i tried to log into isilon via SSH and figure out how you might have arrived at this.