bb-Ricardo / check_redfish

A monitoring/inventory plugin to check components and health status of systems which support Redfish. It will also create a inventory of all components of a system.
MIT License
110 stars 30 forks source link

Add support processor type GPU #101

Closed zvfvrv closed 1 year ago

zvfvrv commented 1 year ago

This PR aims to add support for GPU processors during the inventory export. Unfortunately the "source_data" related to the retrieved GPU is a bit sparse in content compared to that of the CPUs, which is why there are few fields valued. I'm attaching an example of source_data where I proceeded to make a small redaction on the serial and part number. The rest is intact:

"source_data":{
   "@odata.context":"/redfish/v1/$metadata#Processor.Processor",
   "@odata.id":"/redfish/v1/Systems/System.Embedded.1/Processors/Video.Slot.34-1",
   "@odata.type":"#Processor.v1_12_0.Processor",
   "Assembly":{
      "@odata.id":"/redfish/v1/Chassis/System.Embedded.1/Assembly"
   },
   "Description":"Represents the properties of the GPU attached to this System",
   "Id":"Video.Slot.34-1",
   "Links":{
      "Chassis":{
         "@odata.id":"/redfish/v1/Chassis/System.Embedded.1"
      },
      "Oem":{
         "Dell":{
            "@odata.type":"#DellOem.v1_3_0.DellOemLinks",
            "CPUAffinity":[
               {
                  "@odata.id":"/redfish/v1/Systems/System.Embedded.1/Processors/CPU.Socket.1"
               }
            ],
            "CPUAffinity@odata.count":1
         }
      },
      "PCIeDevice":{
         "@odata.id":"/redfish/v1/Systems/System.Embedded.1/PCIeDevices/23-0"
      },
      "PCIeFunctions":[
         {
            "@odata.id":"/redfish/v1/Systems/System.Embedded.1/PCIeDevices/23-0/PCIeFunctions/23-0-0"
         }
      ]
   },
   "Manufacturer":"NVIDIA Corporation",
   "Metrics":{
      "@odata.id":"/redfish/v1/Systems/System.Embedded.1/Processors/Video.Slot.34-1/ProcessorMetrics"
   },
   "Model":"NVIDIA A30",
   "Name":"Video.Slot.34-1",
   "Oem":{
      "Dell":{
         "@odata.type":"#DellOem.v1_3_0.DellOemResources",
         "DellAccelerators":null,
         "DellProcessor":null,
         "PowerMetrics":{
            "@odata.id":"/redfish/v1/Systems/System.Embedded.1/Processors/Video.Slot.34-1/Oem/Dell/PowerMetrics"
         },
         "ThermalMetrics":{
            "@odata.id":"/redfish/v1/Systems/System.Embedded.1/Processors/Video.Slot.34-1/Oem/Dell/ThermalMetrics"
         }
      }
   },
   "PartNumber":"XXX-YYYYY-AAAAA-XXXX",
   "ProcessorType":"GPU",
   "SerialNumber":"XZXZXZXZXZXZXZXZXZX",
   "Status":{
      "Health":"OK",
      "State":"Enabled"
   }
}

Thanks

Tested on Dell PowerEdge R750xa

bb-Ricardo commented 1 year ago

Hi @zvfvrv,

thank you fro the PR?

But in general the only difference is the type field, correct?

wouldn't it be easier to just add the the field to the regular parsing? Or did the parsing of the GPU break the CPU parsing code?

zvfvrv commented 1 year ago

Hi @bb-Ricardo , yes correct the only difference is the type and the serial number but yes can be handled with a few check based on the type. The reason why I opted to divide the parsing between them is that with the GPU most of the fileds are set to null. But yes maybe is better to keep it simple adding the type field and some minor check based on that.