Unsolved

This post is more than 5 years old

2 Intern

 • 

33 Posts

4659

September 11th, 2019 06:00

Export hardware inventory to cmdb

Hi,

we would like to export the complete hardware inventory (Name,CPUs,RAM,Warrenty information,..) to a , seperated CSV that we could import to our cmdb.

Did anyone have the same requirements, yet?

Recently I spent some hours with the powershell information found on https://github.com/dell/OpenManage-Enterprise/tree/master/Scripts/PowerShell. But it did not help me that much, yet.

 

12 Elder

 • 

6.2K Posts

September 11th, 2019 10:00

Hello

I do not think it is possible to get that information in a single export. The manual states multiple times that device inventory export can only be performed on a single device. You can export a list of devices by group.

There is probably a way that you could have a script export the device list and then run device inventory exports on each device in the exported list.

http://www.dell.com/openmanagemanuals/

There is also a REST API guide on the OMEnt 3.2 support page that has information for pulling single device inventory: End to End Automation with REST API in Dell EMC OpenManage Enterprise 3.0

Thanks

2 Intern

 • 

33 Posts

September 12th, 2019 06:00

Hi,

thanks for the provided information. I already saw this document but it was not very helpful to me, yet.

Does anyone have an powershell example script that show how to use this API?

 

8 Posts

September 12th, 2019 10:00

I do not have powershell examples, however, some useful knowledge any way. The API guide covers the "public" api, which is very lacking. I have a lot of automation which runs against OME, but they utilize the "secret" API endpoints not documented. The documented api has "/api/" in the url, there is also "/msm/api/", "/omc/api", "/msm/api/Console", and "/omc/api/Console", which are far easier endpoints to use can can most likely get all the info you need since these are the endpoints the OME Web UI use to communicate.

 

APIs = { 'default': 'api', 'msm': 'msm/api', 'omc': 'omc/api', 'msm_console': 'msm/api/Console', 'omc_console': 'omc/api/Console' }

 

Just hit the "/api/SessionService/Sessions" endpoint POSTing some JSON data for the username/pass to get a token to use for the other api calls.

 

json_data = { 'UserName': self.user, 'Password': self.pwd, 'SessionType': 'API' }

 

You find examples of all the api calls and returns by using "Development Tools" in your browser. Hope this helps.

8 Posts

September 12th, 2019 10:00

I did some quick testing in one of my labs.  It looks like hitting " https:// /omc/api/Console/DeviceGroup/Devices/500" will get a return of all your devices, then using the "id" field in each entry (server) in the return list you loop through and return "https:// /msm/api/Console/Inventory/ " and you will have a highly detailed inventory of every server.  

2 Intern

 • 

33 Posts

September 16th, 2019 04:00

Hi willid32,

that helped me a lot.

I am working with PS for one year, now. In most cases I dealed with csv formated data.

With your information I could get a lot of xml data. For one device I used:

$DevDetailUrl = "https://$($IpAddress)/msm/api/Console/Inventory/10119"
$DevDetailResp = Invoke-WebRequest -Uri $DevDetailUrl -UseBasicParsing -Headers $Headers -Method Get
[xml]$xmlDevDetails = $DevDetailResp.Content

Now I am able to  get things like the ServiceTag with:

$xmlDevDetails.Inventory.ServiceTag

 

To get the CPU type i used:

$xmlDevDetails.Inventory.inventoryDetails.inventoryDetails.inventoryinfo.inventoryinfo.Modelname

This looks a little too complicated to me. Is there an easier way to get to the needed informations?

Additionally i tried to find the number of installed CPUs, but I couldn't find it. Here I could use a workaround and count the output of:

$xmlDevDetails.Inventory.inventoryDetails.inventoryDetails.inventoryinfo.inventoryinfo.Modelname

Maybe the biggest problem is that I never dealed with xml before

The goal is to create a table Showing ServiceTag, CPU Type, Number of Installed CPUs, Number, of Cores, Installed RAM, Location Informations, Warrenty Information, Management IP

 

 

 

 

 

 

8 Posts

September 16th, 2019 07:00

BastianP,

I am glad the info is helping. One thing i forgot to mention is I would recommend getting a JSON return as its a much easier object to handle/read. Just add in your headers: "accept: application/json". The return from "msm/api/Console/Inventory/SERVER_ID" will contain all the information you want, minus the warranty info, I think that is on a different endpoint but I will double check that. As far as the cpu, mem, service tag, mannagement ip..., they can all be found in the json return: 

{
  "id": 25016,
  "ip": null,
  "hostname": "iDRAC-",
  "type": 1000,
  "serviceTag": "",
  "model": "PowerEdge R740",
  "status": 1000,
  "online": true,
  "connectionState": true,
  "powerState": 17,
  "systemId": "1813",
  "capabilities": [
.....
{
      "inventoryType": "serverProcessors",
      "inventoryTitle": "modules.device.inventoryGrids.procInfo",
      "inventoryInfo": [
        {
          "Id": 63.0,
          "Family": "Intel(R) Xeon(TM)",
          "MaxSpeed": 4000.0,
          "CurrentSpeed": 2300.0,
          "SlotNumber": "CPU.Socket.1",
          "Status": 1000.0,
          "NumberOfCores": 12.0,
          "NumberOfEnabledCores": 12.0,
          "BrandName": "Intel",
          "ModelName": "Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz",
          "InstanceId": "CPU.Socket.1",
          "Voltage": "1.8"
        },
        {
          "Id": 64.0,
          "Family": "Intel(R) Xeon(TM)",
          "MaxSpeed": 4000.0,
          "CurrentSpeed": 2300.0,
          "SlotNumber": "CPU.Socket.2",
          "Status": 1000.0,
          "NumberOfCores": 12.0,
          "NumberOfEnabledCores": 12.0,
          "BrandName": "Intel",
          "ModelName": "Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz",
          "InstanceId": "CPU.Socket.2",
          "Voltage": "1.8"
        }
....
{
      "inventoryType": "deviceManagement",
      "inventoryTitle": "modules.device.inventoryGrids.deviceManagementInfo",
      "inventoryInfo": [
        {
          "ManagementId": 5022.0,
          "Device": 0.0,
          "IpAddress": "10.25.28.22",
          "MacAddress": "d0:94:66:13:d3:54",
          "ManagementType": {
            "Name": "PUBLIC",
            "Description": "Public Management Interface",
            "ManagementType": 2.0
          },
          "InstrumentationName": "iDRAC-",
          "DnsName": "",
          "EndPointAgents": [
            {
              "ManagementProfileId": 5022.0,
              "ProfileId": "WSMAN_OOB",
              "AgentName": "iDRAC",
              "HasCreds": 1.0,
              "Version": "3.34.34.34",
              "ManagementURL": "https://10.25.28.22:443",
              "Status": 1000.0,
              "StatusDateTime": 1.56823400071E12
            }
          ]
        }
....
{
      "inventoryType": "serverMemoryDevices",
      "inventoryTitle": "modules.device.inventoryGrids.memInfo",
      "inventoryInfo": [
        {
          "Id": 377.0,
          "Name": "DIMM.Socket.A1",
          "BankName": "A",
          "Size": 32768.0,
          "Status": 1000.0,
          "Manufacturer": "Samsung",
          "PartNumber": "M393A4K40BB2-CTD",
          "SerialNumber": "367C37F0",
          "TypeDetails": "DDR4 DIMM",
          "ManufacturerDate": "Mon Aug 14 12:00:00 2017 UTC",
          "Speed": 2666.0,
          "CurrentOperatingSpeed": 2400.0,
          "Rank": "Double Rank",
          "InstanceId": "DIMM.Socket.A1",
          "DeviceDescription": "DIMM A1"
        },
        {
          "Id": 378.0,
          "Name": "DIMM.Socket.A5",
          "BankName": "A",
          "Size": 32768.0,
          "Status": 1000.0,
          "Manufacturer": "Samsung",
          "PartNumber": "M393A4K40BB2-CTD",
          "SerialNumber": "367C319E",
          "TypeDetails": "DDR4 DIMM",
          "ManufacturerDate": "Mon Aug 14 12:00:00 2017 UTC",
          "Speed": 2666.0,
          "CurrentOperatingSpeed": 2400.0,
          "Rank": "Double Rank",
          "InstanceId": "DIMM.Socket.A5",
          "DeviceDescription": "DIMM A5"
        },
....

 

2 Intern

 • 

33 Posts

September 18th, 2019 02:00

Hi willid32,

thanks for your support.

I have been able to get a lot of technical informations. Additionally i could the warrenty informations (service level description) and shipping date as well.

 

Any idea where to find the location information? for example datacenter, room, rack and slot?

 

2 Intern

 • 

33 Posts

September 18th, 2019 02:00

Hi,

just found it by myself. This is located in inventorytype deviceLocation in /api/DeviceService/Devices(id)/InventoryDetails

 

 

 

2 Intern

 • 

33 Posts

September 18th, 2019 03:00

Hi again,

does anyone know if it possible to read out who many slots a chassis occupies?

For example a PowerEdge 740 occupies 2 slots and a PowerEdge 640 occupies only 1 slot.

I could do this with a powershell mapping for every device type, but it would be nicer to get this information form the device itself.

 

2 Intern

 • 

33 Posts

July 14th, 2020 03:00

Hi,

the export has been working for some months, now. But today I saw, that I did not get all information anymore.

After some investigation i found out, that some return are limited to 100.

For example:

    $WarrentyUrl = "https://$($IpAddress)/api/WarrantyService/Warranties"
    $WarrentyResp = Invoke-WebRequest -Uri $WarrentyUrl -UseBasicParsing -Headers $Headers -Method Get # -ContentType $Type
    $WarrentyInfo = ($WarrentyResp.Content | ConvertFrom-Json).value


I see only 100 entries in "$WarrentyInfo", but it should be more than 150.

Could anyone help me with that, please?

No Events found!

Top