dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
584 stars 273 forks source link

GetIdracLcLogsREDFISH.py error with --get-all option #273

Closed jgranduel closed 8 months ago

jgranduel commented 9 months ago

Hi,

I have tried the command

$ python GetIdracLcLogsREDFISH.py -ip <ip> -u <user> -p <password> --dump-to-json-file --get-all

and got this error :

- INFO, this may take 30 seconds to 1 minute to collect all iDRAC LC logs depending on log file size
Traceback (most recent call last):
  File "[...]/./GetIdracLcLogsREDFISH.py", line 468, in <module>
    get_LC_logs()
  File "[...]/./GetIdracLcLogsREDFISH.py", line 222, in get_LC_logs
    if data["Members"] == []:
KeyError: 'Members'

The exception remains the same without --dump-to-json-file option.

texroemer commented 9 months ago

Hi @jgranduel

I wasn't able to repro the issue you hit in my lab but i did update the script with more error handling when Members array is not reported in the JSON output. Can you try latest script version and see if it resolves the issue.

Thanks Tex

jgranduel commented 9 months ago

Hi, I cloned the latest Python version. Here's my output:

python ./GetIdracLcLogsREDFISH.py -ip <ip> - <user> -p <pass>  --get-all

- INFO, this may take 30 seconds to 1 minute to collect all iDRAC LC logs depending on log file size
-WARNING, 'Members' key not detected in JSON response, script will exit

I don't get any log.

But with python ./GetIdracLcLogsREDFISH.py -ip <ip> -u <user> -p <pass> --get-severity critical, it works as expected.

With --get-all, I am supposed to well... get all logs ?

texroemer commented 9 months ago

I know what the issue is, I updated the script to leverage LogServices schema for all functions to be DMTF compliant but the function to get severity entries was not updated and still leveraging Logs which is why this function is passing but the get all logs function is failing. In newer versions of iDRAC if you run GET on "redfish/v1/Managers/iDRAC.Embedded.1", you will not see Logs reported but LogServices instead. Even though Logs is no longer reported in newer iDRAC versions support is still there for backwards compatibility.

What iDRAC version are you currently using?

jgranduel commented 9 months ago

iDRAC 8. (2.8 (Build 04) if this info is relevant.

Sorry but I didn't understand all your comment.

With updated version:

python ./GetIdracLcLogsREDFISH.py -ip <ip> -u <user> -p <pass>  --get-all

- INFO, this may take 30 seconds to 1 minute to collect all iDRAC LC logs depending on log file size
- WARNING, 'Members' key not detected in JSON response, unable to get LC logs. Manually check iDRAC interfaces to confirm you can view LC logs
texroemer commented 9 months ago

Thanks for the iDRAC version, this helps. So Redfish implementation is different between iDRAC8 and iDRAC9. I'll need to add a check in the script to first get the iDRAC version to decide which URI to use to get LC logs, either "redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog" for iDRAC 8 or "redfish/v1/Managers/iDRAC.Embedded.1/LogServices/Lclog" for iDRAC 9.

Let me update the script test on both iDRAC 8 and 9, will let you know once posted.

-Tex

texroemer commented 9 months ago

Updated script has been posted, please try it out and let me know if you hit any issues.

Thanks Tex

jgranduel commented 9 months ago

Thank you. Your update works perfectly well!