Is there a way with NTNX Powershell cmdlets to collect software inventory data for all registered clusters? Something like;
- Cluster Name
- AOS version
- Foundation version
- NCC version
- Hypervisor version
Thanks!
Is there a way with NTNX Powershell cmdlets to collect software inventory data for all registered clusters? Something like;
Thanks!
I just wrote a script for gathering that information and more. I did not see Foundation in the available list of attributes though.
Disconnect-NTNXCluster *
Connect-NTNXCluster -Server $PCentral -Username $MyCreds.Username -Password $MyCreds.Password -AcceptInvalidSSLCerts -ForcedConnection | Out-Null
$NClusterList = Get-NTNXCluster | Sort name
# Disconnect from Prism Central now, we will make connections to Prism Elements
Disconnect-NTNXCluster *
WriteLog "" 1 "White"
WriteLog "" 1 "White"
ForEach ($NCluster in $NClusterList)
{
WriteLog ("Connecting to " + $NCluster.name + "...") 1 "White"
$NClusterDetails = "" | Select Cluster, PC, UUID, ExternalIPAddress, DataServicesIPAddress, timezone, Nodes, blockSerials, version, fullVersion, targetVersion, `
externalSubnet, internalSubnet, nccVersion, nameServers, ntpServers, hypervisorTypes, cpuCapacity, cpuppm, cpuUsed, memoryCapacity, memoryppm, `
memoryUsed, TotalVMs, PStorageCapacity, PStorageUsed, PStorageppm, PStorageFree, LStorageCapacity, LStorageUsed, LStorageppm, LStorageFree, `
AOStxtver, NCCtxtver
$NClusterDetails.PC = $PCentral
$NClusterDetails.Cluster = $NCluster.name
$NClusterDetails.UUID = $NCluster.uuid
$NClusterDetails.ExternalIPAddress = $NCluster.clusterExternalIPAddress
$NClusterDetails.DataServicesIPAddress = $NCluster.clusterExternalDataServicesIPAddress
$NClusterDetails.timezone = $NCluster.timezone
$NClusterDetails.Nodes = $NCluster.numNodes
$NClusterDetails.blockSerials = $NCluster.blockSerials -Join ","
$NClusterDetails.version = $NCluster.version
$AOSver = $NCluster.version.split(".")
For($i = $AOSver.count + 1; $i -le 4; $i++) { $AOSver += "0" }
$NClusterDetails.AOStxtver = "{0:d2}" -f $AOSvere0].ToInt16($Culture) + "{0:d2}" -f $AOSvere1].ToInt16($Culture) + "{0:d2}" -f $AOSvere2].ToInt16($Culture) + "{0:d2}" -f $AOSvere3].ToInt16($Culture)
$NClusterDetails.fullVersion = $NCluster.fullVersion
$NClusterDetails.targetversion = $NCluster.targetVersion
$NClusterDetails.externalSubnet = $NCluster.externalSubnet
$NClusterDetails.internalSubnet = $NCluster.internalSubnet
$NClusterDetails.nccVersion = $NCluster.nccVersion
$NCCver = $NCluster.nccVersion.SubString(4).Split(".")
For($i = $NCCver.count + 1; $i -le 4; $i++) { $NCCver += "0" }
$NClusterDetails.NCCtxtver = "{0:d2}" -f $NCCvere0].ToInt16($Culture) + "{0:d2}" -f $NCCvere1].ToInt16($Culture) + "{0:d2}" -f $NCCvere2].ToInt16($Culture) + "{0:d2}" -f $NCCvere3].ToInt16($Culture)
$NClusterDetails.nameServers = $NCluster.nameServers -Join ","
$NClusterDetails.ntpServers = $NCluster.ntpServers -Join ","
$NClusterDetails.hypervisorTypes = $NCluster.hypervisorTypes -Join ","
# Connect to Prism Element
$PrismElement = $NCluster.clusterExternalIPAddress
IF ($PrismElement -eq "137.237.156.152") { $PrismElement = "ushrv1ntx.cs.myharris.net" } # Bypass firewall issues with HRV-Production-1
IF ($PrismElement -eq "137.237.200.100") { $PrismElement = "gblon1ntxcl1.cs.myharris.net" } # LON-Production-1 won't connect via IP address
Connect-NTNXCluster -Server $PrismElement -Username $MyCreds.Username -Password $MyCreds.Password -AcceptInvalidSSLCerts -ForcedConnection | Out-Null
$NHostList = Get-NTNXHost | Sort Name
# Collect CPU and RAM details for the cluster
$TotalVMs = 0
$TotalCPU = 0
$TotalCPUUsed = 0
$TotalRAM = 0
$TotalRAMUsed = 0
ForEach ($NHost in $NHostList)
{
WriteLog (" Processing " + $NHost.name + "...") 1 "White"
$NHostDetails = "" | Select Cluster, PC, Name, UUID, CVMIP, ipmiAddress, serial, blockModelName, MaintMode, hypervisorState, state, cpuModel, numCpuCores, numCpuThreads, `
numCpuSockets, cpuFreq, cpuCapacity, memoryCapacity, hypervisorFullName, hypervisorType, numVMs, cpuppm, cpuused, ramppm, ramused, ESXtxtver
$NHostDetails.PC = $PCentral
$NHostDetails.Cluster = $NCluster.name
$NHostDetails.Name = $NHost.name
$NHostDetails.UUID = $NHost.uuid
$NHostDetails.CVMIP = $NHost.controllerVmBackplaneIp
$NHostDetails.ipmiAddress = $NHost.ipmiAddress
$NHostDetails.serial = $NHost.serial
$NHostDetails.blockModelName = $NHost.blockModelName
$NHostDetails.MaintMode = $NHost.hostInMaintenanceMode
$NHostDetails.hypervisorState = $NHost.hypervisorState
$NHostDetails.state = $NHost.state
$NHostDetails.cpuModel = $NHost.cpuModel
$NHostDetails.numCpuCores = $NHost.numCpuCores
$NHostDetails.numCpuThreads = $NHost.numCpuThreads
$NHostDetails.numCpuSockets = $NHost.numCpuSockets
$NHostDetails.cpuFreq = =MATH]::Round($NHost.cpuFrequencyInHz/1000/1000/1000,2)
$NHostDetails.cpuCapacity = =MATH]::Round($NHost.cpuCapacityinHz/1000/1000/1000,2)
$NHostDetails.memoryCapacity = =MATH]::Round($NHost.memoryCapacityInBytes/1GB,2)
$NHostDetails.hypervisorFullName = $NHost.hypervisorFullName
$ESXver = $NHost.hypervisorFullName
IF ($ESXver -match "ESXi") { $NHostDetails.ESXtxtver = $ESXver.SubString($ESXver.indexof("build-")+6) }
IF ($ESXver -match "Nutanix") { $NHostDetails.ESXtxtver = $ESXver.SubString($ESXver.IndexOf("Nutanix ")+8) }
$NHostDetails.hypervisorType = $NHost.hypervisorType
$NHostDetails.numVMs = $NHost.numVMs
$NHostDetails.cpuppm = =MATH]::Round($NHost.stats.hypervisor_cpu_usage_ppm/100,2)
$NHostDetails.cpuused = =MATH]::Round(($NHost.stats.hypervisor_cpu_usage_ppm/1000000)*($NHost.cpuCapacityinHz/1000/1000/1000),2)
$NHostDetails.ramppm = =MATH]::Round($NHost.stats.hypervisor_memory_usage_ppm/100,2)
$NHostDetails.ramused = MATH]::Round(($NHost.stats.hypervisor_memory_usage_ppm/1000000)*($NHost.memoryCapacityInBytes/1GB),2)
$TotalVMs += $NHostDetails.numVMs
$TotalCPU += $NHostDetails.cpuCapacity
$TotalCPUUsed += $NHostDetails.cpuused
$TotalRAM += $NHostDetails.memoryCapacity
$TotalRAMUsed += $NHostDetails.ramused
$NHostDetailsList += $NHostDetails
}
$NClusterDetails.TotalVMs = $TotalVMs
$NClusterDetails.cpuCapacity = =MATH]::Round($TotalCPU,2)
$NClusterDetails.cpuppm = =MATH]::Round($TotalCPUUsed/$TotalCPU,2)
$NClusterDetails.cpuUsed = =MATH]::Round($TotalCPUUsed,2)
$NClusterDetails.memoryCapacity = =MATH]::Round($TotalRAM,2)
$NClusterDetails.memoryppm = =MATH]::Round($TotalRAMUsed/$TotalRAM,2)
$NClusterDetails.memoryUsed = =MATH]::Round($TotalRAMUsed,2)
# Collect storage pool details for the cluster
$SPool = Get-NTNXStoragePool
$NClusterDetails.PStorageCapacity = =MATH]::Round($NCluster.usageStats.("storage.capacity_bytes")/1TB,2)
$NClusterDetails.PStorageUsed = =MATH]::Round($NCluster.usageStats.("storage.usage_bytes")/1TB,2)
$NClusterDetails.PStorageppm = =MATH]::Round(($NCluster.usageStats.("storage.usage_bytes")/$NCluster.usageStats.("storage.capacity_bytes")),2)
$NClusterDetails.PStorageFree = =MATH]::Round($NCluster.usageStats.("storage.free_bytes")/1TB,2)
# Collect storage container details for the cluster
$LTotalStorage = 0
$LTotalUsed = 0
$LTotalFree = 0
$NContainerList = Get-NTNXContainer
ForEach ($NContainer in $NContainerList)
{
$NContainerDetails = "" | Select Cluster, PC, Name, UUID, ReplicationFactor, erasureCode, onDiskDedupe, compression, softwareEncryption, LogicalCapacity, `
LogicalUsed, Logicalppm, LogicalFree
$NContainerDetails.PC = $PCentral
$NContainerDetails.Cluster = $NCluster.name
$NContainerDetails.Name = $NContainer.name
$NContainerDetails.UUID = $NContainer.containerUuid
$NContainerDetails.ReplicationFactor = $NContainer.replicationFactor
$NContainerDetails.erasureCode = $NContainer.erasureCode
$NContainerDetails.onDiskDedupe = $NContainer.onDiskDedup
$NContainerDetails.compression = $NContainer.compressionEnabled
$NContainerDetails.softwareEncryption = $NContainer.enableSoftwareEncryption
$NContainerDetails.LogicalCapacity = =MATH]::Round($NContainer.usageStats.("storage.capacity_bytes")/1TB/$NContainer.replicationFactor,2)
$NContainerDetails.LogicalUsed = =MATH]::Round($NContainer.usageStats.("storage.usage_bytes")/1TB/$NContainer.replicationFactor,2)
$NContainerDetails.Logicalppm = =MATH]::Round($NContainer.usageStats.("storage.usage_bytes")/$NContainer.usageStats.("storage.capacity_bytes")*100,2)
$NContainerDetails.LogicalFree = =MATH]::Round($NContainer.usageStats.("storage.free_bytes")/1TB/$NContainer.replicationFactor,2)
$LTotalStorage += $NContainer.usageStats.("storage.capacity_bytes")/$NContainer.replicationFactor
$LTotalUsed += $NContainer.usageStats.("storage.usage_bytes")/$NContainer.replicationFactor
$LTotalFree += $NContainer.usageStats.("storage.free_bytes")/$NContainer.replicationFactor
$NContainerDetailsList += $NContainerDetails
}
$NClusterDetails.LStorageCapacity = =MATH]::Round($LTotalStorage/1TB,2)
$NClusterDetails.LStorageUsed = =MATH]::Round($LTotalUsed/1TB,2)
$NClusterDetails.LStorageFree = =MATH]::Round($LTotalFree/1TB,2)
$NClusterDetails.LStorageppm = =MATH]::Round(($LTotalUsed/$LTotalStorage),2)
$NClusterDetailsList += $NClusterDetails
Disconnect-NTNXCluster *
WriteLog "" 1 "White"
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.