Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
dexterlabora / Node-RED_MerakiScanningWorldmapSample.json
Created July 14, 2017 10:49
A Node-RED example flow using the new Meraki CMX/Scanning node. The location data is placed onto a Worldmap using a node-red node.
[{"id":"15a6d95.594a427","type":"split","z":"e3826fbf.d69e6","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":390,"y":180,"wires":[["7bf5bee5.e3c79","99b5f7e7.7f00c8"]]},{"id":"bde4e23.55fe92","type":"function","z":"e3826fbf.d69e6","name":"Extract Observations","func":"// Flatten JSON\nmsg.type = msg.payload.type;\nmsg.apMac = msg.payload.data.apMac;\nmsg.apFloors = msg.payload.data.apFloors\nmsg.apTags = msg.payload.data.apTags;\nmsg.payload = msg.payload.data.observations;\n\nreturn msg;","outputs":1,"noerr":0,"x":300,"y":140,"wires":[["15a6d95.594a427"]]},{"id":"7bf5bee5.e3c79","type":"debug","z":"e3826fbf.d69e6","name":"Observation","active":true,"console":"false","complete":"true","x":550,"y":180,"wires":[]},{"id":"5ba45261.184b5c","type":"worldmap","z":"e3826fbf.d69e6","name":"","lat":"","lon":"","zoom":"","layer":"OSM","cluster":"3","maxage":"","usermenu":"show","panit":"false","x":550,"y":340,"wires":[]},{"id":"c920ea6e.f4b198","type":"Me
@dexterlabora
dexterlabora / LICENSE
Last active March 25, 2019 10:14
Cisco Meraki and Spark Demo Flows
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@dexterlabora
dexterlabora / meraki-location-worldmap-stub.json
Created August 4, 2017 10:25
A stub flow that will take Meraki location data and place it on a Node-RED worldmap.
[{"id":"35687765.53fbc8","type":"worldmap","z":"c1ec8b84.64df38","name":"","lat":"","lon":"","zoom":"","layer":"OSM","cluster":"3","maxage":"","usermenu":"show","panit":"false","x":570,"y":280,"wires":[]},{"id":"cafe58c6.9b4928","type":"function","z":"c1ec8b84.64df38","name":"format data","func":"var data = msg;\nmsg = {};\nmsg.payload = {};\nmsg.payload.name = data.payload.clientMac;\nmsg.payload.lat = data.payload.location.lat;\nmsg.payload.lon = data.payload.location.lng;\nmsg.payload.ipv4 = data.payload.ipv4;\nmsg.payload.ssid = data.payload.ssid;\nmsg.payload.os = data.payload.os;\nmsg.payload.rssi = data.payload.rssi;\nmsg.payload.manufacturer = data.payload.manufacturer;\nmsg.payload.type = data.type;\nmsg.payload.apMac = data.apMac;\nmsg.payload.layer = \"Meraki\";\nmsg.payload.icon = \"globe\";\nmsg.payload.iconColor = \"orange\";\nreturn msg;\n\n","outputs":1,"noerr":0,"x":150,"y":240,"wires":[["35687765.53fbc8","e8dfe5c6.6136e8","c8de7d51.5625d"]]},{"id":"e8dfe5c6.6136e8","type":"debug","z":"c1ec8b
@dexterlabora
dexterlabora / Meraki Location Scanning CMX.postman_collection.json
Last active August 16, 2017 15:49
Postman Collection - Meraki Location Sample Data
{
"variables": [],
"info": {
"name": "Meraki Location Scanning CMX",
"_postman_id": "5c1af082-2d85-b2ed-f4b6-13dc649e8ff7",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
@dexterlabora
dexterlabora / meraki-api-group-policy
Created October 17, 2017 13:10
JavaScript code snip to add a Meraki client to a Group Policy.
// Set Variables
var apiKey = "";
var shard = "";
var netId = "";
var policyId = "";
var clientMac = inputData.clientMac;
// API Call
var headers = {
@dexterlabora
dexterlabora / LICENSE
Last active March 26, 2019 10:13
Meraki Group Policy - Zapier Javascript Template
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@dexterlabora
dexterlabora / meraki-request.js
Last active July 18, 2019 00:33
A Meraki Dashboard API request wrapper to follow 301/302/307/308 redirects properly.
// Handles Meraki API requests. Has additional logic to follow the HTTP redirects properly and handle OrgID being converted to INTs
var request = require("request");
var JSONbig = require("json-bigint")({ storeAsString: true });
// Recursive function to follow Meraki API redirects
var requestMeraki = function(options, callback) {
request(options, function(error, res, data) {
//console.log('RESPONSE [ ' + res.statusCode + ' ]');
if (error) {
@dexterlabora
dexterlabora / listGroupPolicies-allOrgs.js
Created April 20, 2018 08:57
List Meraki Group Policies for all Organizations and their Networks. Uses Axios and async/await. Good pattern for traversing Meraki Dashboard API.
/* Meraki Group Policy Tool
Traverse the Meraki Dashboard API to display IDs for Organizations, Networks and Group Policies
npm install axios json-bigint --save
Run:
$ API_KEY=2f30UseYourOwnAPIkEyd170f node listGroupPolicies-allOrgs.js
@dexterlabora
dexterlabora / listClients-Network.js
Last active April 20, 2018 10:26
List Meraki clients in a network by traversing each network device.
/* Meraki Clients on a Network
Traverse the Meraki Dashboard API to display the Clients and Group Policies for each device in a network.
npm install axios json-bigint --save
Run:
$ API_KEY=2f30UseYourOwnAPIkEyd170f NET=L_12345678 node listClients-Network.js
@dexterlabora
dexterlabora / meraki-service.js
Created May 4, 2018 13:31
A collection of functions to interact with the Meraki API. This version is designed to work with a VueJS project.
/* Meraki Dashboard API endpoint service for VueJS
A collection of functions to interact with the Meraki API.
This version is designed to work with a VueJS project.
It is easy to duplicate any of the methods to and modify them for new API endpoints.
The service will leverage an event HUB to broadcast messages while scripts are running. This is helfpul