Back to top

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.

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

  1. To retrieve the Wi-Fi connection events data for a specific time period, make a GET request to the /wifi/connections endpoint.

  2. 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 like channel, vendor name, serial number, total number of Wi-Fi connection events and so on 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 the detailed response schema, see Knox Asset Intelligence API.

You can receive notifications for Wi-Fi connection events using Knox Webhook Notification, if subscribed.

Retrieve information about Wi-Fi disconnection events

  1. To retrieve the Wi-Fi disconnection events data for a specific time period, make a GET request to the /wifi/disconnections endpoint.

  2. 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 like channel, vendor name, serial number, total number of Wi-Fi disconnection events and so on 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 Knox Asset Intelligence API.

These Wi-Fi disconnection events can be notified to you through Knox Webhook Notification, if subscribed.

Ensure that you handle errors appropriately in your application by checking the code and the message in the response. For detailed specification, see Knox Asset Intelligence API reference.

Create a subscription in Knox Webhook Notification

To receive asynchronous notifications when a Wi-Fi connection or disconnection event occurs:

  1. Subscribe to the Knox Webhook Notification API using the POST /kwn/v1/subscriptions operation.

  2. 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 "
    ]
    }
    
  3. 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.

Is this page helpful?