• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 394
  • Last Modified:

Tool to Dump HA/DRS Complete configuration/setting in reporting Format..like in Excel sheet

Hi,
I am looking for  solution to fetch complete HA/DRS config..currently configured on on Vm Clsuter...

Is it possible to get from VC?

or if any other utilty/Pwoergui Plugin..?
0
patron
Asked:
patron
  • 16
  • 6
  • 4
4 Solutions
 
Sushant GulatiConsultantCommented:
Check out this link and it does work for me and take out the necessary information which is indeed needed. Please make sure to have PowerCLi 4.1 or the latest version to run this script.

http://www.virtu-al.net/2011/05/15/ha-and-drs-audit/

Download from here


Let me know if any confusion is still there..

Good Luck..!!
~SG~
0
 
patronAuthor Commented:
Thanks a Lot
0
 
patronAuthor Commented:
This helped me a lot..thanks again for sharing this.

do we have more script like this for Vmware/Physical Infra?
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
Sushant GulatiConsultantCommented:
What else are you looking for?
0
 
patronAuthor Commented:
m looking for solution to fetch status detail for multipathing on my esx/esxi/physical servers?

wether it is enabled or not..and if enabled how its working?

also can we have all snapshot detail as per folders we have on vcentere?
0
 
patronAuthor Commented:
please assist?
0
 
Sushant GulatiConsultantCommented:
I will check on it...
0
 
patronAuthor Commented:
k thanks, also...please assist how to use plugins there at :

http://www.virtu-al.net/vcheck-pluginsheaders/vcheck-plugins/

as m unable to run /execute..these.,any specicfic method i have to follow?
0
 
Sushant GulatiConsultantCommented:
Follow the vCheck Team, their blogs, they have enormous amount of scripts to diagnose anything on vCenter, vSphere, storage, arrays, CPU utilization...

This video will help...
http://vimeo.com/36411677

Download vCheck from here..
https://github.com/alanrenouf/vCheck-vSphere

Follow this link to get yourself familiar with vCheck. You on your own will start playing. It's fun.
http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/comment-page-28/#comment-27622

Good Luck..!!

~SG~
0
 
patronAuthor Commented:
Thanks a lot.

 did you check for that mutilating  query ?
0
 
patronAuthor Commented:
To check multpathing ..for all host there on VC
0
 
patronAuthor Commented:
*multipathing
0
 
patronAuthor Commented:
please advcie ,if we have any option to fetch data for multpathing status ..for all host there on vc/and is there any centralized option to fetch it for physical boxes under..a domain?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
fellow VMware vExpert LucD and PowerCLI expert has created a script to dump information into an Excel spreadsheet, which contains Datastore, File System, Connecticity Status, Multipathing, Capactity, Free space, Space Used, Snapshot Space, Virtual Disk Space, Swap space, - everything you need to know about your Storage Views.

this script will generate all you need to know

I'll not cut and paste, the script it's here

http://www.lucd.info/2011/11/14/storage-views-datastores/#more-3651
0
 
patronAuthor Commented:
Thanks a lot @ hanccocka .for sharing this great stuff

most of the times..am unable to run ps scripts due to signature issues..
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
You need to alter Powershell, configuration which is a new question, which the Experts will be glad to assist with.
0
 
patronAuthor Commented:
i am able to run it but there is no output after exécution completed..?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
What are you running and how?
0
 
patronAuthor Commented:
i ran given script as attached..and got it exceuted sucessfully

but no result
storageviews.ps1.txt
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
was this the script you download from this URL?

http://www.lucd.info/2011/11/14/storage-views-datastores/#more-3651


if so this script is a function, which you need to use the saved values into a report. See the bottom of the article

$dc = Get-Datacenter -Name MyDC
Get-StorageViewDatastore -Datacenter $dc |
Select-Object Datastore,"File System Type","Connectivity Status","Multipathing Status",
  @{N="Capacity";E={"{0,7:f2} {1,2}" -f $_.Capacity.Value,$_.Capacity.Unit}},
  @{N="Free Space";E={"{0,7:f2} {1,2}" -f $_.Free.Value,$_.Free.Unit}},
  @{N="Space Used";E={if($_.Used.Value){"{0,7:f2} {1,2}" -f $_.Used.Value,$_.Used.Unit}}},
  @{N="Snapshot Space";E={if($_.Snapshot.Value){"{0,7:f2} {1,2}" -f $_.Snapshot.Value,$_.Snapshot.Unit}}},
  @{N="Virtual Disk Space";E={if($_.vDisk.Value){"{0,7:f2} {1,2}" -f $_.vDisk.Value,$_.vDisk.Unit}}},
  @{N="Swap Space";E={if($_.Swap.Value){"{0,7:f2} {1,2}" -f $_.Swap.Value,$_.Swap.Unit}}},
  @{N="Other VM Space";E={if($_.Other.Value){"{0,7:f2} {1,2}" -f $_.Other.Value,$_.Other.Unit}}},
  @{N="Shared Space";E={if($_.Shared.Value){"{0,7:f2} {1,2}" -f $_.Shared.Value,$_.Shared.Unit}}} |
Export-Csv "C:\SV-MyDC.csv" -NoTypeInformation -UseCulture

Open in new window

0
 
patronAuthor Commented:
which one i have to use..?

the script you shared above or the large one i shared..earlier?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Both the first script is a function which collects the valued so will appear to do nothing this must be put through the second script to generate the output to a CSV file as per article
0
 
patronAuthor Commented:
Please can you advcie how should i proceed with these 3 scipst given in article

any modification required in any of script..?

ran large one first -exceuted -but no output..?
then tried to run script shoing above..status executing since almost 6 hours..and there is one file generated with no values named :SV-MyDC.csv..

Please help me to understand the way ..like how can i get result from this stuff..?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Okay, I've tested here.

You need to use VMware vSphere PowerCLI, execute VMware vSphere PowerCLI, until you get a PowerCLI prompt.

1. then issue a Connect-VIServer command, and connect to your vCenter Server.

2. In advance you will need to download all the scripts....

3. Cut and Paste this Function (script)

function Get-StorageViewDatastore{
<#
.SYNOPSIS  Retrieve the "Storage Views - Show all Datastores" values
.DESCRIPTION The function calculates and returns all the values
  that you get in the Storage Views - Show all Datastores panel.
.NOTES  Author:  Luc Dekens
.PARAMETER VMHost
  Specify the ESX(i) server for which you want to retrieve
  the Storage Views values.
.PARAMETER Cluster
  Specify the Cluster for which you want to retrieve
  the Storage Views values.
.PARAMETER Datacenter
  Specify the Datacenter for which you want to retrieve
  the Storage Views values.
.PARAMETER VM
  Specify the VM for which you want to retrieve
  the Storage Views values.
.PARAMETER ResourcePool
  Specify the ResourcePool for which you want to retrieve
  the Storage Views values.
.EXAMPLE
  PS> Get-StorageViewDatastore -VMHost MyCluster
.EXAMPLE
  PS> Get-Datacenter MyDC | Get-StorageViewDatastore
#>

  [CmdletBinding()]
  param(
  [parameter(ParameterSetName="VMHost",Mandatory = $true)]
  [PSObject]$VMHost,
  [parameter(ParameterSetName="Cluster",Mandatory = $true)]
  [PSObject]$Cluster,
  [parameter(ParameterSetName="Datacenter",Mandatory = $true)]
  [PSObject]$Datacenter,
  [parameter(ParameterSetName="VM",Mandatory = $true)]
  [PSObject]$VM,
  [parameter(ParameterSetName="ResourcePool",Mandatory = $true)]
  [PSObject]$ResourcePool
  )

  process{
    # Get the datastores and ESX(i) servers
    switch($PSCmdlet.ParameterSetName){
      "Datacenter" {
        if($Datacenter.GetType().Name -eq "String"){
          $Datacenter = Get-Datacenter -Name $Datacenter
        }
        $vms = Get-VM -Location $Datacenter
        $esx = Get-VMHost -Location $Datacenter
        $datastores = Get-Datastore -VMHost $esx
      }
      "Cluster" {
        if($Cluster.GetType().Name -eq "String"){
          $Cluster = Get-Cluster -Name $Cluster
        }
        $vms = Get-VM -Location $cluster
        $esx = Get-VMHost -Location $Cluster
        $datastores = Get-Datastore -VMHost $esx
      }
      "VMHost" {
        if($VMHost.GetType().Name -eq "String"){
          $VMHost = Get-VMHost -Name $VMHost
        }
        $vms = Get-VM -Location $VMHost
        $esx = $VMHost
        $datastores = Get-Datastore -VMHost $VMHost
      }
      "VM" {
        if($VM.GetType().Name -eq "String"){
          $VM = Get-VM -Name $VM
        }
        $vms = $vm
        $esx = $vm.VMHost
        $datastores = Get-Datastore -Name ($vms | Get-HardDisk -DiskType flat | %{$_.Filename.Split(']')[0].TrimStart('[')} | Sort-Object -Unique) | Sort-Object -Property Name
      }
      "ResourcePool" {
        if($ResourcePool.GetType().Name -eq "String"){
          $ResourcePool = Get-ResourcePool -Name $ResourcePool
        }
        $vms = Get-VM -Location $ResourcePool
        $esx = $vms  | %{$_.VMHost} | Sort-Object -Property Name -Unique
        $datastores = Get-Datastore -Name ($vms | Get-HardDisk -DiskType flat | %{$_.Filename.Split(']')[0].TrimStart('[')} | Sort-Object -Unique) | Sort-Object -Property Name
      }
    }

    # Create some helper collections
    $esxMoRef = $esx | %{$_.ExtensionData.MoRef}
    $vmMoRef = $vms | %{$_.ExtensionData.MoRef}

    # Set up a HBA hash table
    $hbaFCNodeWWN = @{}
    Get-VMHostHba -VMHost $esx -Type FibreChannel | %{
      $hbaFCNodeWWN["{0:X}" -f $_.NodeWorldWideName] = 0
    }

    # Handle all datastores
    foreach($ds in $datastores){
      $mpStatus = $usedSpace = $snapSpace = ""
      if($ds.Type -eq "VMFS"){
        $lun = $ds.ExtensionData.Info.Vmfs.Extent | %{$_.DiskName} |
          %{Get-ScsiLun -CanonicalName $_ -VmHost $esx -ErrorAction SilentlyContinue}
        $hbaFCCopy = $hbaFCNodeWWN.Clone()
        # Count Active and Standby paths
        # If there are 2 or more paths, the multi-path status is fully redundant
        Get-ScsiLunPath -ScsiLun $lun | where {"Active" ,"Standby" -contains $_.State} | %{
          $hbaFCCopy[$_.LunPath.Split(':')[0].Split('.')[1]] += 1
        }
        if(($hbaFCCopy.Values | where {$_} | Measure-Object).Count -gt 1){
          $mpStatus = "Full Redundancy"
        }
        else{
          $mpStatus = "Partial/No Redundancy"
        }
      }

      # Get the total used, snapshot, swap, shared and other space
      $usedSpace = 0
      $snapSpace = 0
      $vdiskSpace = 0
      $swapSpace = 0
      $otherSpace = 0
      $sharedSpace = 0
      if($ds.ExtensionData.Vm){
        Get-View $ds.ExtensionData.Vm | where {$vmMoRef -contains $_.MoRef -and $esxMoRef -contains $_.Runtime.Host} | %{
          $snapIndex = @()
          $dsPattern = '\[' + $ds.Name + '\]'
          $usedSpace += ($_.Storage.PerDatastoreUsage | where {$_.Datastore -eq $ds.ExtensionData.MoRef}).Committed
          if($_.LayoutEx.Snapshot){
            $snapIndex = $_.layoutEx.Disk | %{$_.Chain[1..($_.Chain.Count - 1)]} | %{$_.FileKey}
          }
          $snapIndex += $_.layoutEx.File | where {"snapshotList","snapshotData" -contains $_.Type -and $_.Name -match $dsPattern} | %{$_.Key}
          if($snapIndex){
            $snapSpace += ($_.LayoutEx.File | where {$snapIndex -contains $_.Key -and $_.Name -match $ds.Name} | Measure-Object -Property Size -Sum).Sum
          }
          $vdiskIndex = $_.layoutEx.File | where {"diskDescriptor","diskExtent" -contains $_.Type -and $_.Name -match $dsPattern} | %{$_.Key}
          if($vdiskIndex){
            $vdiskSpace += ($_.LayoutEx.File | where {$vdiskIndex -contains $_.Key} | Measure-Object -Property Size -Sum).Sum
          }
          $swapIndex = $_.LayoutEx.File | where {$_.Type -eq "swap" -and $_.Name -match $dsPattern} | %{$_.Key}
          if($swapIndex){
            $swapSpace += ($_.LayoutEx.File | where {$swapIndex -contains $_.Key} | Measure-Object -Property Size -Sum).Sum
          }
          $otherIndex = $_.LayoutEx.File | where {"log","config","extendedConfig","nvram","core" -contains $_.Type -and $_.Name -match $dsPattern} | %{$_.Key}
          if($otherIndex){
            $otherSpace += ($_.LayoutEx.File | where {$otherIndex -contains $_.Key} | Measure-Object -Property Size -Sum).Sum
          }
          $vmds = $_.Storage.PerDatastoreUsage | where {$_.Datastore -eq $ds.ExtensionData.MoRef}
          if($vmds){
            $sharedSpace += ($vmds.Committed - $vmds.Unshared)
          }
        }
      }

      # Collect all values for Storage Views - Datastores
      New-Object PSObject -Property @{
        VMHost = $esx.Name
        Datastore = $ds.Name
        "File System Type" = $ds.Type.Replace("NFS","NAS")
        "Connectivity Status" = &{if($ds.Accessible){"Up"}else{"Down"}}
        "Multipathing Status" = $mpStatus
        Capacity = Get-FriendlyUnit -Value ($ds.CapacityMB * 1MB)
        Free = Get-FriendlyUnit -Value ($ds.FreeSpaceMB * 1MB)
        Used = Get-FriendlyUnit -Value $usedSpace
        Snapshot = Get-FriendlyUnit -Value $snapSpace
        vDisk = Get-FriendlyUnit -Value ($vdiskSpace - $snapSpace)
        Swap = Get-FriendlyUnit -Value $swapSpace
        Other = Get-FriendlyUnit -Value $otherSpace
        Shared = Get-FriendlyUnit -Value $sharedSpace
      }
    }
  }
}

Open in new window


Save the above as ‘DSView.ps1'

4. Cut and Paste this function and save as FriendlyUnit.ps1

function Get-FriendlyUnit{
<#
.SYNOPSIS  Convert numbers into smaller binary multiples
.DESCRIPTION The function accepts a value and will convert it
  into the biggest binary unit available.
.NOTES  Author:  Luc Dekens
.PARAMETER Value
  The value you want to convert.
  This number must be positive.
.PARAMETER IEC
  A switch to indicate if the function shall return the IEC
  unit names, or the more commonly used unit names.
  The default is to use the commonly used unit names.
.EXAMPLE
  PS> Get-FriendlyUnit -Value 123456
.EXAMPLE
  PS> 123456 | Get-FriendlyUnit -IEC
.EXAMPLE
  PS> Get-FriendlyUnit -Value 123456,789123, 45678
#>
  param(
  [CmdletBinding()]
  [parameter(Mandatory = $true, ValueFromPipeline = $true)]
  [double[]]$Value,
  [switch]$IEC
  )

  begin{
    $OldUnits = "B","KB","MB","GB","TB","PB","EB","ZB","YB"
    $IecUnits = "B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"
    if($IEC){$units = $IecUnits}else{$units=$OldUnits}
  }

  process{
    $Value | %{
      if($_ -lt 0){
        write-Error "Numbers must be positive."
        break
      }
      if($value -gt 0){
        $modifier = [math]::Floor([Math]::Log($_,1KB))
      }
      else{
        $modifier = 0
      }
      New-Object PSObject -Property @{
        Value = $_ / [math]::Pow(1KB,$modifier)
        Unit = &{if($modifier -lt $units.Count){$units[$modifier]}else{"1KB E{0}" -f $modifier}}
      }
    }
  }
}

Open in new window


5.  Cut and Paste, and save as Report.ps1, make sure you change the path for your CSV, and also change the MyDC to your Datacentre name in vCenter.

$dc = Get-Datacenter -Name MyDC
Get-StorageViewDatastore -Datacenter $dc |
Select-Object Datastore,"File System Type","Connectivity Status","Multipathing Status",
  @{N="Capacity";E={"{0,7:f2} {1,2}" -f $_.Capacity.Value,$_.Capacity.Unit}},
  @{N="Free Space";E={"{0,7:f2} {1,2}" -f $_.Free.Value,$_.Free.Unit}},
  @{N="Space Used";E={if($_.Used.Value){"{0,7:f2} {1,2}" -f $_.Used.Value,$_.Used.Unit}}},
  @{N="Snapshot Space";E={if($_.Snapshot.Value){"{0,7:f2} {1,2}" -f $_.Snapshot.Value,$_.Snapshot.Unit}}},
  @{N="Virtual Disk Space";E={if($_.vDisk.Value){"{0,7:f2} {1,2}" -f $_.vDisk.Value,$_.vDisk.Unit}}},
  @{N="Swap Space";E={if($_.Swap.Value){"{0,7:f2} {1,2}" -f $_.Swap.Value,$_.Swap.Unit}}},
  @{N="Other VM Space";E={if($_.Other.Value){"{0,7:f2} {1,2}" -f $_.Other.Value,$_.Other.Unit}}},
  @{N="Shared Space";E={if($_.Shared.Value){"{0,7:f2} {1,2}" -f $_.Shared.Value,$_.Shared.Unit}}} |
Export-Csv "C:\SV-MyDC.csv" -NoTypeInformation -UseCulture

Open in new window


6. these fucntions need to be known to the powershell engine, so type

. .\DSView.ps1
. .\FriendlyUnit.ps1

followed by ./Report.ps1

this will create the CSV report
0
 
patronAuthor Commented:
Thanks a lot. ll try and confirm
0
 
patronAuthor Commented:
Thanks for all your support on this
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 16
  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now