rainforestapp/cmx-api-app

Name: cmx-api-app

Owner: Rainforest QA

Description: null

Created: 2016-03-09 01:34:26.0

Updated: 2016-03-09 01:34:28.0

Pushed: 2016-03-09 01:38:01.0

Homepage: null

Size: 687

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Cisco Meraki CMX API demo app

This application show you how to get started using the Cisco Meraki CMX API. CMX (Connected Mobile Experiences) is Cisco?s location analytics and engagement platform, and it?s integrated into Cisco Meraki wireless products. To learn more about what you can do with CMX, see the Cisco Meraki CMX site.

Table of contents
DISCLAIMERS:
  1. This code is for sample purposes only. Before running in production, you should probably add SSL/TLS support by running this server behind a TLS-capable reverse proxy like nginx - or run on Heroku.

  2. You should also test that your server is capable of handling the rate of events that will be generated by your networks. A good rule of thumb is that your server should be able to process all your network's nodes once per minute. So if you have 100 nodes, your server should respond to each request within 600 ms. For more than 100 nodes, you will probably need a multithreaded web app.

Installation and requirements
Installation
Software requirements:
Gems:
install bundler
le install
Network infrastructure requirements:
Running the app
Heroku
ku apps:create
ku config:set VALIDATOR=<yourvalidator> SECRET=<yoursecret>
push heroku master
ku open
Standalone

Let?s say you plan to run this app on a server you control called pushapi.myserver.com.

  1. Go to the Cisco Meraki dashboard and configure the CMX Location Push API (find it under Organization > Settings) with the url http://pushapi.myserver.com:4567/events

  2. Choose a secret and enter it into the dashboard.

  3. Make note of the validation code that dashboard provides.

  4. Pass the secret and validation code to this server when you start it:

  5. You can change the bind interface (default: 0.0.0.0) and port (default: 4567) using Sinatra's -o and -p option flags:

  6. Click the ?Validate server? button in CMX Location Push API configuration in the dashboard. Meraki cloud servers will perform a GET to your server, and you will see a log message like this:

    ou do not see such a log message, check your firewall and make sure
    re allowing connections to port 4567. You can confirm that the server
    eceiving connections on the port using
    
  7. Once the Meraki cloud has confirmed that the URL you provided returns the expected validation code, it will begin posting events to your URL. For example, when a client probes one of your access points, you?ll see a log message like this:

  8. After your first client pushes start arriving (this may take a minute or two), you can get a JSON blob describing the last client probe (where {mac} is the client mac address): pushapi.myserver.com:4567/clients/{mac}

  9. You can also view the sample frontend at: http://pushapi.myserver.com:4567/. Try connecting your mobile device to your network, and entering your mobile device?s WiFi MAC in the frontend.

Sample output code

The JSON blob sent by Meraki servers to your app is formatted as follows:


pMac":"00:18:0a:79:08:60",
pFloors":["500 TF 4th"],
bservations":[{
"clientMac":"00:11:22:33:44:55:66",
"probeEpoch":1388577600,
"probeTime":"2014-01-01T12:00:00Z",
"rssi":23,
"ssid":"SSID 1",
"manufacturer":"Meraki",
"os":"Linux",
"location":{
  "lat":37.77057805947924
  "lng":-122.38765965945927,
  "unc":15.13174349529074,
},...]


A specific client device?s details can be retrieved, for example:

http://pushapi.myserver.com:4567/clients/34:23:ba:a6:75:70

may return


d":65,
ac":"34:23:ba:a6:75:70",
eenAt":"Fri Apr 18 00:01:41.479 UTC 2014",
at":37.77059042088197,"lng":-122.38703445525945

Copyright and license

Code and documentation copyright 2013-2014 Cisco Systems, Inc. Code released under the MIT license. Documentation released under Creative Commons.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.