DMTF / Redfish-Tacklebox

Python based utilities for performing common management operations with Redfish
Other
52 stars 25 forks source link

How to key Protocol when create subscription with rf_event_service.py #138

Open FelixD999 opened 9 months ago

FelixD999 commented 9 months ago

Hi, As far as I know Destination and Protocol are necessary to create a subscription, but I don't know how to enter the value about Protocol when creating the subscription. Not sure if the failure to send the command is related to missing necessary parameters. fail

Attached the request body about creating Subscription via Redfish: { "Context": "Event_Sub", "Destination": "https://192.168.0.110:4443", "Protocol": "Redfish", "EventFormatType": "Event", "ResourceTypes": [ "EventService", "Systems", "AccountService", "TelemetryService", "Chassis", "Managers", "TaskService" ], "RegistryPrefixes": [ "EventLog", "IPMI", "HttpStatus", "SyncAgent", "Security", "Base", "Task" ] }

Thanks, Felix

mraineri commented 9 months ago

Right now the tool automatically puts in "Redfish" for you; it's not provided as an option.

This is where the payload is built for the subscription request: https://github.com/DMTF/Redfish-Tacklebox/blob/79878d00a7885cf5742c4995bd10186bf9b1b879/redfish_utilities/event_service.py#L187

It starts with just the provided destination and fills in Protocol to always be Redfish, then optionally fills in other properties based on whatever else is provided by the user.

If you add --debug to the script input, it'll produce a log file with HTTP traces to show exactly what is sent/received.

mraineri commented 9 months ago

But at least from the error message on the console, it looks like either EventTypes isn't supported by the service or one of the values provided isn't supported.

mraineri commented 9 months ago

It's also possible you're hitting an old bug from a few years ago where the tool was always sending "EventTypes" as part of the payload. Given your sample script input, you're clearly not specifying EventTypes.

Can you check your version of Tacklebox? The issue I'm thinking of was fixed in 1.2.9.

FelixD999 commented 9 months ago

Thanks for your help and answers! I checked the version is the latest "3.2.3" and code also have be fixed but still have error message. scripts__rf_event_service

mraineri commented 9 months ago

Can you try with --debug and provide the .log file generated?

FelixD999 commented 9 months ago

I refer the --help info, but I'm not sure how to add --debug correctly, Could you help correct me? debug

mraineri commented 9 months ago

Are you sure you have the latest version of the tool? It looks like you're using an older version. With how you're invoking the tool, it will run from the installation and not from the source code you've checked out.

$ pip3 show redfish_utilities
Name: redfish-utilities
Version: 3.2.4
Summary: Redfish Utilities
Home-page: https://github.com/DMTF/Redfish-Tacklebox
Author: DMTF, https://www.dmtf.org/standards/feedback
Author-email: 
License: BSD 3-clause "New" or "Revised License"
Location: /usr/local/lib/python3.11/dist-packages
Requires: redfish, XlsxWriter
Required-by: 

$ rf_event_service.py --help
usage: rf_event_service.py [-h] --user USER --password PASSWORD --rhost RHOST [--debug] {info,subscribe,unsubscribe} ...

A tool to manage the event service on a Redfish service

positional arguments:
  {info,subscribe,unsubscribe}
    info                Displays information about the event service and subscriptions
    subscribe           Creates an event subscription to a specified URL
    unsubscribe         Deletes an event subscription

options:
  -h, --help            show this help message and exit
  --user USER, -u USER  The user name for authentication
  --password PASSWORD, -p PASSWORD
                        The password for authentication
  --rhost RHOST, -r RHOST
                        The address of the Redfish service (with scheme)
  --debug               Creates debug file showing HTTP traces and exceptions