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

check_redfish.py --mel fails if no LogService found #23

Closed dan-m-joh closed 4 years ago

dan-m-joh commented 4 years ago

When running "check_redfish.py -H host -u user -p password --mel" the script exits with the following output:

Traceback (most recent call last):
  File "./check_redfish.py", line 206, in <module>
    if any(x in args.requested_query for x in ['mel', 'all']):      get_event_log(plugin, "Manager")
  File "/mnt/data01/contrib_plugins/check_redfish/cr_module/event.py", line 176, in get_event_log
    get_event_log_huawei(plugin_object, event_type, system_manager_id)
  File "/mnt/data01/contrib_plugins/check_redfish/cr_module/event.py", line 391, in get_event_log_huawei
    if len(manager_data.get("LogServices")) == 0:
TypeError: object of type 'NoneType' has no len()

I have narrowed it down to that in our case no LogService is found. Adding "manager_data.get("LogServices") is None or" to the if-statement on line 391 in event.py makes the script run without issue.

Regards, D/\N

bb-Ricardo commented 4 years ago

do you mind sharing a MockUp?

dan-m-joh commented 4 years ago

Sure I can, but you have to "walk me through" it - I am new to GitHub (an python for that matter).

bb-Ricardo commented 4 years ago

Sure I can, but you have to "walk me through" it - I am new to GitHub (an python for that matter).

sure, no problem.

You could use this project (https://github.com/DMTF/Redfish-Mockup-Creator) and send me the mockup as tar and I will have a look.

But it will contain IP addresses, serial numbers and account data which you might want to anonymize. I also have a script which tries to substitute critical information with made up ones.

Just send it to my eMail address and I added to my internal testing framework.

dan-m-joh commented 4 years ago

OK, this is not going well ....

I have downloaded and "installed" the MockUp generator, but it fails to run correctly. This is the output that I get:

$ python3 ./redfishMockupCreate.py -r host -u user -p 'password' -D /home/dajoha/tmp/MockUp/
   redfishMockupCreate: Transport: Cant connect to remote redfish service. Aborting command
   redfishMockupCreate: Transport: Response Error: status_code: 503 -- Internal Server Error
   redfishMockupCreate: ERROR: Cannot get Redfish service version from URI /redfish (status unknown). Assuming default version.
# rhost: host
# full directory path: /home/dajoha/tmp/MockUp
# description: 
# starting mockup creation
# Creating /redfish resource
# Creating /redfish/v1 resource
   redfishMockupCreate: Transport: Response Error: status_code: 503 -- Internal Server Error
   redfishMockupCreate: ERROR: Cant read root service:  GET /redfish/ from rhost. aborting
   redfishMockupCreate: Status Code: 503 

The only two files created in the output directory are:

README
redfish/index.json

The README-file contains:

Redfish Service state stored in Redfish Mockup Format
Program: redfishMockupCreate,  ver: 1.0.5
Created: 2020-08-12 16:13:54
rhost:  host
Description:
Commandline: python3.4 ./redfishMockupCreate.py -r host -u user -p password -D /home/dajoha/tmp/MockUp/

and redfish/index.json contains:

{
    "v1": "/redfish/v1/"
}

Note 1: The hostname, username and password are redacted. Note 2: Running check_redfish with the same hostname, user and password (from the same host) works.

Regards, D/\N

bb-Ricardo commented 4 years ago

Thank you for trying. Did you try '-S' option to establish an HTTPS connection?

dan-m-joh commented 4 years ago

Yes, I tried with different combinations of with and without -S and -A

D/\N

dan-m-joh commented 4 years ago

OK, so I found my problem. I had forgotten that http[s]_proxy was set when I tried to run redfishMockupCreate.py which made it fail (correctly so, the proxy have no "access" to the hosts network). Interesting is that check_redfish.py ignores the shells proxy settings. I will send you eMail with the MockUp.

D/\N

dan-m-joh commented 4 years ago

OK, now I am just missing your eMail...

bb-Ricardo commented 4 years ago

just check any of the last commits with "git log"

dan-m-joh commented 4 years ago

Email sent...

bb-Ricardo commented 4 years ago

Thank you for the input

I tested your mockup and your changes (both issues) are good solutions. Merged both PR.

Consider updating iBMC to a new version. On our Huawei server we tested a 5.xx version and there the Manager Logs were finally available.

dan-m-joh commented 4 years ago

Hello Ricardo,

I tested against an other Huawei Server that is already at iBMC version 5.07, but I still get "No LogServices"

$ ./check_redfish.py -H xxx -u user -p 'password' --info
[OK]: Type: Huawei 2288H V5 (CPU: 2, MEM: 256GB) - BIOS: 7.58 - Serial: xxxxxxxxxxxxxxx - Power: On - Name: NOT SET

$ ./check_redfish.py -H xxx -u user -p 'password' --bmc
[OK]: iBMC (Firmware: 5.07) and all nics are in 'OK' state.

$ ./check_redfish.py -H xxx -u user -p 'password' --mel
[UNKNOWN]: No 'LogServices' found for redfish URL '/redfish/v1/Managers/1'

-- D/\N

bb-Ricardo commented 4 years ago

We currently have 5.70 on some machines and there it works well.

Maybe you're to upgrade one machine to teat it.

Also possible: for some reason the server model doesn't support it.

dan-m-joh commented 4 years ago

I will see if I can get one machine updated (that is a task for an other team, so that could take some time) That the server model does not support it could also be it.

Thanks for you support!!!

D/\N