How to see the number of clients connected on a specific SSID in a specific network via API

MManolli
Here to help

How to see the number of clients connected on a specific SSID in a specific network via API

Dear All,

 

I opened a case to Meraki for this Yesterday.

The Meraki support asks me to find an answer to my question in the community forum.

I try if there is a thread about in the community forum, but unlucky I don't find it.

 

I need to collect how many clients are connected in my Guest SSID for monitoring and analysis.

We need to collect this info and send it to an external system.

 

Do you know if there is an API Meraki script that gives me this information?

 

Thank you for your support

 

 

Mauro Manolli

9 Replies 9
PhilipDAth
Kind of a big deal
Kind of a big deal

MManolli
Here to help

Dear Phil,

 

Thank you for your reply but in 

Wireless Heath API:

https://dashboard.meraki.com/api_docs#aggregated-connectivity-info-for-this-network

 

I don't find any clue or suggestion how to obtain what I need.

To be clear I need something like "Aggregated connectivity info for this network, grouped by SSID".

 

Thank you

 

Mauro

 

jdsilva
Kind of a big deal

I don't think this is exactly what you're asking, but it might get you to where you need to go... If you put in some work.

 

The Scanning API can stream client data on a per AP basis to you. Within that client data is what SSID the user is connected to. You'd have to set up a collector, and then process the streaming CMX data as it arrives. 

 

https://documentation.meraki.com/MR/Monitoring_and_Reporting/Scanning_API

 

Because this is a streaming API it's always sending data. Each AP reports every minute with every connected or seen client. 

MManolli
Here to help

Hi JdSilva,

 

What you mean is:

 

  1. obtain the Meraki AP present in the requested Meraki Network
  2. collect from any of those AP how many clients are connected on it divides by SSID.
  3. Sum this value and obtain how many clients are connected by SSID on the network.

 

I'm sorry but I'm a very beginner on it and my English it's also bad.

 

 

Mauro

jdsilva
Kind of a big deal

Close 🙂

 

The Scanning API sends data to you. You do not have to get it, you have to receive it. This means you have to set up an application that listens for incoming data. Once you receive the data you then have to count up each client by the SSID field.

 

This isn't the easiest solution to your question. Hopefully someone else has a better idea than mine.

PhilipDAth
Kind of a big deal
Kind of a big deal

If you read the API link I posted it gives aggregated data that can be filtered by SSID.

MManolli
Here to help

Thank you Phil for your reply.

 

We are trying to use the API, but we found a problem and open a ticket to Meraki.

 

when we do this (Key omitted)we obtain a 404 error.

We do not understand if we did a wrong request or if the system has a problem.

 

 

 

curl -L -H 'X-Cisco-Meraki-API-Key: <API>' -H 'Content-Type: application/json' -X GET 'https://api.meraki.com/api/v0/networks/N_642888846807156329/connectionStats?t0=1542899482&t1=1542903...' -v

* About to connect() to api.meraki.com port 443 (#0)

*   Trying 209.206.58.21... connected

* Connected to api.meraki.com (209.206.58.21) port 443 (#0)

* Initializing NSS with certpath: sql:/etc/pki/nssdb

*   CAfile: /etc/pki/tls/certs/ca-bundle.crt

  CApath: none

* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA

* Server certificate:

*       subject: CN=*.meraki.com,OU=Domain Control Validated

*       start date: Aug 16 20:21:40 2016 GMT

*       expire date: Sep 16 20:57:39 2019 GMT

*       common name: *.meraki.com

*       issuer: CN=Go Daddy Secure Certificate Authority - G2,OU=http://certs.godaddy.com/repository/,O="GoDaddy.com, Inc.",L=Scottsdale,ST=Arizona,C=US

> GET /api/v0/networks/N_642888846807156329/connectionStats?t0=1542899482&t1=1542903082&vlan=&ssid= HTTP/1.1

> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2

> Host: api.meraki.com

> Accept: */*

> X-Cisco-Meraki-API-Key: 8b305bbe07527d8be6c6726d237465a332eeeabf

> Content-Type: application/json

< HTTP/1.1 302 Found

< Server: nginx

< Date: Fri, 23 Nov 2018 08:08:34 GMT

< Content-Type: text/html; charset=utf-8

< Transfer-Encoding: chunked

< Connection: keep-alive

< Cache-Control: no-cache, no-store, max-age=0, must-revalidate

< Pragma: no-cache

< Expires: Fri, 01 Jan 1990 00:00:00 GMT

< X-Frame-Options: sameorigin

< X-Robots-Tag: none

< Location: https://n142.meraki.com/api/v0/networks/N_642888846807156329/connectionStats?t0=1542899482&t1=154290...=

< X-UA-Compatible: IE=Edge,chrome=1

< X-Request-Id: cb7c9a57aed3d6e48defc220fb4b6a5e

< X-Runtime: 0.294397

< Strict-Transport-Security: max-age=15552000; includeSubDomains

* Ignoring the response-body

* Connection #0 to host api.meraki.com left intact

* Issue another request to this URL: 'https://n142.meraki.com/api/v0/networks/N_642888846807156329/connectionStats?t0=1542899482&t1=154290...'

* About to connect() to n142.meraki.com port 443 (#1)

*   Trying 185.17.255.158... connected

* Connected to n142.meraki.com (185.17.255.158) port 443 (#1)

*   CAfile: /etc/pki/tls/certs/ca-bundle.crt

  CApath: none

* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA

* Server certificate:

*       subject: CN=*.meraki.com,OU=Domain Control Validated

*       start date: Aug 16 20:21:40 2016 GMT

*       expire date: Sep 16 20:57:39 2019 GMT

*       common name: *.meraki.com

*       issuer: CN=Go Daddy Secure Certificate Authority - G2,OU=http://certs.godaddy.com/repository/,O="GoDaddy.com, Inc.",L=Scottsdale,ST=Arizona,C=US

> GET /api/v0/networks/N_642888846807156329/connectionStats?t0=1542899482&t1=1542903082&vlan=&ssid= HTTP/1.1

> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2

> Host: n142.meraki.com

> Accept: */*

> X-Cisco-Meraki-API-Key: 8b305bbe07527d8be6c6726d237465a332eeeabf

> Content-Type: application/json

< HTTP/1.1 404 Not Found

< Server: nginx

< Date: Fri, 23 Nov 2018 08:08:34 GMT

< Content-Type: text/html; charset=utf-8

< Transfer-Encoding: chunked

< Connection: keep-alive

< Vary: Accept-Encoding

< Cache-Control: no-cache, no-store, max-age=0, must-revalidate

< Pragma: no-cache

< Expires: Fri, 01 Jan 1990 00:00:00 GMT

< X-Frame-Options: sameorigin

< X-Robots-Tag: none

< X-UA-Compatible: IE=Edge,chrome=1

< X-Request-Id: 703783512d849d5db95eae23d3706ce6

< X-Runtime: 0.119380

* Connection #1 to host n142.meraki.com left intact

* Closing connection #0

* Closing connection #1

NolanHerring
Kind of a big deal

@MManolli

 

Unless you specifically went out of your way and changed the API key on what you pasted and didn't mention it, then I am going to assume that the API key I can see is the real one.

 

Thus your network is technically exposed and vulnerable now. I HIGHLY recommend you generate a new key ASAP before something happens

Nolan Herring | nolanwifi.com
TwitterLinkedIn
MManolli
Here to help

Hi Nolan,

Thank you for your help.

Key regenerated


Mauro

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.
Labels