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
113 stars 34 forks source link

Issue with redfish 3.1.0 - HttpClient sessions attribute "_conn" #75

Closed aj-gh closed 2 years ago

aj-gh commented 2 years ago

I installed the dependencies for this tool yesterday and pip decided to install the recently released redfish 3.1.0 module. With redfish 3.1.0 I then ran into a missing attribute of the HttpClient object when trying to use the session feature: AttributeError: 'HttpClient' object has no attribute '_conn'

Downgrading python-redfish-library to 3.0.3 resolved my issue. Looking into their commits it seems they replaced "http.client" with "requests".

Environment: Ubuntu 20.04.3 LTS Python 3.8.10 python-redfish-library via pip3 and a requirement of "redfish>=2.1.4"

Full traceback:

Traceback (most recent call last):
  File "./check_redfish.py", line 149, in <module>
    plugin = PluginData(args, plugin_version=__version__)
  File "/root/check_redfish/cr_module/classes/plugin.py", line 118, in __init__
    self.rf = RedfishConnection(cli_args)
  File "/root/check_redfish/cr_module/classes/redfish.py", line 59, in __init__
    self.init_connection()
  File "/root/check_redfish/cr_module/classes/redfish.py", line 333, in init_connection
    self.save_session_to_file()
  File "/root/check_redfish/cr_module/classes/redfish.py", line 248, in save_session_to_file
    connection_socket = self.connection._conn
AttributeError: 'HttpClient' object has no attribute '_conn'
bb-Ricardo commented 2 years ago

thank you for the feedback.

I will need to lock the version for now and look into upgrading the script accordingly.

bb-Ricardo commented 2 years ago

Hi,

I changed some code and it should now work with versions <3.1.0 and >= 3.1.0. Can you check out the "next-release" branch and try to run it with the redfish 3.1.1 version?

Thank you.

cmaile commented 2 years ago

@bb-Ricardo I try the new next-release branch and the redfish version 3.1.1 and 3.1.2.

The exception is gone now, but the check does not works:

[CRITICAL]: Unable to connect to Host 'x.x.x.x', max retries exhausted

With redfish version 3.0.3 works.

bb-Ricardo commented 2 years ago

Thank you very much for testing. I will have a look and see where this issue comes from.

cmaile commented 2 years ago

@bb-Ricardo more debugging:

2022-03-15 17:08:09,723 - DEBUG: HTTP REQUEST: GET PATH: /redfish/v1/Chassis/System.Embedded.1/Thermal BODY: None 2022-03-15 17:08:09,723 - INFO: Attempt 1 of /redfish/v1/Chassis/System.Embedded.1/Thermal 2022-03-15 17:08:09,723 - INFO: Retrying /redfish/v1/Chassis/System.Embedded.1/Thermal ['HttpClient' object has no attribute '_session']

bb-Ricardo commented 2 years ago

Hi @cmaile,

I finally got around to look into it and pushed a fix to "next-release". Can you please test if it's working now?

Thank you

cmaile commented 2 years ago

@bb-Ricardo Thanks for the bugfix. It works now. Many Thanks 👍