Monitor network events
Last updated May 24th, 2024
The Knox Asset Intelligence APIs enable you to monitor network behavior of devices, allowing you to gather valuable data about network performance and track connectivity issues. This tutorial shows you how to retrieve the details of Wi-Fi connection and disconnection events.
Additionally, connection or disconnection of Wi-Fi leads to an event upload by Knox Asset Intelligence. You can subscribe to corresponding Knox Webhook Notification events to receive notifications for Wi-Fi related activities.
Prerequisites
Ensure that you have the necessary permissions to set or update the Knox Asset Intelligence settings, including obtaining an authentication token. For more information, see Get started.
Retrieve information about Wi-Fi connection events
-
To retrieve the Wi-Fi connection events data for a specific time period, make a GET request to the /wifi/connections endpoint.
-
In the request, you can make use of the following query parameters:
- pageNum — Page number to retrieve.
- pageSize — Number of items on a page.
- startDate — Start time and date in milliseconds using Unix timestamp.
- endDate — End time and date in milliseconds using Unix timestamp, its maximum possible duration from the start date is one day.
For example, the following request sample gives the Wi-Fi connection event information, such as channel, vendor name, serial number, and total number of Wi-Fi connection events, for the timeframe between 1675235605000
and 1675255086000
timestamps.
GET
/wifi/connections?
pageNum=0&
pageSize=100&
startDate=1675235605000&
endDate=1675255086000
You can adjust the parameters based on the network activity you want to monitor and the insights you want. For detailed response schema, see GET /network/wifiConnections.
You can receive notifications for Wi-Fi connection events using Knox Webhook Notification, if subscribed.
Retrieve information about Wi-Fi disconnection events
-
To retrieve the Wi-Fi disconnection events data for a specific time period, make a GET request to the /wifi/disconnections endpoint.
-
In the request body, you can make use of the following query parameters:
- pageNum — Page number to retrieve.
- pageSize — Number of items on a page.
- startDate — Start time and date in milliseconds using Unix timestamp.
- endDate — End time and date in milliseconds using Unix timestamp, its maximum possible duration from the start date is one day.
For example, the following request sample gives the Wi-Fi disconnection event information such as channel, vendor name, serial number, and total number of Wi-Fi disconnection events for the timeframe between 1675235605000
and 1675255086000
timestamps.
GET
/wifi/disconnections?
pageNum=0&
pageSize=100&
startDate=1675235605000&
endDate=1675255086000
You can adjust the parameters based on your monitoring needs to gain insights into the network activity. For detailed response schema, see GET /network/wifiDisconnections.
These Wi-Fi disconnection events can be notified to you through Knox Webhook Notification, if subscribed.
Ensure that you check the code
and message
in the response for any errors and handle them appropriately for your app. For detailed specification, see Knox Asset Intelligence API.
Create a subscription in Knox Webhook Notification
To receive asynchronous notifications when a Wi-Fi connection or disconnection event occurs:
-
Subscribe to the Knox Webhook Notification API using the POST /kwn/v1/subscriptions operation.
-
To receive notifications for Wi-Fi connection events, in the request body, provide a subscription URL to receive callbacks and the
KAI_WIFI_CONNECTIONS
event.For example,
{ "url": "https://some.domain/kwn-results", "events": [ "KAI_WIFI_CONNECTIONS" ] }
-
To receive notifications for Wi-Fi connection events, in the request body, provide a subscription URL to receive callbacks and the
KAI_WIFI_DISCONNECTIONS
event.For example,
{ "url": "https://some.domain/kwn-results", "events": [ "KAI_WIFI_DISCONNECTIONS" ] }
The responses of both the above request samples contain a download link, which is then sent to the subscription URL along with other details about the logs. You can use the download link to view the log file generated by Knox Asset Intelligence.
For more information, see Knox Webhook Notification for Knox Asset Intelligence.
On this page
Is this page helpful?