07-27-2023 12:30 PM
So, what I am wanting to gather is essentially all of the hardware details that is in the inventory page within a server in Intersight. So not the simple export from the server dashboard but the actual hardware make and model (example: CPU: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz, PCI slot 1 Emulex LPe 16002 16 Gbps 2 port FC HBA). I am wondering if this can be done through an API call?
Solved! Go to Solution.
07-27-2023 12:59 PM
It should be possible with an example like this and the Intersight Powershell SDK (or using same logic with python sdk). It's got a limit of 1000 servers due to -Top but if you have more than that you can paginate it.
$servers = Get-IntersightComputePhysicalSummary -Top 1000
foreach ($server in $servers.Results)
{
Write-Output "--------"
Write-Output ($server.Name,$server.Model,$server.Serial,$server.Firmware -join " ")
Write-Output "--------"
$filter = "(Ancestors/any(t:t/Moid eq '" + $server.Moid + "') or (ObjectType eq 'cond.Alarm' and AncestorMoId eq '" + $server.Moid + "'))"
$results = Get-intersightsearchSearchItem -Filter $filter -Top 1000
foreach ($result in $results.Results)
{
if($result.AdditionalProperties.Model -And $result.AdditionalProperties.Serial -And ($result.ObjectType -ne 'ComputeBoard') -And ($result.ObjectType -ne 'EquipmentFru') -Or $result.ObjectType -eq 'ProcessorUnit')
{
if($result.AdditionalProperties.Pid)
{
Write-Output ($result.AdditionalProperties.Pid,$result.AdditionalProperties.Serial,$result.AdditionalProperties.PciSlot,$result.AdditionalProperties.Dn,$result.AdditionalProperties.Location,$result.ObjectType -join ",")
}else{
Write-Output ($result.AdditionalProperties.Model,$result.AdditionalProperties.Serial,$result.AdditionalProperties.PciSlot,$result.AdditionalProperties.Dn,$result.AdditionalProperties.Location,$result.ObjectType -join ",")
}
}
}
}
Sample Output:
--------
rack-1 UCSC-C220-M5SX xyz 4.0(4k)
--------
NO DIMM,NO DIMM,,sys/rack-unit-1/board/memarray-1/mem-8,DIMM_D2,MemoryUnit
NO DIMM,NO DIMM,,sys/rack-unit-1/board/memarray-1/mem-7,DIMM_D1,MemoryUnit
UCS-M2-240GB,xyz ,,sys/rack-unit-1/board/storage-PCH-4/disk-1,,StoragePhysicalDisk
UCS-CPU-4108,,,sys/rack-unit-1/board/cpu-1,,ProcessorUnit
,,,sys/rack-unit-1/board/cpu-2,,ProcessorUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-9,DIMM_E1,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-1,DIMM_A1,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-3,DIMM_B1,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-2,DIMM_A2,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-10,DIMM_E2,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-4,DIMM_B2,MemoryUnit
Nvidia P4,xyz ,1,sys/rack-unit-1/board/graphics-card-1,,GraphicsCard
UCSC-RAID-M5,xyz,,sys/rack-unit-1/equipped-slot-MRAID,,PciDevice
Nvidia P4,xyz,,sys/rack-unit-1/equipped-slot-1,,PciDevice
UCSC-MLOM-C40Q-03,xyz,,sys/rack-unit-1/equipped-slot-MLOM,,PciDevice
UCSC-PSU1-1050W,xyz,,sys/rack-unit-1/psu-2,,EquipmentPsu
UCSC-PSU1-1050W,xyz,,sys/rack-unit-1/psu-1,,EquipmentPsu
Lewisburg SSATA Controller [AHCI mode],LSIROMB-0,,sys/rack-unit-1/board/storage-PCH-4,,StorageController
UCSC-RAID-M5,xyz,MRAID,sys/rack-unit-1/board/storage-SAS-1,,StorageController
Lewisburg PSATA Controller [SWRAID mode],LSIROMB-0,,sys/rack-unit-1/board/storage-SATA-3,,StorageController
UCSC-MLOM-C40Q-03,xyz,MLOM,sys/rack-unit-1/adaptor-1,,AdapterUnit
07-27-2023 12:59 PM
It should be possible with an example like this and the Intersight Powershell SDK (or using same logic with python sdk). It's got a limit of 1000 servers due to -Top but if you have more than that you can paginate it.
$servers = Get-IntersightComputePhysicalSummary -Top 1000
foreach ($server in $servers.Results)
{
Write-Output "--------"
Write-Output ($server.Name,$server.Model,$server.Serial,$server.Firmware -join " ")
Write-Output "--------"
$filter = "(Ancestors/any(t:t/Moid eq '" + $server.Moid + "') or (ObjectType eq 'cond.Alarm' and AncestorMoId eq '" + $server.Moid + "'))"
$results = Get-intersightsearchSearchItem -Filter $filter -Top 1000
foreach ($result in $results.Results)
{
if($result.AdditionalProperties.Model -And $result.AdditionalProperties.Serial -And ($result.ObjectType -ne 'ComputeBoard') -And ($result.ObjectType -ne 'EquipmentFru') -Or $result.ObjectType -eq 'ProcessorUnit')
{
if($result.AdditionalProperties.Pid)
{
Write-Output ($result.AdditionalProperties.Pid,$result.AdditionalProperties.Serial,$result.AdditionalProperties.PciSlot,$result.AdditionalProperties.Dn,$result.AdditionalProperties.Location,$result.ObjectType -join ",")
}else{
Write-Output ($result.AdditionalProperties.Model,$result.AdditionalProperties.Serial,$result.AdditionalProperties.PciSlot,$result.AdditionalProperties.Dn,$result.AdditionalProperties.Location,$result.ObjectType -join ",")
}
}
}
}
Sample Output:
--------
rack-1 UCSC-C220-M5SX xyz 4.0(4k)
--------
NO DIMM,NO DIMM,,sys/rack-unit-1/board/memarray-1/mem-8,DIMM_D2,MemoryUnit
NO DIMM,NO DIMM,,sys/rack-unit-1/board/memarray-1/mem-7,DIMM_D1,MemoryUnit
UCS-M2-240GB,xyz ,,sys/rack-unit-1/board/storage-PCH-4/disk-1,,StoragePhysicalDisk
UCS-CPU-4108,,,sys/rack-unit-1/board/cpu-1,,ProcessorUnit
,,,sys/rack-unit-1/board/cpu-2,,ProcessorUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-9,DIMM_E1,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-1,DIMM_A1,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-3,DIMM_B1,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-2,DIMM_A2,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-10,DIMM_E2,MemoryUnit
UCS-MR-X32G2RS-H,xyz ,,sys/rack-unit-1/board/memarray-1/mem-4,DIMM_B2,MemoryUnit
Nvidia P4,xyz ,1,sys/rack-unit-1/board/graphics-card-1,,GraphicsCard
UCSC-RAID-M5,xyz,,sys/rack-unit-1/equipped-slot-MRAID,,PciDevice
Nvidia P4,xyz,,sys/rack-unit-1/equipped-slot-1,,PciDevice
UCSC-MLOM-C40Q-03,xyz,,sys/rack-unit-1/equipped-slot-MLOM,,PciDevice
UCSC-PSU1-1050W,xyz,,sys/rack-unit-1/psu-2,,EquipmentPsu
UCSC-PSU1-1050W,xyz,,sys/rack-unit-1/psu-1,,EquipmentPsu
Lewisburg SSATA Controller [AHCI mode],LSIROMB-0,,sys/rack-unit-1/board/storage-PCH-4,,StorageController
UCSC-RAID-M5,xyz,MRAID,sys/rack-unit-1/board/storage-SAS-1,,StorageController
Lewisburg PSATA Controller [SWRAID mode],LSIROMB-0,,sys/rack-unit-1/board/storage-SATA-3,,StorageController
UCSC-MLOM-C40Q-03,xyz,MLOM,sys/rack-unit-1/adaptor-1,,AdapterUnit
07-27-2023 01:37 PM
This is great! I will run with this. Thanks for the quick response.
07-29-2023 03:59 AM
Hello,
Keep in mind you can use also this tool called "iserver" for inventory purposes of your devices claimed in Intersight - https://github.com/datacenter/iserver
It will give you a bit more structure outputs and as well you can customize it by different filters, let me know if you have any questions about using it.
Best regards,
Frank.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide