30 November 2014

XtremIO PowerShell Module Updated -- v0.7.0 available

XtremIO + PowerShell!Even more updates!  Version 0.7.0 of the XtremIO.Utils PowerShell module is now available.  This release brings some great new features, like superior handling of credentials (via new Connect-XIOServer and Disconnect-XIOServer cmdlets), the rest of the New-XIO* cmdlets for creating items in the XtremIO configuration, and new performance-related cmdlets for focusing in on XtremIO performance reporting from several different aspects.

You can read about the new features available in each updated release in the docs in the repo at https://github.com/mtboren/XtremIO.Utils. We have also made a new general information page for this PowerShell module (like how to get it, how to install it, credentials handling). One can find this info page in the Sticky Posts section at the right, too. Or, if you just want at the module immediately, you can download it from https://github.com/mtboren/XtremIO.Utils/releases/download/Latest/XtremIO.Utils.zip.
Once you have read those items, let us get to some examples!

Connect to a couple of XMS servers:
PS vN:\> Connect-XIOServer -Credential $credMe -ComputerName somexms01.dom.com,somexms02.dom.com -TrustAllCert

ComputerName             ConnectDatetime               Port
------------             ---------------               ----
somexms01.dom.com        11/30/2014 1:54:02 PM         443
somexms02.dom.com        11/30/2014 1:54:02 PM         443

Note: this allows for the rest of the subsequent XIO cmdlet calls to be used without presenting credentials again to the cmdlet -- the cmdlets will use the given XIO connection(s) and corresponding connection credentials! Yes, that also means that you need not supply the XMS name each subsequent call: the default, connected XMS servers will be used, unless otherwise specified by the user.

Get the cluster performance information for all XIO clusters managed by the XMS servers:
PS vN:\> Get-XIOClusterPerformance

Name        WriteBW_MBps   WriteIOPS    ReadBW_MBps   ReadIOPS   BW_MBps      IOPS     TotWriteIOs  TotReadIOs
----        ------------   ---------    -----------   --------   -------      ----     -----------  ----------
somexms01   6.057          771          41.768        531        47.824       1302     4664182545   3886061537
somexms02   67.480         2783         238.808       5286       306.288      8069     31163303937  81948491968

Create a new initiator in initiator group "myserver0" on array managed by "somexms02":
PS vN:\> New-XIOInitiator -Name myserver0-hba2 -InitiatorGroup myserver0 -PortAddress 0x100000000000ab56 -ComputerName somexms02.dom.com

Name                   PortAddress                   PortType              IOPS
----                   -----------                   --------              ----
myserver0-hba2         10:00:00:00:00:00:ab:56       fc                    0

Create a new LUN maps on array managed by "somexms02":
PS vN:\> New-XIOLunMap -Volume myVolume02 -InitiatorGroup myserver0,myserver1 -HostLunId 50 -ComputerName somexms02.dom.com

VolumeName          LunId           InitiatorGroup           tg-name
----------          -----           --------------           -------
myVolume02          50              myserver0                Default
myVolume02          50              myserver1                Default

A couple of Get-XIOEvent examples:
PS vN:\> Get-XIOEvent

EventID  DateTime               Severity     EntityDetails      Description
-------  --------               --------     -------------      -----------
2267     11/30/2014 10:39:29 PM information  myVolume02 [1]     Mapped LUN 50 to Volume myVolume02 TG Defa...
2266     11/30/2014 10:39:29 PM information                     User: vNuggsUser, Command: maplun, Argumen...
...
27672    11/30/2014 1:37:41 PM  information  someVolume03       Small block (blocks smaller than 4KB) IO r...
27671    11/30/2014 1:17:05 PM  information                     External user 'vNuggsUser' authenticated w...
...


PS vN:\> Get-XIOEvent -Category activity -Severity information -EntityType BatteryBackupUnit -Start "11 oct 2014" -End "14 nov 2014 8am"

EventID  DateTime               Severity     EntityDetails   Description
-------  --------               --------     -------------   -----------
195      11/11/2014 9:29:30 PM  information  X2-BBU [2]      Added new Battery Backup Unit - UPS[2] "X2-BB...
193      11/11/2014 9:29:30 PM  information  X1-BBU [1]      Added new Battery Backup Unit - UPS[1] "X1-BB...

While it was quite a bit of doing to make this release happen, the new features are well worth it, and it was quite fun along the way. Now to keep the creativity flowing: on to the next update, in which better pipeline support is one of the targets. Until then, enjoy!

XtremIO.Utils PowerShell Module General Info

XtremIO + PowerShell!Herein lies much of the supporting/side information about this PowerShell module that has been written throughout the related vNugglets posts.  The intention, however, is to create this more central spot for this info, instead of people having to sift through the previous posts to get all of these tidbits. To read about the latest additions and changes, one can refer to the change log and the ReadMe (which are available in the module itself, too).
* Update 15 Nov 2015:
Updated links to changelog and readme to be to GitHub, as well as the link to the PowerShell module itself
* end of 15 Nov 2015 update

Module availability:

One can get the XtremIO.Utils module in a couple of ways:
  • via the supercool module PsGet, so installing/updating the module becomes a snap for PsGet module users.  The quick how-to on using PsGet to install the XtremIO.Utils module:
    PS vN:\> Install-Module -Verbose -Module XtremIO.Utils
    
    
    Or, to update the existing version you may already have:
    PS vN:\> Update-Module -Verbose -Module XtremIO.Utils
    
    
  • Or, if you like the "old fashioned" module management route (of manually handling the module grab), you can always follow the steps:
    1. download from latest and greatest! https://github.com/mtboren/XtremIO.Utils/releases/download/Latest/XtremIO.Utils.zip
    2. unzip somewhere you like (like, say, in Join-Path ${env:\userprofile} "Documents\WindowsPowerShell\Modules")
    3. you should now have a folder named <pathToModules>\XtremIO.Utils, in which the PowerShell files reside (see note below about using Unblock-File, since this module is not yet Authenticode signed)
    4. Import-Module <pathToModules>\XtremIO.Utils

Unblock-File discussion:

One of the other "features" of this module:  we have not yet set the Authenticode signature for it.  That is, it is unsigned.  We went back and forth on the solution:
  • buy a legit cert for code signing (best solution, but $$$)
  • sign it with a self-signed cert (which still leads to a prompt of 'Do you want to run software from this untrusted publisher?' when you try to import the module, since everyone is security-minded and has at least the RemoteSigned execution policy set on their machines)
  • ✔ do not add a signature, and make mention that you will need to Unblock-File the files in the module (after careful inspection of the files to make sure that there is nothing dangerous in there; but, we're talking about vNugglets, here -- you can trust us, right?!  a:  No.  Trust no one)
So, since we went with the last option there, below is the quick/easy way to unblock files.  But, again, this should only be done when you trust the code in the files that you are unblocking -- inspecting the files is for your own good.  Anyway, the unblock command:
PS vN:\> Get-ChildItem <pathToModules>\XtremIOInfo | Unblock-File


Credentials discussion:

Credentials come into play in a couple of ways in this module.  One can use the New-XIOStoredCred cmdlet to store one credential persistently on disk.  And, the use of the Connect-XIOServer cmdlet holds credentials in a variable, only for the duration of the PowerShell session (and, only while connected to any XIO servers).

Stored credentials are encrypted using the Windows Data Protection API, via a derivative of HalR9000's Export-PSCredential.  If the encrypted credential file is found at runtime of any of the module's functions that require credentials, the credentials will be imported from said file transparently.

Decryption of the encrypted credentials can only be performed by the user account that performed the encryption, and on the same computer on which the encryption was performed.  This module stores the credential file in the ${env:temp} directory by default, and this location is configurable as desired.

If no credentials are specified to the functions of this module, the given function will look for the credential file in the configured location.  If none exists, the functions behave as before:  they will prompt for credentials as necessary.  And, you can get the stored credential with Get-XIOStoredCred, and remove it from disk, if you would like, with Remove-XIOStoredCred.