orangeCatDeveloper opened a new pull request, #4354:
URL: https://github.com/apache/hertzbeat/pull/4354

   Part of #3210
   
   Redfish monitoring of Dell iDRAC hardware fails every Fan, Battery and 
PowerSupply metric, logging `StatusCode 404` for each chassis on every 
collection cycle.
   
   Redfish 2020.4 moved fans and power supplies out of the `Thermal` and 
`Power` documents into standalone `ThermalSubsystem/Fans` and 
`PowerSubsystem/PowerSupplies` collections. `RedfishCollectionSchema` hardcodes 
only the new locations, while shipped iDRAC firmware serves only the older 
embedded arrays — #2730 carries the raw response body from a reporter's 
machine. A second defect sat behind it: once the paths resolve, 
`parseRedfishResource` used a JsonPath parser that throws 
`PathNotFoundException` for a field the firmware does not expose, and that 
exception escaped `collect()`.
   
   Each resource now carries a list of candidate collection uris, newest schema 
first, probed until one yields members. Legacy members are an embedded array 
rather than a collection, so the legacy candidate is written as a `#` fragment 
(`.../Thermal#/Fans`) — the same JSON Pointer form iDRAC itself puts in 
`@odata.id` — and resolving a fragment uri fetches the enclosing document and 
slices into it, which leaves the member-detail path unchanged. Because those 
member uris then share one document, a per-collect cache keeps a chassis with 
sixteen fans from refetching the same Thermal document sixteen times. A failed 
candidate keeps its error, so an expired token or a timeout is reported as 
itself rather than flattened into `Get redfish resources uri error`, and a 
field absent from the firmware becomes a null column instead of failing the 
metric.
   
   The second commit fixes an unrelated defect found while reading the same 
class: `close()` prefixed the session location with the session service path, 
building a URL no request could reach, so sessions were never released and 
lingered on the BMC until it expired them.
   
   Deliberately not covered: the `405` on session creation that opens #3210 is 
a separate defect needing an HTTP Basic Auth fallback; Battery has no 
pre-2020.4 equivalent resource, so it can only fail cleanly; legacy fan speed 
lives in `Reading` while `app-redfish.yml` queries `SpeedPercent.*`, leaving 
those two columns null until jsonPath can vary per schema; and candidate 
selection is global rather than per chassis, which matters only for a host 
whose chassis run different firmware generations.
   
   Verified against a mock iDRAC that serves the pre-2020.4 layout from #2730 
over TLS, driven through the real collector — session create, chassis walk, 
member fetch, session delete — using the jsonPath list shipped in 
`app-redfish.yml`.
   
   before:
   
   ```
   ERROR o.a.h.c.collect.redfish.RedfishCollectImpl -- Get redfish 
/redfish/v1/Chassis/System.Embedded.1/ThermalSubsystem/Fans collection resource 
error: Redfish session get resource error:StatusCode 404
   ERROR o.a.h.c.collect.redfish.RedfishCollectImpl -- Get redfish 
/redfish/v1/Chassis/Enclosure.Internal.0-2:RAID.Integrated.1-1/ThermalSubsystem/Fans
 collection resource error: Redfish session get resource error:StatusCode 404
   collect code = FAIL, msg = 'Get redfish resources uri error'
   fan rows = 0
   columns   = [id, name, state, health, temperature, speed]
   session release: FAILED - Redfish session close error:null
   ```
   
   after:
   
   ```
   collect code = SUCCESS, msg = ''
   fan rows = 2
   columns   = [id, name, state, health, temperature, speed]
     [/redfish/v1/Chassis/System.Embedded.1/Thermal#/Fans/0, System Board 
Fan1A, Enabled, OK,  ,  ]
     [/redfish/v1/Chassis/System.Embedded.1/Thermal#/Fans/1, System Board 
Fan1B, Enabled, OK,  ,  ]
   session release: OK
   ```
   
   Requests the mock BMC received, showing the probe order and the session now 
being released:
   
   ```
   POST   /redfish/v1/SessionService/Sessions
   GET    /redfish/v1/Chassis
   GET    /redfish/v1/Chassis/System.Embedded.1/ThermalSubsystem/Fans
   GET    
/redfish/v1/Chassis/Enclosure.Internal.0-2:RAID.Integrated.1-1/ThermalSubsystem/Fans
   GET    /redfish/v1/Chassis/System.Embedded.1/Thermal
   GET    /redfish/v1/Chassis/Enclosure.Internal.0-2:RAID.Integrated.1-1/Thermal
   DELETE /redfish/v1/SessionService/Sessions/1
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to