search
top

How To Get XtremIO Volume Data Using PowerShell and XtremLib

Introduction

In an earlier post we introduced the XtremIO PowerShell modules available for download and use from EMC. We covered a few of the basic cmdlets available. In this post we will look at Using the Get-XtremVolumes cmdlet to create a capacity report for specific volumes.

Getting Started

If you have followed the post earlier you should have the certs and the XtremLib PowerShell modules installed and ready on your system. If not please refer to the post and get setup.

Our objective is to get a list of the Volumes and display the properties for Logical Space in Use and Volume Size and display the output in GB with the option to save as an CSV file.

 

The Code

If we look at the code we can see that there is really not a lot needed. Most of the work is in converting the output of the sizes to GB. Which from the code example this can be re-used in future scripts.

So let us break down the code.

First we need to import the XtremLib module.

Next, we need to create a session with XMS (XtremIO Management Server). Change the values in <> to you server and credentials.

New-XtremSession -XmsName <XMS Name> –Username <user> –Password <password>

Final statement is to use the Get-XtremVolumes cmdlet and display Name, Vol-size and logical-space-in-use properties. Minus the conversions our output will look like this.

get-xtremvolumes1

Not very readable, so let us use a few expressions to clean it up. PowerShell allows us to do this pretty easy. From the example above we see two ways. the first for vol-size the output has no decimal places as the volumes were created as such. so using the @{Name=”Volume Size GB”;E={($_.’vol-size’/1MB)}}. We are dividing the value by MB. Now our output looks better.

get-xtremvolumes2

 

For Logical Space In Use we have a long string of decimals so we will need to use {0:N} and the -as [float] we can get the output to no more than two after the decimal point in the conversion. Here is how we achieve it.

So adding to the rest of our string we get.

and the final outcome?

xiovol3

Final step is to give the script the ability to save the output to csv. We achieve this by adding | Export-Csv -Path c:\temp\xiocapacity.csv.

Conclusion

With a few commands using PowerShell and the XtremLib modules we have created a capacity report that can be saved to CSV format and usable for any manager or yourself needing report data from you XIO.

 

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