You can get streaming statistical data from the endpoint wss://host-or-ip/ws/stats. The data from the WebSocket is framed oddly, it’s actually a streaming protocol that has been sent and received over WebSocket. The data will not arrive like you might expect. You MUST reassemble the web socket data fragments since the frames may not align with data boundaries. Commands must be sent with a valid SESSION_ID.
The format of data to and from the WebSocket stream is LENGTH\nJSON_PAYLOAD\n. Line feeds are Linux line feeds (e.g. \n).
When the SESSION_ID times out the WebSocket will abruptly close so it’s recommended to refresh it occasionally.
No data will be received by the socket until the user requests a subscription to a selection of message types.
| Name | Type | Values | Description |
|---|---|---|---|
|
Array (Object) |
Array of |
An array of objects to represent individual specific MessageTypes to subscribe to and their parameters. |
|
Array (Object) |
Array of |
An array of objects to represent individual specific MessageTypes to unsubscribe from and their parameters. |
|
String |
String |
The authorisation string for this session to confirm the user is correctly authenticated. |
| Name | Type | Values | Description |
|---|---|---|---|
|
String |
String |
The |
249
{"SUBSCRIBE":[{"name":"export"},{"name":"discover"},{"name":"pon-stats"},{"name":"interfaces"},{"name":"system-stats"},{"name":"num-routes"},{"name":"config-change"},{"name":"users"}],"UNSUBSCRIBE":[],"SESSION_ID":"b5d5cfdb326c484abb00ca0d9effffff"}Return values from the stream follow a similar format.
104
{
"system-stats":
{
"cpu": "10",
"uptime": "57864",
"mem": "60"
}
}The web UI sends a ping every 30 seconds which consists of the following:
66
{"CLIENT_PING":"","SESSION_ID":"f989665499eb406b8600fd50bf1971bc"}|
Warning
|
Failure to send a properly formed subscription request will continue to result in no messages being sent from the server. |
Each one of these subscriptions will output data with the response being full JSON objects.
| Name | Subscription String | Description |
|---|---|---|
|
Returns only when EdgeOS is processing a configuration change. |
|
|
Periodic messages containing results from any devices discovered (typically via UBNT Discovery). |
|
|
Periodic messages containing network interface information for each of the EdgeOS network interfaces. |
|
|
Periodic messages containing counts of the EdgeOS network routes. |
|
|
Periodic messages containing system statistics about the EdgeOS device |
|
|
Periodic messages containing Traffic Analysis (aka DPI) information. |
|
|
Periodic messages listing the users logged into the EdgeOS device (including via SSH, Web and VPN). |
|
|
Periodic messages containing device statistics in a specific Ubiquiti Device API (UDAPI) format, used by UNMS. |
Each one of these endpoints just dumps the raw console output data within a string {'[Request sub_id]': '<line of text>\n' }
These are subscribed to in the same way as the JSON subscriptions above but while no additional parameters may need to be specified the SubscriptionParameters schema is extended to attribute specific console responses to specific requests.
| Name | Subscription String | Description |
|---|---|---|
|
Basically a |
|
|
Returns per-rule NAT stats. |
|
|
Contains the statistics from Port Forwarding. |
Each one of these endpoints just dumps the raw console output data within a string {'[Request sub_id]': '<line of text>\n' }
These are subscribed to in the same way as the JSON subscriptions above but some additional parameters may need to be specified.
| Name | Subscription String | Description |
|---|---|---|
|
Performs or hosts a bandwidth test (using |
|
|
Returns periodic firewall statistics. |
|
|
Performs a ping. |
|
|
Performs a |
|
|
Performs a packet capture (using |
There are also the following endpoints that not much is known about (it’s likely the implementation has been removed from ubnt-util but have been left over in the web UI):
| Name | Subscription String | Description |
|---|---|---|
LLDP Neighbours (not present in web UI) |
|
Information about Link Layer Discovery Protocol (LLDP) connected neighbours. |
NNI Statistics (not present in |
|
Lists Network to Network Interface (NNI) statistics. |
ONU List (not present in |
|
Lists Optical Network Unit (ONU) details. |
PON Statistics (not present in |
|
Lists Passive Optical Network (PON) statistics. |