Created
March 18, 2019 15:57
-
-
Save dexterlabora/89df31b14534e26d863eb415e330909d to your computer and use it in GitHub Desktop.
ServiceNow - Meraki Webhook Alerts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 | |
var gr = new GlideRecord('incident'); | |
gr.initialize(); | |
gr.description = JSON.stringify(merakiAlert); | |
gr.company = merakiAlert['networkName'] + merakiAlert['networkId']; | |
gr.short_description = merakiAlert['alertType']; | |
gr.priority = 4; // default "low" | |
// Customize Incidents based on Alert | |
// Settings Changed | |
if (merakiAlert['alertType'].includes("Settings changed")) { | |
gr.priority = 4; | |
} | |
// VPN Connectivity | |
if (merakiAlert['alertType'] == "VPN connectivity changed") { | |
if (merakiAlert['alertData']['connectivity'] === "false") { | |
gr.priority = 1; | |
gr.impact = 1; | |
gr.short_description = gr.short_description + "connectivity: DOWN"; | |
} else { | |
gr.priority = 4; | |
gr.impact = 4; | |
gr.short_description = gr.short_description + "connectivity: UP"; | |
} | |
} | |
gr.insert(); | |
return; | |
})(request, response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment