VMware Cloud Community
TheVMinator
Expert
Expert

Merge VMware and NetApp VM information

I have a report that lists information for virtual machines in vCenter:

get-vm | select name, numcpu, memorygb, provisionedspacegb

However, each VM is also connecting to an iSCSI LUN on NetApp at the OS level using an iSCSI initiator

I need to figure out the size of the iSCSI LUN that this VM connects to at the OS level, then merge that with my existing columns.

When I'm done I need to have a report like this:

NameNUMCPUMemoryGB
ProvisionedSpaceGB
iSCSI LUN Size

I've got the Netapp PowerShell toolkit installed

NetApp PowerShell Toolkit 4.7 released! - NetApp Community

Has anyone successfully done something like this - taken VM data from vCenter and data from NetApp, and combined them into a single report that pulls data both from vCenter and from NetApp?

0 Kudos
3 Replies
LucD
Leadership
Leadership

Have you tried this solution frlom the NetApp forum?

Import-Module DataONTAP

Connect-VIServer your.vcenter

Connect-NcController your.cdot.system


$naluns = Get-NcLun

$ds = Get-Datastore | ? { $_.Type -eq "VMFS" }


$ds | % {

   Write-Host "Finding LUNs for datastore $($_.Name)"

   $luns = $_ | Get-ScsiLun | ? { $_.CanonicalName -match "naa.600a0980*" }


   if ($luns.length -gt 0) {

   Write-Host "  Found $($luns.length) paths"

   $completed = @()


   $luns | % {

   if (!$completed.Contains($_.CanonicalName)) {

   $hexSerial = ($_.CanonicalName).Substring(12)

   $serial = for ($i = 0; $i -lt $hexSerial.length; $i += 2) {

   [char][int]::Parse($hexSerial.substring($i, 2), 'HexNumber')

   }


   $ntapSerial = $serial -join ""

   Write-Host "  NetApp LUN serial is: $($ntapSerial)"


   $ntapLun = $naluns | ? { $_.SerialNumber -eq $ntapSerial }

   Write-Host "  NetApp SVM: $($ntapLun.Vserver)"

   Write-Host "  LUN Path: $($ntapLun.Path)"

   $completed += $_.CanonicalName

   }

   }

   }

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

TheVMinator
Expert
Expert

Luc thanks so much. This is very close to what I’m trying to do.   However it is slightly different. In the script you posted, it is associating VMFS data store Objects in Vcenter with LUNs in NetApp.   What I’m actually trying to do is associate operating system drives in an operating system within windows with iSCSI LUNs In the NetApp controller.

For example in Windows you can use the NetApp Snapdrive software to connect the operating system to a NetApp iSCSI LUN and mount it say as a 😧 drive to windows.  Windows then formats the LUN with the NTFS file system and then it can become a 😧 drive the OS can use.  vCenter isn’t aware This happened.  However if VMware tools are installed, then Whatever view inside the OS was available about a D drive could be picked up by VMware tools.  Somehow I’ve got to be able to associate the OS drive with the iSCSI LUN that backs it, and list for each VM in vCenter this info in the format of the table I posted above.

(i think SnapDrive, the NetApp software that installs in Windows and creates these Os level iSCSI connections to NetApp might have its own management server as well - not sure if PowerShell could connect to it to help merge these pieces of data)

Any suggestions?

0 Kudos
LucD
Leadership
Leadership

I'm afraid not, I don't have a NetApp box at my disposal.

But I would suggest to ask your question also on the NetApp forum.
You might have better luck there.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos