Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
dexterlabora / snow-meraki-webhook-alerts.js
Created March 18, 2019 15:57
ServiceNow - Meraki Webhook Alerts
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
// Parse Meraki Alerts Webhook Data
var requestBody = request.body;
var requestString = requestBody.dataString;
var requestParsed = {};
requestParsed = JSON.parse(requestString);
var merakiAlert = requestParsed;
// Create SNOW Incident
[
{
"id": "6b02c4a0.a0d1ac",
"type": "tab",
"label": "Alerts",
"disabled": false,
"info": ""
},
{
"id": "def605c1.7fb328",
[
{
"id": "fc8601c3.25e5b",
"type": "tab",
"label": "MV MQTT",
"disabled": false,
"info": ""
},
{
"id": "8a8e0f9e.ea00c",
@dexterlabora
dexterlabora / Code.gs
Last active April 8, 2024 19:46
Meraki Webooks Demo with Google Sheets
/*
Copy this function over the existing Code.gs file in a Google Sheet
Save the Sheet/Script
Publish App
- Execute as You
- Avaiable to Anyone (including anonymous)
Authorize App when prompted
The URL will act as the Webhook URL for Meraki to send alerts
*/
@dexterlabora
dexterlabora / firebase-merakiSplashAuth
Created July 31, 2018 13:12
This Firebase Function will provide a `/splashAuth` route to authenticate a wireless client on a Meraki Network.
/**
* This Firebase Function will provide a `/splashAuth` route to authenticate a wireless client on a Meraki Network.
* Example
* [POST] https://merakicaptiveportal-vuejs.firebaseapp.com/splashAuth/
* Body:
{"clientMac":"24:18:1d:ae:4c:71","nodeMac": "88:15:44:60:1c:1a"}
* Returns:
{
"ssids": {
"4": {
@dexterlabora
dexterlabora / Code.gs
Last active May 28, 2023 22:06
Google Sheets Scripts with the Meraki Dashboard API
// Settings - Modify this with your values
// *************************
// User Defined in the Script
var API_KEY = '';
var ORG_ID = '';
var NET_ID = '';
var TIMESPAN = '';
// User Defined in a Sheet
@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
@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 / 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 / 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) {