Office Dashboard – Meraki Module

Meraki Module

What is Meraki?

Cisco Meraki is a cloud-managed service for IT infrastructure, bought by Cisco Systems in 2012. It provides best in class cloud web dashboard with management capabilities for wireless, switching, security, enterprise mobility management (EMM) and security cameras. Some key differentiators of Meraki dashboard are, it’s ease of use and the ability to integrate all portfolio under the same dashboard. The cloud nature helps to accelerate innovation and bring to market new capabilities, making Meraki customers one of the happiest customers you can find out there.

Meraki Module Overview

Meraki Module Architecture

Meraki Module is one of the 4 Modules of Office Dashboard APP. It is written in python and it is responsible for collecting and receiving data from Meraki cloud service. As some of the other modules you can run this module as a standalone module, I will detail how in a second.

When running as a standalone module it will only collect information from the dashboard, it will NOT be able to receive data from it. To receive location data and camera alerts it is required to run office dashboard app because of the web socket created by flask to listen to rest post requests with notifications coming from the cloud.

Meraki Module detailed function diagram

Above you can see the detailed diagram of all functions inside the module. This module has 2 major layers (Collection and Translation) and each module has several different functions, let’s understand what each layer/function does:

  1. Data Collection layer: Responsible for handling communication to the cloud and processing the data collected/received. Important functions within this layer are:
    • analyze_camera_alert(): – This will be triggered by the MV Webhook alert and will retrieve the image and send it to AWS Rekognition service to identify facial expressions and objects within the image. Once AWS replies back with the image analysis, the answer is sent to prime_aws_rekognition function on the data translation layer to be flatten and later saved on influxDB.
    • save_meraki_location(): This will be triggered by location post data sent from the cloud. It will validate the post based on the configuration and then send the validate data to prime_meraki_data function on the data translation layer to be flatten and later saved on influxDB.
    • find_meraki_dashboard(): This function is triggered by the scheduling service when dashboard app is running or it will run once, when in standalone mode. Using Meraki SDK, it will reach out to dashboard and collect information about networks and devices. Once collected the data is sent to prime_meraki_data function on the data translation layer to be flatten and later saved on influxDB.
    • find_meraki_clients():  This function is triggered by the scheduling service when dashboard app is running or it will run once, when in standalone mode. Using Meraki SDK, it will reach out to dashboard and collect information about Clients and SSIDs. Once collected the data is sent to prime_meraki_data function on the data translation layer to be flatten and later saved on influxDB.
    • find_meraki_camera(): This function is triggered by the scheduling service when dashboard app is running or it will run once, when in standalone mode. Using Meraki SDK, it will reach out to dashboard and collect information about cameras, and it will take a snapshot to be saved and used on dashboard app. Once collected the data is sent to prime_meraki_data function on the data translation layer to be flatten and later saved on influxDB.
  2. Data Translation layer: Responsible for manipulating and reformatting the JSON data so it can be sent to the data retention module. Important functions within this layer are:
    • prime_aws_rekognition(): This function is responsible to flatten the JSON response and get the relevant emotions and objects from the analytics result.
    • prime_meraki_data(): This function is responsible to flatten the JSON response and format the data to be properly saved.

Configuring Meraki Module

Now that we understand the code and steps performed by it, let’s understand what needs to be configured. Here are the steps of what needs to be configured.

  1. Meraki API Key: Find instructions here. Save it you will need to have them to update the credentials file.
  2. Org ID: If you don’t know what your org id is run the script as standalone and it will find it for you. Or follow the instructions below.
    1. Go to https://developer.cisco.com/meraki/api/#!get-organizations
    2. On the right side click on Configuration and paste the api key that you got from previous step and hit save. (Make sure use proxy is selected)
    3. On the right side click on run
    4. Below will appear the API response and you will have the Org ID on the id field.  Save it you will need to have them to update the credentials file.
  3. Location Posting destination: Back to the dashboard follow steps documented here, save the validator, version and Secret you will need to have them to update the credentials file.
  4. MV motion alerts: Follow steps documented here. DO NOT configure e-mail recipients, use webhooks instead.
  5. Webhook Alerts: Follow steps documented here. Once the HTTP Server is configured, scroll up on that same page to the camera section, enable “Custom recipients for motion alerts” and add the HTTP Server just configured as the recipient.
  6. AWS API: Follow steps documented here. When you are done you should have an Access Key ID and a Secret Access Key. Save them you will need to have them to update the credentials file.

Using Meraki Module

Using this module is very straight forward. As you probably understand by now there are 2 ways of running the module. One is by running OFFICE-DASHBOARD app and let the Flask scheduler do the job and the second which we will use for now (We need all modules configured for the APP to run). So make sure you have the app installed in your linux machine, for that follow this instructions (https://github.com/diegogsoares/OFFICE-DASHBOARD#how-to-install-office-dashboard).

Once the app is installed the next step (step 5 in the link above) is to configure/update the credentials.py file with the information you got while configuring the APP. You will need:

  • Meraki API Key and Org ID
  • Meraki Location information (Validator, Version and Secret)
  • AWS API Information (Access Key, Secret access key and region)

Now that everything is installed and configured the last step is to test that everything is working, for that use this instructions https://github.com/diegogsoares/OFFICE-DASHBOARD#testing-meraki-module

(venv)$ python3 modules/meraki.py

approximated expected output:

(venv) Linux:OFFICE-DASHBOARD$ python3 modules/meraki.py
1: Raw JSON
2: Primed JSON
Enter a number: 1

#########################
##### DASHBOARD - networks
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### DASHBOARD - devices
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### DASHBOARD - devices_status
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### DASHBOARD - ssids
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### DASHBOARD - floor_plan
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### CLIENT - wifi_clients
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### CLIENT - ble_clients
#########################
[
    {
... (OMITTED FOR BREVITY)    }
]
#########################
##### CLIENT - air_marshal
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### CAMERA - camera_people
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
#########################
##### CAMERA - camera_entrance
#########################
[
    {
... (OMITTED FOR BREVITY)
    }
]
(venv) Linux:OFFICE-DASHBOARD$

Related Resources