Retrieve average clients connection time

Nil
Just browsing

Retrieve average clients connection time

Hi all,

 

the subject says it ... I would like to change retrieve average clients connection time but I don't find the corresponding API-call ... Any hints?

 

Hope you have all a happy new year,

 

Nil

8 Replies 8
sungod
Kind of a big deal

Options depend on what type of client "connection" you are trying to measure.

 

Unless it is a connection type with explicit connected and disconnect events, you have to see what else you can use.

 

You could use https://developer.cisco.com/meraki/api-v1/#!get-network-clients

 

...then call the difference between firstSeen and lastSeen the connection time for each client (within the sample period), you could then average the result.

 

But it is probably not going to be that accurate.

 

For wireless clients you could use...

 

 https://developer.cisco.com/meraki/api-v1/#!get-network-clients

 

...to get the list of clients (do it on each network), then iterate through the wireless ones with...

 

  https://developer.cisco.com/meraki/api-v1/#!get-network-wireless-client-connectivity-events

 

...using the assoc and disassoc events and timestamps to calculate the total time 'associated' over the sample period, call that the 'connected' time, then divide by clients to get the average.

 

Nil
Just browsing

Thank you for the fast reply sungod! 🙂 What I mean by connection time is the time each user spend connected in my Wi-Fi network (not inside my building even if it is connected or disconnected).

 

Using  https://developer.cisco.com/meraki/api-v1/#!get-network-wireless-client-connectivity-events call through assoc and disassoc events and timestamps seems the best right now... but I think that it can take a lot of time to get and process the retrieved information...

sungod
Kind of a big deal

For wireless clients, another approach is to use the scanning API...

https://developer.cisco.com/meraki/scanning-api/#!introduction

 

Client data is delivered in real time to then analyse for 'presence' purposes. You can either write your own server, or there are open source and commercial options.

 

Another approach would be some kind of screen scraper to get what you need from the Location Analytics page on dashboard (which is driven by the same data as scanning API I think).

 

Nil
Just browsing

I do not really see that Scanning API can help me in my use case. I would like to know when a client connects to my Wi-Fi network and when it disconnects and as far as I can see Scanning API only tells me where is a client with its timestamp... 😞

 

I have tried  https://developer.cisco.com/meraki/api-v1/#!get-network-wireless-client-connectivity-events with some of my network clients and it is returning an empty array: [].

 

Thank you so much for you help!

sungod
Kind of a big deal

Empty array typically means there are no matching events/other data, empty/null elements can  occur in many API responses.

 

You need to precisely define what you mean by "connected" and "disconnected", in the terms exposed by the available APIs and how wifi association/authentication work.

 

I.e. if a client moves out of range, there's no "disconnect me' event, it simply is no longer seen, but disconnection can still be inferred from the absence of information based upon some rules about things like when it was last seen.

 

The scanning API is used by commercial applications to determine client connect/other metrics (and at massive scale.)

 

In very simple outline, how the scanning API can be used...

 

detect a client not currently in list of connected clients, add it, set the 'first seen' timestamp

 

detect one that is already in the list, update the 'last seen' timestamp

 

periodically, go through the list, if the 'last seen' is too long ago, call it disconnected 

 

There needs to be additional book-keeping to record/consolidate multiple sessions, but you see the basic idea.

 

This a very simplistic approach, in practice you'd also fuse with other data to refine results, such as RSSI, location, any authentication service info, data usage etc..

 

Nil
Just browsing

Hi Sungod. Thank you for answering. We have been working with those events but there are a lot of dissasociation events event before the user associates the network for the first time and this is a lot of work to be done and also it is not trustable. If you or anyone knows a better way of getting the average time of network clients would be perfect. Thank you in advance!

PhilipDAth
Kind of a big deal
Kind of a big deal

I think I would retrieve the network event log and extract out the connection and disconnection events to calculate this.

I would start in the dashboard and find which events to filter on.

 

https://developer.cisco.com/meraki/api-v1/#!get-network-events 

Nil
Just browsing

Hi Philip. Thank you for answering. We have been working with those events but there are a lot of dissasociation events event before the user associates the network for the first time and this is a lot of work to be done and also it is not trustable. If you or anyone knows a better way of getting the average time of network clients would be perfect. Thank you in advance!

Get notified when there are additional replies to this discussion.