Not a stupid question at all, let me double check it with the owners of the solution.
We used to pull data, so would be unexpected but need to double check it.
Karl.
Original Message:
Sent: Oct 04, 2023 06:26 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
I wasn't paying enough attention to your error message. If you look closely, youl'll find the following error in it:
Unsubscribed Topic
So please check, if you have enabled streaming for the topic you would like to subscribe in Central.
I disable the monitoring in Central and get 400 error when trying to subscribe to a disabled topic.
python .\simple_app.py--- request header ---GET /streaming/api HTTP/1.1Upgrade: websocketHost: app2-eu.central.arubanetworks.comOrigin: https://app2-eu.central.arubanetworks.comSec-WebSocket-Key: Sec-WebSocket-Version: 13Connection: UpgradeUserName: gorazd.kikelj@selectium.comAuthorization:
Topic: monitoring-------------------------- response header ---HTTP/1.1 400 Bad RequestDate: Wed, 04 Oct 2023 10:27:19 GMTContent-Type: text/plain; charset=utf-8Content-Length: 19Connection: keep-aliveX-Content-Type-Options: nosniffStrict-Transport-Security: max-age=31536000; includeSubDomainsX-Frame-Options: SAMEORIGINX-Request-Start: t=1696415239.266X-XSS-Protection: 1; mode=block-----------------------
Best, Gorazd
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Oct 04, 2023 06:07 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi Karl.
Just a stupid question. Did you check if your stream is activated in Central?

Some documentation for streaming API is in Github and on developers page.
Best, Gorazd
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Oct 04, 2023 05:36 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi Gorazd,
Good point, I haven't tried that yet.
Please, can you let me know the headers needed? by any chance the curl command?
I tried reading the code but was only able to identify the GET request to renew the auth token.
BTW, I've also tried to run the code locally, from my workstation, same result. the only diff is that I'm using python 3.9
Original Message:
Sent: Oct 04, 2023 02:07 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi Karl.
You can try to print the http request and try it with curl to see if it fails.
Can you run just plain wsclient_public.py from your computer to see, if it will work?
Best, Gorazd
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Oct 03, 2023 07:43 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
btw, the code directly runs on the cloud and the outgoing connection to the aruba instances over all the tcp ports are allowed (in the future restricted to only 443/TCP). TBH, I don't think that the issue is introduced by L4 but the application's requests sent to the streaming API, something is causing such bad response:
-----------------------
--- response header ---
HTTP/1.1 400 Bad Request
Date: Tue, 03 Oct 2023 11:41:25 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 19
Connection: keep-alive
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Request-Start: t=1696333285.979
X-XSS-Protection: 1; mode=block
-----------------------
Handshake status 400 Bad Request -+-+- {'date': 'Tue, 03 Oct 2023 11:41:25 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-alive', 'x-content-type-options': 'nosniff', 'strict
-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1696333285.979', 'x-xss-protection': '1; mode=block'} -+-+- b'Unsubscribed Topic\n'
Any inputs to troubleshoot this are welcome.
Original Message:
Sent: Oct 03, 2023 07:37 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
thanks for the suggestion, indeed, similar response:
```
[root@data-publisher-0 streaming-api-client]# python3 simple_app.py
--- request header ---
GET /streaming/api HTTP/1.1
Upgrade: websocket
Host: app-eucentral3.central.arubanetworks.com
Sec-WebSocket-Key: oXJVwQTf9aplTnusuEeeNw==
Sec-WebSocket-Version: 13
Connection: Upgrade
Authorization: XXXXX
Topic: monitoring
-----------------------
--- response header ---
HTTP/1.1 400 Bad Request
Date: Tue, 03 Oct 2023 11:30:34 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 19
Connection: keep-alive
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Request-Start: t=1696332634.340
X-XSS-Protection: 1; mode=block
-----------------------
Handshake status 400 Bad Request -+-+- {'date': 'Tue, 03 Oct 2023 11:30:34 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-alive', 'x-content-type-options': 'nosniff', 'strict
-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1696332634.340', 'x-xss-protection': '1; mode=block'} -+-+- b'Unsubscribed Topic\n'
Handshake status 400 Bad Request -+-+- {'date': 'Tue, 03 Oct 2023 11:30:34 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-alive', 'x-content-type-options': 'nosniff', 'strict
-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1696332634.340', 'x-xss-protection': '1; mode=block'} -+-+- b'Unsubscribed Topic\n' - goodbye
error from callback <function on_close at 0x7fdcf4d9f560>: on_close() takes 1 positional argument but 3 were given
on_close() takes 1 positional argument but 3 were given
```
to execute it working, I just modified the simple client following lines (55, 60 and 62):
```
hostname = "app-eucentral3.central.arubanetworks.com"
url = "wss://{}/streaming/api".format(hostname)
# Construct Header for WebSocket Connection
header = {}
# Central User email
header["UserName"] = "secmon@nestle.com"
# WebSocket Key from Streaming API Page
header["Authorization"] = "XXXX"
```
We've always worked with the advanced client, but as can be seen, the simple one reports the same issue: a bad request performed by the client.
Any ideas where the issue can be?
regards,
karl.
Original Message:
Sent: Oct 03, 2023 06:30 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
For start I would start test with simple_app.py client. Just to see, if everything is ok.
If simple_app.py is working as expected, then you need to look into wsclient_public.py
I did modify my wsclient_public.py to include custom application that receive decoded data.
Also please check your Firewall if it by any chance block traffic to/from Central.
Best, Gorazd
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Oct 03, 2023 06:22 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi,
I was not aware that the input.json file changed, the hostname seems required, thanks for the inputs!
Anyway, I've tried just for monitoring as follows, this is the json "as is" (removing key):
```
{
"customers": {
"Monitoring": {
"username": "secmon@nestle.com",
"wsskey": "XXXX",
"topic": "monitoring",
"hostname": "app-eucentral3.central.arubanetworks.com"
}
}
}
```
but unfortunately the issue, persists, this is the execution.
```
# python3.11 wsclient_public.py --hostname app-eucentral3.central.arubanetworks.com --jsoninput input.json --decode_data
Validating Input Customer Dict...
Websocket server to connect : app-eucentral3.central.arubanetworks.com
CREATE CONNECTION for customer Monitoring...
URL: wss://app-eucentral3.central.arubanetworks.com/streaming/api
HEADERS:
{'UserName': 'secmon@nestle.com', 'Authorization': 'XXXXX' 'Topic': 'monitoring'}
Traceback (most recent call last):
File "/scripts/asac/central-python-workflows/streaming-api-client/wsclient_public.py", line 315, in <module>
conn = get_websocket_connection(args.hostname,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/scripts/asac/central-python-workflows/streaming-api-client/wsclient_public.py", line 230, in get_websocket_connection
raise err
File "/scripts/asac/central-python-workflows/streaming-api-client/wsclient_public.py", line 209, in get_websocket_connection
conn = create_connection(url, header=header)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websocket/_core.py", line 610, in create_connection
websock.connect(url, **options)
File "/usr/local/lib/python3.11/site-packages/websocket/_core.py", line 255, in connect
self.handshake_response = handshake(self.sock, url, *addrs, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websocket/_handshake.py", line 57, in handshake
status, resp = _get_resp_headers(sock)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websocket/_handshake.py", line 150, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status {status} {message} -+-+- {headers} -+-+- {body}".format(status=status, message=status_message, headers=resp_headers, body=response_body), status, status_message, resp
_headers, response_body)
websocket._exceptions.WebSocketBadStatusException: Handshake status 400 Bad Request -+-+- {'date': 'Tue, 03 Oct 2023 10:17:05 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-a
live', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1696328225.856', 'x-xss-protection': '1; mode=block'} -
+-+- b'Unsubscribed Topic\n'
[root@data-publisher-0 streaming-api-client]#
```
We might be closer, any hints?
Thank you very much,
regards,
karl.
Original Message:
Sent: Oct 03, 2023 06:04 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi Karl.
Your input.json will need to look like that:
{ "customers": { "Monitoring": { "username": "user", "wsskey": "key", "topic": "monitoring", "hostname": "app2-eu.central.arubanetworks.com" }, "Audit": { "username": "user", "wsskey": "key", "topic": "audit", "hostname": "app2-eu.central.arubanetworks.com" }, "Security": { "username": "user", "wsskey": "key", "topic": "security", "hostname": "app2-eu.central.arubanetworks.com" }, "Location": { "username": "user", "wsskey": "key", "topic": "location", "hostname": "app2-eu.central.arubanetworks.com" }, "Presence": { "username": "user", "wsskey": "key", "topic": "presence", "hostname": "app2-eu.central.arubanetworks.com" }, "AppRf": { "username": "user", "wsskey": "key", "topic": "apprf", "hostname": "app2-eu.central.arubanetworks.com" } }}
and then you will see wss connections established for each stream like:
2023-10-03 11:46:25,014 : INFO : wsclient_public 335 : Start WSCLIENT_PUBLIC.PY ----------------2023-10-03 11:46:25,018 : INFO : wsclient_public 133 : Validating Input Customer Dict...2023-10-03 11:46:25,018 : INFO : wsclient_public 343 : Websocket server Selectium-Monitoring to connect : app2-eu.central.arubanetworks.com2023-10-03 11:46:25,019 : INFO : wsclient_public 211 : CREATE CONNECTION for customer Selectium-Monitoring...2023-10-03 11:46:25,019 : DEBUG : wsclient_public 217 : URL: wss://app2-eu.central.arubanetworks.com/streaming/api2023-10-03 11:46:32,717 : INFO : wsclient_public 233 : Connection established for customer Selectium-Monitoring !2023-10-03 11:46:32,719 : INFO : wsclient_public 343 : Websocket server Selectium-Audit to connect : app2-eu.central.arubanetworks.com2023-10-03 11:46:32,720 : INFO : wsclient_public 211 : CREATE CONNECTION for customer Selectium-Audit...2023-10-03 11:46:32,720 : DEBUG : wsclient_public 217 : URL: wss://app2-eu.central.arubanetworks.com/streaming/api2023-10-03 11:46:38,125 : INFO : wsclient_public 233 : Connection established for customer Selectium-Audit !2023-10-03 11:46:38,125 : INFO : wsclient_public 343 : Websocket server Selectium-Security to connect : app2-eu.central.arubanetworks.com2023-10-03 11:46:38,125 : INFO : wsclient_public 211 : CREATE CONNECTION for customer Selectium-Security...2023-10-03 11:46:38,125 : DEBUG : wsclient_public 217 : URL: wss://app2-eu.central.arubanetworks.com/streaming/api2023-10-03 11:46:44,626 : INFO : wsclient_public 233 : Connection established for customer Selectium-Security !2023-10-03 11:46:44,626 : INFO : wsclient_public 343 : Websocket server Selectium-Location to connect : app2-eu.central.arubanetworks.com2023-10-03 11:46:44,626 : INFO : wsclient_public 211 : CREATE CONNECTION for customer Selectium-Location...2023-10-03 11:46:44,626 : DEBUG : wsclient_public 217 : URL: wss://app2-eu.central.arubanetworks.com/streaming/api2023-10-03 11:46:50,047 : INFO : wsclient_public 233 : Connection established for customer Selectium-Location !2023-10-03 11:46:50,047 : INFO : wsclient_public 343 : Websocket server Selectium-Presence to connect : app2-eu.central.arubanetworks.com2023-10-03 11:46:50,047 : INFO : wsclient_public 211 : CREATE CONNECTION for customer Selectium-Presence...2023-10-03 11:46:50,047 : DEBUG : wsclient_public 217 : URL: wss://app2-eu.central.arubanetworks.com/streaming/api2023-10-03 11:46:57,637 : INFO : wsclient_public 233 : Connection established for customer Selectium-Presence !2023-10-03 11:46:57,637 : INFO : wsclient_public 343 : Websocket server Selectium-AppRf to connect : app2-eu.central.arubanetworks.com2023-10-03 11:46:57,638 : INFO : wsclient_public 211 : CREATE CONNECTION for customer Selectium-AppRf...2023-10-03 11:46:57,638 : DEBUG : wsclient_public 217 : URL: wss://app2-eu.central.arubanetworks.com/streaming/api2023-10-03 11:47:04,078 : INFO : wsclient_public 233 : Connection established for customer Selectium-AppRf !2023-10-03 11:47:04,079 : INFO : wsclient_public 288 : Start time for customer Selectium-Monitoring: 1696326424.079898
And as expected you will receive subscribed topics.
2023-10-03 11:47:04,857 : DEBUG : wsclient_public 319 : Decoded data for customer Monitoring{'customer_id': 'xxx', 'data': {'customer_id': 'xxx', 'data_elements': ['STATE_SWITCH'], 'switches': [{'action': 'UPDATE', 'default_gateway': {'addr': 'xxx', 'af': 'ADDR_FAMILY_INET'}, 'device_mode': 0, 'firmware_version': 'WC.16.11.0013_422', 'ip_address': {'addr': 'xxx', 'af': 'ADDR_FAMILY_INET'}, 'macaddr': {'addr': 'xxx'}, 'model': 'Aruba2930M-40G-8SR-PoE+ Switch(JL323A)', 'name': '2930M', 'power_supplies': [{'index': 1, 'status': 'OK'}], 'public_ip_address': {'addr': 'xxx', 'af': 'ADDR_FAMILY_INET'}, 'serial': 'xxx', 'status': 'UP'}], 'timestamp': 1696276379}, 'msp_ip': '', 'timestamp': 1696276379240327402, 'topic': 'monitoring'}2023-10-03 11:52:28,713 : DEBUG : wsclient_public 319 : Decoded data for customer Audit{'customer_id': '...', 'data': {'client_ip': {'addr': '..., 'af': 'ADDR_FAMILY_INET'}, 'config_info': {'data': 'Access point configuration sync successful'}, 'customer_id': '...', 'group_name': 'Selectium Aruba 10', 'service': 'CONFIGURATION', 'target': '...', 'timestamp': 1696326748, 'username': 'System'}, 'msp_ip': '', 'timestamp': 1696326748690300122, 'topic': 'audit'}
Best, Gorazd
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Oct 03, 2023 05:45 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi Gorazd,
Thanks for highlighting that limitation, I used to think that only applied to the basic client and not the advanced one.
Anyway, I am not there yet, I am just testing with 1 topic - the monitoring one through the input.json file, similar as follows:
```
{
"customers": {
"nestlecsoc-monitoring": {
"username": "email@domain.com",
"wsskey": "xxxx",
"topic": "monitoring"
}
}
```
While it's truth that multiple topics can be configured on the advanced client, we'd prefer to just deploy another container instance where the topic changes, it'd be instructed as a variable.
However, we are dealing with a dependency issue that's not easy to troubleshoot .. and at large scale is a pain. I would like to know if there are any other alternatives to pull the data of the audit and security topics.
thank you,
best regards,
karl.
Original Message:
Sent: Oct 03, 2023 05:28 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
There is a limitation on how many topics you can have per wss connection.
- Only one topic per WSS connection is supported. To stream multiple topics, create multiple WSS connections.
If you define subscription like:
header["Topic"] = "security,monitoring,audit"
it won't work and will return 400 error. You need to define only one topic for subscription.
header["Topic"] = "security"
For each topic you need to run a separate process.
Docs are here.
# Define subscriptions like: header["Topic"] = "security,monitoring,audit"
python .\simple_app.py--- request header ---GET /streaming/api HTTP/1.1Upgrade: websocketHost: app2-eu.central.arubanetworks.comOrigin:
https://app2-eu.central.arubanetworks.com
Sec-WebSocket-Key: Sec-WebSocket-Version: 13Connection: UpgradeUserName: xxxxAuthorization: Topic: monitoring,audit,security-------------------------- response header ---HTTP/1.1 400 Bad RequestDate: Tue, 03 Oct 2023 09:12:27 GMTContent-Type: text/plain; charset=utf-8Content-Length: 19Connection: keep-aliveX-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINX-Request-Start: t=1696324347.176X-XSS-Protection: 1; mode=block-----------------------Handshake status 400 Bad Request -+-+- {'date': 'Tue, 03 Oct 2023 09:12:27 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-alive', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1696324347.176', 'x-xss-protection': '1; mode=block'} -+-+- b'Unsubscribed Topic\n'Handshake status 400 Bad Request -+-+- {'date': 'Tue, 03 Oct 2023 09:12:27 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-alive', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1696324347.176', 'x-xss-protection': '1; mode=block'} -+-+- b'Unsubscribed Topic\n' - goodbye### closed #### Only single topic: ----------------------------------------------------------------------python .\simple_app.py--- request header ---GET /streaming/api HTTP/1.1Upgrade: websocketHost: app2-eu.central.arubanetworks.comOrigin:
https://app2-eu.central.arubanetworks.com
Sec-WebSocket-Key: Sec-WebSocket-Version: 13Connection: UpgradeUserName: Authorization: Topic: audit-------------------------- response header ---HTTP/1.1 101 Switching ProtocolsDate: Tue, 03 Oct 2023 09:15:51 GMTConnection: upgradeUpgrade: websocketSec-WebSocket-Accept: Strict-Transport-Security: max-age=31536000; includeSubDomainsX-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINX-XSS-Protection: 1; mode=block-----------------------Websocket connectedStart Streaming Data!
Best, Gorazd
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Oct 03, 2023 04:30 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi,
I have tried again with a brand new container, to avoid limitations running as root but once ready will drop priv.
I am using the last version of the repo and same requirements as you but python 3.11, created from the scratch:
```
[root@data-publisher-0 streaming-api-client]# python3 --version
Python 3.11.2
[root@data-publisher-0 streaming-api-client]# pip3 --version
pip 23.2.1 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
[root@data-publisher-0 streaming-api-client]#
[root@data-publisher-0 streaming-api-client]# cat requirements.txt
gevent
greenlet
protobuf
six
requests
websocket-client
rel
[root@data-publisher-0 streaming-api-client]# pip3 install -r requirements.txt
Requirement already satisfied: gevent in /usr/local/lib64/python3.11/site-packages (from -r requirements.txt (line 1)) (23.9.1)
Requirement already satisfied: greenlet in /usr/local/lib64/python3.11/site-packages (from -r requirements.txt (line 2)) (3.0.0)
Requirement already satisfied: protobuf in /usr/local/lib64/python3.11/site-packages (from -r requirements.txt (line 3)) (4.24.3)
Requirement already satisfied: six in /usr/local/lib/python3.11/site-packages (from -r requirements.txt (line 4)) (1.16.0)
Requirement already satisfied: requests in /usr/local/lib/python3.11/site-packages (from -r requirements.txt (line 5)) (2.31.0)
Requirement already satisfied: websocket-client in /usr/local/lib/python3.11/site-packages (from -r requirements.txt (line 6)) (1.6.3)
Requirement already satisfied: rel in /usr/local/lib/python3.11/site-packages (from -r requirements.txt (line 7)) (0.4.9)
Requirement already satisfied: zope.event in /usr/local/lib/python3.11/site-packages (from gevent->-r requirements.txt (line 1)) (5.0)
Requirement already satisfied: zope.interface in /usr/local/lib64/python3.11/site-packages (from gevent->-r requirements.txt (line 1)) (6.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib64/python3.11/site-packages (from requests->-r requirements.txt (line 5)) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/site-packages (from requests->-r requirements.txt (line 5)) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/site-packages (from requests->-r requirements.txt (line 5)) (2.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/site-packages (from requests->-r requirements.txt (line 5)) (2023.7.22)
Requirement already satisfied: setuptools in /usr/lib/python3.11/site-packages (from zope.event->gevent->-r requirements.txt (line 1)) (65.5.1)
```
Unfortunately, no changes and the output is the same:
```
File "/usr/local/lib/python3.11/site-packages/websocket/_handshake.py", line 150, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status {status} {message} -+-+- {headers} -+-+- {body}".format(status=status, message=status_message, headers=resp_headers, body=response_body), status, status_message, resp
_headers, response_body)
websocket._exceptions.WebSocketBadStatusException: Handshake status 400 Bad Request -+-+- {'date': 'Tue, 03 Oct 2023 08:19:18 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-a
live', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1696321158.354', 'x-xss-protection': '1; mode=block'} -
+-+- b'Unsubscribed Topic\n'
```
The issue might be introduced by the websocket client or the code itself, but tbh no idea where and how to solve it.
Do you know any other alternatives to pull the audit and security topics?
maintaining this kind of custom clients with such inconsistency is not desired.
Thanks in advance,
regards,
Karl.
Original Message:
Sent: Sep 28, 2023 04:06 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi Karl.
I's mostly default:
gevent
greenlet
protobuf
six
requests
websocket-client
rel
and I'm on python 3.10.12
Best, Gorazd
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Sep 28, 2023 04:00 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Dear Gorazd,
Thanks for sharing your inputs, then we can discard an issue on the Streaming API, I'm also using the EU instance.
May I know what's the content of your requirement.txt and python version?
In my case I'm using the requirements.txt as previously shared and Python 3.9.12.
Thanks in advance,
Regards,
Karl.
Original Message:
Sent: Sep 28, 2023 01:43 AM
From: GorazdKikelj
Subject: Aruba Central Streaming API Client Failed due to Bad Request
I just checked with EU cluster and it is working fine.
2023-09-28 07:35:49,146 : INFO : wsclient_public 335 : Start WSCLIENT_PUBLIC.PY ----------------2023-09-28 07:35:49,208 : INFO : wsclient_public 133 : Validating Input Customer Dict...2023-09-28 07:35:49,209 : INFO : wsclient_public 343 : Websocket server Selectium-Monitoring to connect : app-eucentral3.central.arubanetworks.com2023-09-28 07:35:49,209 : INFO : wsclient_public 211 : CREATE CONNECTION for customer Selectium-Monitoring...2023-09-28 07:35:49,209 : DEBUG : wsclient_public 217 : URL: wss://app-eucentral3.central.arubanetworks.com/streaming/api2023-09-28 07:35:49,354 : WARNING : wsclient_public 237 : Attempting to retry connection...2023-09-28 07:35:49,354 : INFO : wsclient_public 174 : Validating wss key....2023-09-28 07:35:49,358 : DEBUG : connectionpool 973 : Starting new HTTPS connection (1): app-eucentral3.central.arubanetworks.com:4432023-09-28 07:35:49,572 : DEBUG : connectionpool 452 :
https://app-eucentral3.central.arubanetworks.com:443
"GET /streaming/token/validate HTTP/1.1" 200 1982023-09-28 07:35:49,575 : DEBUG : wsclient_public 217 : URL: wss://app-eucentral3.central.arubanetworks.com/streaming/api2023-09-28 07:35:49,937 : INFO : wsclient_public 233 : Connection established for customer Selectium-Monitoring !2023-09-28 07:35:49,938 : INFO : wsclient_public 288 : Start time for customer Selectium-Monitoring: 1695879349.9380066...2023-09-28 07:35:52,884 : DEBUG : wsclient_public 319 : Decoded data for customer Selectium-Monitoring{'customer_id': '5a389090503d4bc79ea685a6a6599053', 'data': {'customer_id': '5a389090503d4bc79ea685a6a6599053', 'data_elements': ['STAT_DEVICE'], 'device_stats': [{'cpu_utilization': 10, 'device_id': 'CNLVL2H01Z', 'mem_free': '3548960768', 'mem_total': '7941328896', 'timestamp': 1695879300, 'uptime': '5217181'}], 'timestamp': 1695879314}, 'msp_ip': '', 'timestamp': 1695879314607199613, 'topic': 'monitoring'}
------------------------------
Gorazd Kikelj
MVP Expert 2023
Original Message:
Sent: Sep 27, 2023 08:18 AM
From: Karl.alfaro
Subject: Aruba Central Streaming API Client Failed due to Bad Request
Hi All,
We have realized that (at least) since Sept 14th, the "wsclient_public.py" python client for the Aruba Central streaming API is no longer working due to a bad request:
File "/dev_py/aruba/lib/python3.9/site-packages/websocket/_handshake.py", line 150, in _get_resp_headers raise WebSocketBadStatusException("Handshake status {status} {message} -+-+- {headers} -+-+- {body}".format(status=status, message=status_message, headers=resp_headers, body=response_body), status, status_message, resp_headers, response_body)websocket._exceptions.WebSocketBadStatusException: Handshake status 400 Bad Request -+-+- {'date': 'Fri, 15 Sep 2023 08:40:34 GMT', 'content-type': 'text/plain; charset=utf-8', 'content-length': '19', 'connection': 'keep-alive', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-frame-options': 'SAMEORIGIN', 'x-request-start': 't=1694767234.499', 'x-xss-protection': '1; mode=block'} -+-+- b'Unsubscribed Topic\n'
We haven't introduced a change on the client side and it is being executed as follows:
python3 wsclient_public.py --hostname <aruba-central-instance>.central.arubanetworks.com --jsoninput input.json --decode_data
We've also ensured to use the last version available and the issue persist, the only change is the requirement.txt file which is based on the github's PR #36
FYI, this is the actual requirements.txt that we are using:
certifi==2023.7.22charset-normalizer==3.2.0gevent==23.9.1greenletidna==3.4protobuf==4.24.3requests==2.31.0six==1.16.0urllib3==2.0.5websocket-client==1.6.3zope.event==5.0zope.interface==6.0
Has anyone faced this issue?
Thank you very much,
Best regards,
Karl.