lenovo / python-redfish-lenovo

Sample Python scripts and Ansible playbooks for using the Redfish API on Lenovo servers
Apache License 2.0
86 stars 49 forks source link

lenovo_add_alert_recipient.py Can't use extra args #369

Open Molanito13 opened 1 month ago

Molanito13 commented 1 month ago

Hi, I'm trying to use the script but I can't make it work, when I add the extra parameters like --RecipientName for example:

python lenovo_add_alert_recipient.py -i 10.10.10.10 -u USERID -p PASSW0RD --RecipientName example --Address 10.10.10.10:514 --Enabledstate 1 --AlertType Syslog

It doesn't work, I only get the error: unrecognized arguments: --RecipientName example --Address 10.10.10.10:514 --Enabledstate 1

wyyfly commented 1 month ago

Hi,Molanito,

Can you tell me the server information you are using? Include product name, fw version, and FFDC log.

Molanito13 commented 1 month ago

ThinkSystem SR630 V3 Lenovo XClarity Controller 2 (5.10 ESX330M)

I can't provide FFDC at the moment, does the script use a RedFish endpoint to create the Syslog Recipient? In that case, what endpoint does it use? I haven't been able to find it in the official documentation

El mar, 23 jul 2024 a las 4:22, wyyfly @.***>) escribió:

Hi,Molanito,

Can you tell me the server information you are using? Include product name, fw version, and FFDC log.

— Reply to this email directly, view it on GitHub https://github.com/lenovo/python-redfish-lenovo/issues/369#issuecomment-2244126499, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALK3RIRIJTH24GCHOMACQJLZNW46TAVCNFSM6AAAAABLH5CMP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUGEZDMNBZHE . You are receiving this because you authored the thread.Message ID: @.***>

wyyfly commented 1 month ago

Hi,Molanito, The Redfish API used is: "/redfish/v1/Managers/1/Oem/Lenovo/Recipients".

Molanito13 commented 1 month ago

Hi

I've managed to make it work using the RedFish endpoint.

It may be a problem with the configparser? I've used 5.0.0 and 7.0.0 using python 3.11

As an extra question if you can resolve it, is it possible to update firmware like UEFI/BMC using Lenovo's repository? All I've found both in scripts and documentation is a semi-manual update where you need to have the file downloades by yourself beforehand

El mar, 23 jul 2024 a las 9:52, wyyfly @.***>) escribió:

Hi,Molanito, The Redfish API used is: "/redfish/v1/Managers/1/Oem/Lenovo/Recipients".

— Reply to this email directly, view it on GitHub https://github.com/lenovo/python-redfish-lenovo/issues/369#issuecomment-2244505904, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALK3RIU73EYVASJW7XSC4E3ZNYDUTAVCNFSM6AAAAABLH5CMP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUGUYDKOJQGQ . You are receiving this because you authored the thread.Message ID: @.***>

wyyfly commented 1 month ago

The python environment I use looks the same as yours: Python: 3.11.7 configparser: 7.0.0 argparse: 1.4.0

However, the result of my execution has not been able to reproduce your error. lenovo_add_alert_recipient

Can you give us the full command you used? Is there any special format for the specified parameter values?

Molanito13 commented 1 month ago

Hi I'm literally using the commands used as examples in the script

python lenovo_add_alert_recipient.py -i 10.10.10.10 -u USERID -p PASSW0RD --RecipientName example --Address 10.10.10.10:514 --Enabledstate 1 --AlertType Syslog

I'm just changing -i for the actual BMC address, -p for the password and --Address for the syslog server, I have tried with both - and -- for the extra commands just to check if it's able to give me another error message and nothing changes. I've also checked for possible extra blank spaces or weird characters and I've found nothing weird, other scripts work completely fine like https://github.com/lenovo/python-redfish-lenovo/blob/master/examples/lenovo_create_bmc_user.py

El mar, 23 jul 2024 a las 11:33, wyyfly @.***>) escribió:

The python environment I use looks the same as yours: Python: 3.11.7 configparser: 7.0.0 argparse: 1.4.0

However, the result of my execution has not been able to reproduce your error. lenovo_add_alert_recipient.png (view on web) https://github.com/user-attachments/assets/edd7c029-7b36-4975-ac72-925fdd4c1f52

Can you give us the full command you used? Is there any special format for the specified parameter values?

— Reply to this email directly, view it on GitHub https://github.com/lenovo/python-redfish-lenovo/issues/369#issuecomment-2244720494, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALK3RIU4N4BE2RA5LS6CWULZNYPOXAVCNFSM6AAAAABLH5CMP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUG4ZDANBZGQ . You are receiving this because you authored the thread.Message ID: @.***>

wyyfly commented 1 month ago

I have written a debug script named “lenovo_add_alert_recipient_debug.py“. lenovo_add_alert_recipient_debug.zip

Please put it in the same directory as "lenovo_add_alert_recipient.py" and execute it with the same parameters as before. A "debug.log" file will be generated in the current execution directory. You can send this "debug.log" file to us.

The IP, user, and password information in the log file has been replaced with *** for privacy.

wyyfly commented 1 month ago

As for the requirements of fw update mentioned below, we are investigating and will inform you of the results.

As an extra question if you can resolve it, is it possible to update firmware like UEFI/BMC using Lenovo's repository? All I've found both in scripts and documentation is a semi-manual update where you need to have the file downloades by yourself beforehand

wyyfly commented 1 month ago

After investigation and testing, the script "update_firmware.py" can specify lenovo's official website address without downloading img in advance. The following is an example:

fw_update

Please contact us if you have any further questions.

Molanito13 commented 1 month ago

Hi

I'm Out of the Office until next Monday.

I'll test everything you sent and answer back as soon as I'm capable of

Thanks for the help!

El jue, 25 jul 2024 a las 8:28, wyyfly @.***>) escribió:

After investigation and testing, the script "update_firmware.py" can specify lenovo's official website address without downloading img in advance. The following is an example: fw_update.png (view on web) https://github.com/user-attachments/assets/313be8d1-235d-4e56-ae47-1b3f8cd76d9e

Please contact us if you have any further questions.

— Reply to this email directly, view it on GitHub https://github.com/lenovo/python-redfish-lenovo/issues/369#issuecomment-2249556192, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALK3RIV7JJSDUID3K3LIBILZOCLJRAVCNFSM6AAAAABLH5CMP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBZGU2TMMJZGI . You are receiving this because you authored the thread.Message ID: @.***>

Molanito13 commented 1 month ago

Hi, I'm testing the debug script you sent me and it works completely fine.

I removed arguments on purpose and it gives me a different error output.

Non debug one image

Debug one image

The lenovo_add_alert_recipient.py used was the latest one in case it could be an older version, it just doesn't recognize the extra arguments. The debug one works completely fine, tested twice with different arguments.

Related to the update_firmware.py script, I've tested and I can download from the repo, however, I don't know how to know the --imageurl to use, because I want to automate it so it's up to date always without even having to check for the URI once in a while, can you get the latest URI of the firmware using a RedFish endpoint or another automated option?

wyyfly commented 1 month ago

The version I am using is the latest one downloaded from here: https://github.com/lenovo/python-redfish-lenovo/blob/master/examples/lenovo_add_alert_recipient.py

To automate getting the latest fw img, you can use the tool OneCli.Can download it from https://datacentersupport.lenovo.com/us/en

The following command can download the latest fw img: _OneCli.exe update acquire --includeid lnvgy_fw_xcc_esx328b-4.51_anyoscomp --scope latest --dir SR650V3LatestFW

The combination of the parameters "includeid" and "scope latest" will download the latest fw package when a new version is released, even if the old id is specified.

image