|
Post by abula on Jun 9, 2022 1:49:05 GMT
Hi all, I am new to Redfish, and I'm trying on the event subscription function.
I had confirm that the GET and POST redfish/v1/EventService/Subscriptions functions were succeed, and also GET redfish/v1/EventService/Subscriptions/{id} function for sure.
Here is my question, my device does not support redfish/v1/EventService/SSE or action for testing the event, how can I check my device for the event notification for example alert events or any log about the event trigger? Thanks.
Best Regards, Ryan
|
|
|
Post by mraineri on Jun 9, 2022 13:38:53 GMT
Unfortunately the "SubmitTestEvent" action is really the only method to deterministically test your subscription. Beyond that, you would need to induce conditions on the system that produce events (perhaps removing a device while the system is running or performing reset operations), but this would also require an understanding of what real conditions produce events on your device.
It may be worth providing feedback to your vendor to support the "SubmitTestEvent" action.
|
|
|
Post by abula on Jun 10, 2022 1:53:54 GMT
Thanks for your reply. So the success of creating the subscription does not mean that my device will send out the event notification when the event triggers right? Must my device support the "SubmitTestEvent" action when it sends out the event notification? (Not only for the testing) How about using "Redfish-Event-Listener"? Thanks.
|
|
|
Post by mraineri on Jun 13, 2022 13:00:14 GMT
The "SubmitTestEvent" action is not needed for eventing in general; it's just used as an aid to help client developers test their software. Without the action, you'll still receive event notifications.
The Redfish-Event-Listener is a simple event client. You can certainly use it for your own purposes to listen to events, but the tool does not make use of the SubmitTestEvent action.
|
|
|
Post by abula on Jun 14, 2022 1:28:42 GMT
Where could I find the event notification received from the subscription? Is it in the PATH "redfish/v1/Managers/1/LogServices/1/Entries" of the log service collection? I got the log of "Port plug in", "Temperatures/4 has exceeded its warning threshold of value 45.000000", "PSU plug in" etc. But all of them were the EntryTypes of "Event", how could I check for the EntryType of "Alert"? Thanks.
|
|
|
Post by mraineri on Jun 14, 2022 12:48:11 GMT
The only way to know if the event was received by the subscriber would be to check the listener's logs. When an event is generated by the service, it may not produce an entry in its own LogService. Event notifications can be far more verbose than what you might find in a log on the service. So, if you're using the Redfish-Event-Listener tool, you would see the "Events_<ServiceAddress>.txt" updated with new events.
|
|
|
Post by abula on Jun 15, 2022 10:17:26 GMT
I'm trying the Redfish-Event-Listener now, although the README.md write in detail, I still have some trouble with it. I have prepared a terminal 10.69.3.156 as the device manager and 10.69.3.12 as the device. When I POST an event subscription, what does the "Destination" have to be in the JSON body? Is it the IP address of the device and the device's listening port? And is it the same in "Destination" in [SubscriptionDetails] in the Redfish-Event-Listener tool? Is it correct that "ListenerIP" in [SystemInformation] is my device manager IP? What is the info of [ServerInformation] should be? Is that the redfish account or just the device's account? Thanks.
|
|
|
Post by mraineri on Jun 15, 2022 12:50:30 GMT
Destination will be a URI where the listener is going to accept the Redfish events. The Redfish-Event-Listener should be subscribing for you automatically, so you don't need to perform an additional POST to make your subscription. So, in your case, if your listener's IP address is 10.69.3.12, then you would use "https://10.69.3.12" or "http://10.69.3.12" as the Destination (depending on how you have "UseSSL" configured in your config file). You would also need to include the port number in the URI if you're not using standard ports for HTTP or HTTPS (such as "https://10.69.3.12:8080" if you've configured the listener's port to 8080).
|
|
|
Post by abula on Jun 16, 2022 10:15:23 GMT
My listener IP would be 10.69.3.156, and my redfish device would be 10.110.85.1:8888. I'm modifying the config.ini, is it correct as the below?
[Information]
Updated = April 24, 2017
Description = Redfish Event Listener Tool
[SystemInformation]
ListenerIP = 0.0.0.0
ListenerPort = 80
UseSSL = off
[CertificateDetails]
certfile = cert.pem
keyfile = server.key
[SubscriptionDetails]
Destination = http://10.69.3.156
EventTypes = [
"Alert",
"ResourceRemoved",
"ResourceAdded"]
Context = Public
Format = Event
Expand = false
ResourceTypes = ["Chassis"]
Registries =
[ServerInformation]
ServerIPs = ["https://10.110.85.1:8888"] But I got this as the below, is it an error in the setting or the connection?
Redfish Event Listener v1.1.2
ServerIP:: https://10.110.85.1:8888
UserName:: admin
Attempt 1 of /redfish/v1/
Response Time for GET to /redfish/v1/: 0.02725977399677504 seconds.
Attempt 1 of /redfish/v1/SessionService/Sessions
Response Time for POST to /redfish/v1/SessionService/Sessions: 0.022142703994177282 seconds.
Login returned code 201: {"@odata.context":"/redfish/v1/$metadata#Session.Session","@odata.id":"/redfish/v1/SessionService/Sessions/c6e08ef3bc3350c1","@odata.type":"#Session.v1_0_0.Session","Name":"User Session","Description":"User Session","UserName":"admin","Id":"c6e08ef3bc3350c1"}
Attempt 1 of /redfish/v1/
Response Time for GET to /redfish/v1/: 0.0018912560044554994 seconds.
Unable to subscribe for events with https://10.110.85.1:8888
Traceback (most recent call last):
File "RedfishEventListener_v1.py", line 263, in <module>
response = redfish_utilities.create_event_subscription(my_ctx, config['destination'],
File "/home/alpha/.local/lib/python3.8/site-packages/redfish_utilities/event_service.py", line 181, in create_event_subscription
event_service = get_event_service( context )
File "/home/alpha/.local/lib/python3.8/site-packages/redfish_utilities/event_service.py", line 44, in get_event_service
raise RedfishEventServiceNotFoundError( "Service does not contain an event service" )
redfish_utilities.event_service.RedfishEventServiceNotFoundError: Service does not contain an event service
None
Continuing with Listener.
Listening on 0.0.0.0:80 via HTTP
Press Ctrl-C to close program
Traceback (most recent call last):
File "RedfishEventListener_v1.py", line 311, in <module>
socket_server = socket.create_server(my_host, family=family)
File "/usr/bin/python-3.8.0/lib/python3.8/socket.py", line 886, in create_server
raise error(err.errno, msg) from None
PermissionError: [Errno 13] Permission denied (while attempting to bind on address ('0.0.0.0', 80))
Thanks for helping.
|
|
|
Post by mraineri on Jun 16, 2022 12:15:07 GMT
According to the error message I see, it looks like the service you have doesn't event support event notifications. The Redfish-Event-Listenter hits that condition when "EventService" is not reported in the service root. The fact that you've been able to POST to the subscription collection yourself makes me think there might be something non-conformant with the service you have. Can you provide the output of the following curl requests?
curl -k -u USERNAME:PASSWORD https://10.110.85.1:8888/redfish/v1/ curl -k -u USERNAME:PASSWORD https://10.110.85.1:8888/redfish/v1/EventService
|
|
|
Post by abula on Jun 17, 2022 1:27:27 GMT
Here is the output of the command, is that the problem with the proxy?
curl -k -u UserName:Password https://10.110.85.1:8888/redfish/v1/
curl: (56) Received HTTP code 502 from proxy after CONNECT
curl -k -x "" -u UserName:Password https://10.110.85.1:8888/redfish/v1/ | json_pp
{
"Links" : {
"Sessions" : {
"@odata.id" : "/redfish/v1/SessionService/Sessions"
}
},
"Id" : "RootService",
"Managers" : {
"@odata.id" : "/redfish/v1/Managers"
},
"@odata.context" : "/redfish/v1/$metadata#ServiceRoot.ServiceRoot",
"Description" : "Service Root description",
"Chassis" : {
"@odata.id" : "/redfish/v1/Chassis"
},
"@odata.id" : "/redfish/v1",
"@odata.type" : "#ServiceRoot.v1_1_1.ServiceRoot",
"SessionService" : {
"@odata.id" : "/redfish/v1/SessionService"
},
"UUID" : "7b2564e4-ed4e-11ec-8d15-7fa79864bf77",
"Name" : "PSME Service Root",
"RedfishVersion" : "1.0.2",
"AccountService" : {
"@odata.id" : "/redfish/v1/AccountService"
}
}
curl -k -x "" -u UserName:Password https://10.110.85.1:8888/redfish/v1/EventService | json_pp
{
"@odata.type" : "#EventService.v1_0_0.EventService",
"Id" : "EventService",
"Name" : "Event Service",
"DeliveryRetryIntervalSeconds" : 60,
"Actions" : {
"Oem" : {}
},
"@odata.context" : "/redfish/v1/$metadata#EventService.EventService",
"Description" : "Event Service description",
"EventTypesForSubscription" : [
"ResourceAdded",
"ResourceRemoved",
"Alert"
],
"ServiceEnabled" : true,
"Status" : {
"HealthRollup" : "OK",
"Health" : "OK",
"State" : "Enabled"
},
"DeliveryRetryAttempts" : 3,
"Oem" : {},
"@odata.id" : "/redfish/v1/EventService",
"Subscriptions" : {
"@odata.id" : "/redfish/v1/EventService/Subscriptions"
}
}
Thanks.
|
|
|
Post by mraineri on Jun 17, 2022 13:43:37 GMT
It does not appear to be a proxy issue. The output confirms my suspicion though; the service root resource is not correctly showing the path to the event service. It's clearly supported based on the fact you're getting a response from "/redfish/v1/EventService", but clients need the ability to discover it from service root. It would be good to raise this issue with the vendor since this is not correct behavior.
However, we should be able to work around it for now. The Redfish-Event-Listener can still listen for events while not subscribing to the service. Essentially you will need to invoke the POST operation to tell the service the location of the listener. Using the information you've provided so far, it would look like this:
POST /redfish/v1/EventService/Subscriptions
{ "Destination": "http://10.69.3.156", "Protocol": "Redfish", "Context": "Public" } Other properties in the POST request can be added to fine-tune what is sent back; the above subscription will subscribe to all events.
In the configuration file for the Redfish-Event-Listener, you will need to set all options in "ServerInformation" to be empty arrays. When they're empty arrays, the listener will not attempt to subscribe to anything.
[ServerInformation] ServerIPs = [] UserNames = [] Passwords = [] Lastly, it appears Linux requires root privileges to use lower order socket operations, so when running the listener, run it with "sudo".
|
|
|
Post by abula on Jun 20, 2022 2:42:15 GMT
Let me make sure I have it right. The situation now is that my device has the event service and the event subscription service. Still, I can't get the event notification because of the missing path to the event service.
Thanks.
|
|
|
Post by mraineri on Jun 20, 2022 15:01:30 GMT
If you're going to rely on the Redfish-Event-Listener to set up the subscription, yes, that's the issue. By default, the Redfish-Event-Listener will follow the path from service root to discover the event service and the subscription collection.
However, if you're able to manually create subscriptions on behalf of the Redfish-Event-Listener like I described in my previous post, you should be able to receive notifications.
|
|
|
Post by abula on Jun 21, 2022 1:27:20 GMT
Got it! I can receive notifications now. Thanks for your assistance.
|
|