Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

2892

March 3rd, 2015 13:00

Filter output - XtremIO

How can we filter the information from XtremIO command output ?  tried with grep, more and findstr are not taking.

Any suggestion on equivalent options available? 

226 Posts

March 3rd, 2015 14:00

Hi khkris,

I'm assuming you're trying to do this via an interactive ssh session or from the CLI console (accessible via the GUI)? I'm not aware of any way to pipe CLI command outputs to other utilities via those methods.

But you can configure ssh public/private key authentication and then run individual xmcli commands inline from your ssh client, and filter the resulting output from the client side.

For example, I created a new admin user via xmcli called "scummins" with a public-key instead of a password:

xmcli (admin)> add-user-account usr-name="scummins" role=admin public-key="ssh-rsa "

Added User Account scummins [3]

Then from my Mac, I'm able to run individual commands and filter their output locally. In the example below, I'm ssh'ing to XMCLI and running 'show-leds'. I then capture the output of that command (on my Mac) and pipe it to grep and awk for filtering.

% ssh scummins@ show-leds |grep "SSD" |awk {'print $2')

wwn-0x5000cca02b372e58

wwn-0x5000cca02b133620

wwn-0x5000cca02b373130

wwn-0x5000cca02b373124

wwn-0x5000cca02b372edc

wwn-0x5000cca02b371ca0

wwn-0x5000cca02b3585f8

wwn-0x5000cca02b3681a0

wwn-0x5000cca02b3716a8

wwn-0x5000cca02b3681a4

wwn-0x5000cca02b371264

wwn-0x5000cca02b3714d0

wwn-0x5000cca02b371344

wwn-0x5000cca02b3514b8

wwn-0x5000cca02b372210

wwn-0x5000cca02b367d74

wwn-0x5000cca02b37390c

wwn-0x5000cca02b3768a4

wwn-0x5000cca02b366bcc

wwn-0x5000cca02b372fe4

wwn-0x5000cca02b355b74

wwn-0x5000cca02b367da4

wwn-0x5000cca02b367db4

wwn-0x5000cca02b369c68

wwn-0x5000cca02b358790


A couple other alternatives might be the XtremIO REST API, or the XMCLI client (which only runs on CentOS).


Hope that helps,


- Sean

727 Posts

March 4th, 2015 09:00

Our recommendation for these kind of integrations is always RestAPI. It is much easier to parse the outputs of RestAPI calls compared to CLI output.

5 Posts

March 17th, 2015 17:00

Hello, khkris-

To easily go the REST API route as seancummins and Avi suggest, you could use the Get-XIOSsd cmdlet in the XtremIO.Utils PowerShell module from vNugglets.com.  You connect to the given XMS appliance via the Connect-XIOServer cmdlet, and can then use Get-XIOSsd (or any of the other stack of cmdlets from the module) to get/create things for the XtremIO array managed by that XMS server.  The cmdlets in that module use the REST API provided by the XMS appliance.

The module (and some info about it) is available at http://www.vnugglets.com/2014/11/xtremioutils-powershell-module-general.html, and, for a few other posts about using the module, see http://www.vnugglets.com/search/label/XtremIO.  Enjoy

No Events found!

Top