Redfish API Lenovo xClarity

CMK version:
Enterprise Edition 2.2.0p20
OS version:
ubuntu 20.04

Error message:
Agent exited with code 1: Traceback (most recent call last):
File “/omd/sites/mysite/local/share/check_mk/agents/special/agent_lenovo_xclarity”, line 188, in
result = get_hw_inventory(ip, login_account, login_password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/omd/sites/mysite/local/share/check_mk/agents/special/agent_lenovo_xclarity”, line 45, in get_hw_inventory
REDFISH_OBJ = redfish.redfish_client(

That’s not the complete error message there is something missing.
Please execute the special agent manually on command line as site user.
It looks like that you already get an error at the login stage.
That means your user credentials are possibly wrong.

I missed last line:
AttributeError: module ‘redfish’ has no attribute ‘redfish_client’

I checked user credentials and they are OK

What is the command to run it manually?

Can you run:

pip3 freeze | grep -i redfish

inside your checkmk site?

Here is the result of the command:

WARNING: Skipping /omd/sites/mysite/local/lib/python3/jsonpatch-1.33.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/ply-3.11.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/jsonpointer-2.4.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/requests_toolbelt-1.0.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/jsonpath_rw-1.4.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/decorator-5.1.1.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/requests_unixsocket-0.3.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysitesat_de_fra01/local/lib/python3/purestorage-1.19.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/certifi-2024.2.2.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/requests-2.31.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/idna-3.6.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/idna-3.7.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/urllib3-2.2.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/urllib3-2.2.1.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/urllib3-1.26.18.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/redfish-3.2.2.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/six-1.16.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/charset_normalizer-3.3.2.dist-info due to invalid metadata entry ‘name’

Hi @Cespacool,

have you installed the redfish pip package in the first place?

Please try to install it in the site user context:
pip3 install 'urllib3<2' redfish --upgrade

EDIT:
To prevent problems with Checkmk dependencies, I added ‘urllib3<2’ to the command. Please use this with caution. In future releases of Checkmk the redfish package is shipped by default with Checkmk.

Best Regards
Norm

Redfish should be shipped now in Checkmk.

I fear you installed in the past other packages using pip inside your installation, and they may “overwrite” what is shipped in Checkmk.

You should clean up the local/python3 path (only from other python packes, not from checkmk stuff) and try again.

My fresh Docker Checkmk, contains a redfish python module out of the box as well.

Hi @Norm

After runing the command, I have this message at the end :

Installing collected packages: ply, urllib3, six, jsonpointer, idna, decorator, charset-normalizer, certifi, requests, jsonpath-rw, jsonpatch, requests-unixsocket, requests-toolbelt, redfish
ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
botocore 1.20.102 requires urllib3<1.27,>=1.25.4, but you have urllib3 2.2.1 which is incompatible.
Successfully installed certifi-2024.2.2 charset-normalizer-3.3.2 decorator-5.1.1 idna-3.7 jsonpatch-1.33 jsonpath-rw-1.4.0 jsonpointer-2.4 ply-3.11 redfish-3.2.2 requests-2.31.0 requests-toolbelt-1.0.0 requests-unixsocket-0.3.0 six-1.16.0 urllib3-2.2.1

I would not install stuff into the Checkmk site with dependencies. In the past, this once broke Checkmk and the GUI completely, without a way of easy fix. That was because redfish installed a to new version of urllib.

I recommend again to clean up the Python Packages you installed locally, try agin then.

pip freeze should not give any errors.

It’s OK when I run pip freeze

When I run the connection tests, it is failed with this message :
Agent exited with code 1: Traceback (most recent call last):
File “/omd/sites/mysite/local/share/check_mk/agents/special/agent_lenovo_xclarity”, line 188, in
result = get_hw_inventory(ip, login_account, login_password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/omd/sites/mysite/local/share/check_mk/agents/special/agent_lenovo_xclarity”, line 45, in get_hw_inventory
REDFISH_OBJ = redfish.redfish_client(
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module ‘redfish’ has no attribute 'redfish_client’Agent exited with code 1: Traceback (most recent call last):
File “/omd/sites/mysite/local/share/check_mk/agents/special/agent_redfish”, line 23, in
from redfish.rest.v1 import RetriesExhaustedError, ServerDownOrUnreachableError
ModuleNotFoundError: No module named 'redfish.rest.v1

I checked login/pwd in checkmk and lenovo server and it’s same ID.

Not until you use version 2.3

That’s the correct way to install the Redfish library.

I would also do this. If you don’t use any other extra libraries it should be relativ easy. If you do this - don’t remove the folder “cmk” inside “~/local/lib/python3/”.

On my system with a clean redfish the command output from @bkuhn looks like this.

~/local/lib/python3$ pip3 freeze | grep -i redfish
redfish==3.2.2

With pip3 freeze, I have the same result.

But after I have launched the connection tests in GUI, I run the command :
~/local/lib/python3$ pip3 freeze | grep -i redfish
WARNING: Skipping /omd/sites/mysite/local/lib/python3/jsonpatch-1.33.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/ply-3.11.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/jsonpointer-2.4.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/requests_toolbelt-1.0.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/jsonpath_rw-1.4.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/decorator-5.1.1.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/requests_unixsocket-0.3.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/certifi-2024.2.2.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/requests-2.31.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/idna-3.7.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/redfish-3.2.2.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/six-1.16.0.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/urllib3-1.26.18.dist-info due to invalid metadata entry ‘name’
WARNING: Skipping /omd/sites/mysite/local/lib/python3/charset_normalizer-3.3.2.dist-info due to invalid metadata entry ‘name’