Solved

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

Posted on 2013-06-05
29
361 Views
Last Modified: 2013-09-12
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
Comment
Question by:patron
  • 16
  • 6
  • 4
29 Comments
 
LVL 7

Assisted Solution

by:susguperf
susguperf earned 125 total points
ID: 39224501
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
 
LVL 1

Author Comment

by:patron
ID: 39225521
Thanks a Lot
0
 
LVL 1

Author Comment

by:patron
ID: 39236712
This helped me a lot..thanks again for sharing this.

do we have more script like this for Vmware/Physical Infra?
0
 
LVL 7

Expert Comment

by:susguperf
ID: 39240734
What else are you looking for?
0
 
LVL 1

Author Comment

by:patron
ID: 39281681
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
 
LVL 1

Author Comment

by:patron
ID: 39289072
please assist?
0
 
LVL 7

Expert Comment

by:susguperf
ID: 39291581
I will check on it...
0
 
LVL 1

Author Comment

by:patron
ID: 39292176
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
 
LVL 7

Expert Comment

by:susguperf
ID: 39294719
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
 
LVL 1

Author Comment

by:patron
ID: 39301231
Thanks a lot.

 did you check for that mutilating  query ?
0
 
LVL 1

Author Comment

by:patron
ID: 39312834
To check multpathing ..for all host there on VC
0
 
LVL 1

Author Comment

by:patron
ID: 39312835
*multipathing
0
 
LVL 1

Author Comment

by:patron
ID: 39335877
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 117

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE)
Andrew Hancock (VMware vExpert / EE MVE) earned 375 total points
ID: 39392458
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
 
LVL 1

Author Comment

by:patron
ID: 39418258
Thanks a lot @ hanccocka .for sharing this great stuff

most of the times..am unable to run ps scripts due to signature issues..
0
 
LVL 117
ID: 39418347
You need to alter Powershell, configuration which is a new question, which the Experts will be glad to assist with.
0
 
LVL 1

Author Comment

by:patron
ID: 39420646
i am able to run it but there is no output after exécution completed..?
0
 
LVL 117
ID: 39420842
What are you running and how?
0
 
LVL 1

Author Comment

by:patron
ID: 39420888
i ran given script as attached..and got it exceuted sucessfully

but no result
storageviews.ps1.txt
0
 
LVL 117

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE)
Andrew Hancock (VMware vExpert / EE MVE) earned 375 total points
ID: 39420950
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
 
LVL 1

Author Comment

by:patron
ID: 39421084
which one i have to use..?

the script you shared above or the large one i shared..earlier?
0
 
LVL 117
ID: 39421236
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
 
LVL 1

Author Comment

by:patron
ID: 39422117
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
 
LVL 117

Accepted Solution

by:
Andrew Hancock (VMware vExpert / EE MVE) earned 375 total points
ID: 39422862
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
 
LVL 1

Author Comment

by:patron
ID: 39424336
Thanks a lot. ll try and confirm
0
 
LVL 1

Author Closing Comment

by:patron
ID: 39489288
Thanks for all your support on this
0

Featured Post

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Join & Write a Comment

This is an issue that we can get adding / removing permissions in the vCSA 6.0. We can also have issues searching for users / groups in the AD (using your identify sources). This is how one of the ways to handle this issues and fix it.
Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
Teach the user how to use create log bundles for vCenter Server or ESXi hosts Open vSphere Web Client: Generate vCenter Server and ESXi host log bundle:  Open vCenter Server Appliance Web Management interface and generate log bundle: Open vCenter Se…
Teach the user how to use vSphere Update Manager to update the VMware Tools and virtual machine hardware version Open vSphere Client: Review manual processes for updating VMware Tools and virtual hardware versions: Create a new baseline group in vSp…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now