A Push Connector for ServiceNow Event Management
Hi, this is a Push Connector for ServiceNow Event Management. If you are looking to send alerts from LogicMonitor to the Event Management feature this may be helpful. There is a connector for LogicMonitor created by ServiceNow, but it has a number of issues. Some fields are not mapped well to the ServiceNow event, website alerts for example have multiple fields not populated. It doesn't properly handle the non-standard date format LM uses in the alert tokens, and certain time zone identifiers like "BST" or "CST" cause the connector to "crash". This one fixes those issues and does some better mapping for the event fields, additional details are in the repository linked below. https://github.com/chrisred/snow-itom-push-connectors25Views1like0CommentsSeeing Failed To Parse ServiceNow Integration
We are sometimes seeing “-2” as the ##EXTERNALTICKETID## when sending alerts to ServiceNow. When this happens and the alert clears it is not auto-closing the ticket in SNOW. Has anyone seen this or have any idea how to fix this. Seems when there is an event where multiple alerts generate and send to SNOW at once this happens.319Views22likes13CommentsLogic Monitor service now integration issue
hi, i have followed the documentation for setting up logic monitor with service now but when i test the alert delivery from the alert routing page I get a incident created in service now but I don’t get any of the details that should be included in the HTTP payload also the alert does not show up in the integration log. anyone have any suggestions or experienced similar issues ?Solved129Views8likes3CommentsPlugin update for LogicMonitor to ServiceNow Integration
Hello, Our ServiceNow Admin recently upgraded our ServiceNow Dev instance to the newest release ( Washington DC). https://docs.servicenow.com/bundle/washingtondc-release-notes/page/release-notes/family-release-note... While attempting to retest the LogicMonitor to ServiceNowintegration, we learned the LogicMonitor plugin appears to be incompatible with the latest version: Does anyone know if this will be addressed? Thanks.Solved167Views14likes5CommentsTrouble Authenticating to LogicMonitor REST API from ServiceNow
I am trying to convert a PowerShell script to run from ServiceNow and found “Using REST API from ServiceNow Scripting” from two years ago. Since then, ServiceNow has addedGlideDigest() which, among other things, should allow me to create a message digest from a string using the SHA256 algorithm, with the result being a Base64 string. However, I am getting back: "{"errorMessage":"Authentication failed","errorCode":1401,"errorDetail":null}" The PowerShell script looks like this: [string]$sandboxaccessid = 'abc' [securestring]$sandboxaccesskey = '123' | ConvertTo-SecureString -AsPlainText -Force [string]$AccountName = 'portalname' [int]$Id = 2 $httpVerb = "GET" $resourcePath = "/device/devices/$id" $AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12' [System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols $time = (Get-Date).ToUniversalTime() $epoch = [Math]::Round((New-TimeSpan -Start (Get-Date -Date "1/1/1970") -End $time).TotalMilliseconds) $requestVars = $httpVerb + $epoch + $resourcePath $hmac = New-Object System.Security.Cryptography.HMACSHA256 $hmac.Key = [Text.Encoding]::UTF8.GetBytes([System.Runtime.InteropServices.Marshal]::PtrToStringAuto(([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($sandboxaccesskey)))) $signatureBytes = $hmac.ComputeHash([Text.Encoding]::UTF8.GetBytes($requestVars)) $signatureHex = [System.BitConverter]::ToString($signatureBytes) -replace '-' $signature = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($signatureHex.ToLower())) $headers = @{ "Authorization" = "LMv1 $sandboxaccessid`:$signature`:$epoch" "Content-Type" = "application/json" "X-Version" = 3 } $url = "https://$AccountName.logicmonitor.com/santaba/rest$resourcePath" $response = Invoke-RestMethod -Uri $url -Method $httpVerb -Header $headers -ErrorAction Stop $resposne And JavaScript looks like this (at the moment): var ACCESS_ID = 'abc'; var ACCESS_KEY = '123'; var ACCOUNT_NAME = 'portalname'; var resourcePath = '/device/devices'; var time = new Date().getTime(); var epoch = Math.round((time - new Date("1/1/1970").getTime())); var id = 2; var requestVars = 'GET' + epoch + resourcePath; // Compute the HMACSHA256 hash using GlideDigest var gd = new GlideDigest(); var signature = gd.getSHA256Base64(ACCESS_KEY, requestVars); // Remove hyphens from the signature signature = signature.replace(/-/g, ''); var token = 'LMv1 ' + ACCESS_ID + ':' + signature + ':' + epoch; var httpRequest = new GlideHTTPRequest('https://' + ACCOUNT_NAME + '.logicmonitor.com/santaba/rest/device/devices/' + id); httpRequest.addHeader('Content-Type', 'application/json'); httpRequest.addHeader('Authorization', token); httpRequest.addHeader('X-Version', '3'); var response = httpRequest.get(); gs.info('Response status code: ' + response.getStatusCode()); gs.info('Devices = ' + response.body); Anyone know how to make this authentication work, without the customerconvertByteArrayToHex() utility?Solved360Views10likes7CommentsAlerts keep reopening old SNOW tickets instead of making new ones
Hello, My team is experiencing an issuewhere alerts on an device reopen old Service Now tickets rather than opening new tickets. Is there a way to fix this? For example, OfficePrinter#1 has a print job get stuck in its queue, and that LogicMonitor alert generates a SNOW ticket. We acknowledge the alert in LogicMonitor and close the ticket. Howevera print job gets stuckevery couple of months, which reopens that same ticket each time. These reopened tickets also reopen in the queue of the last person that closed them. This is aproblem for my team when tickets reopen in the queue oftermed orOOO employees. It’s easy to lose track of them. I’d appreciate any direction in fixing this. Thanks in advance, NajeeSolved129Views3likes2CommentsLogicMonitor Resource table not populated consistently in ServiceNow
We are using the LogicMonitor Service Graph Connector to pull the names of CIs to be monitored. What I’ve noticed is that in the ServiceNow system table “LogicMonitor Resources” there are two fields: Name and Configuration Item (reference field). Sometimes, while the Configuration item is populated the Name field is not. It seems that if Created by=system, then, Name is *always* populated, but if it’s created by one of our employees, it’s hit or miss if Name is populated. Is there something our folks are not doing, or not doing properly that’s causing this anomaly? Thanks.57Views5likes0Commentsauthentication failing in ServiceNow getting error 1401
Hi Team, I trying to get the devices from the logicmonitor into servicenow, it is throwing an error authentication failed. {"data":null,"errmsg":"Authentication failed","status":1401} I have compared postman and token and below script token everything is perfect. Below is the script. can you please help me where is the mistake. var ACCESS_ID = 'test'; var ACCESS_KEY = 'abc'; var ACCOUNT_NAME = 'cde'; var epoch = (new Date()).getTime(); var id = 2; var resourcePath = '/device/devices'; var data= ''; var requestVars = 'GET' + epoch + resourcePath; var HexUtil = { convertByteArrayToHex : function(byteArray) { var hex = ""; byteArray.forEach(function(byteValue) { hex += HexUtil.convertByteToHex(byteValue); }); return hex; }, convertByteToHex : function(b) { var hexChar = ["0", "1", "2", "3", "4", "5", "6", "7","8", "9", "a", "b", "c", "d", "e", "f"]; return hexChar[(b >> 4) & 0x0f] + hexChar[b & 0x0f]; } }; var key = "lma_Bmz]H_625^5H[EQi9U627pdg}8yy(-56X-hsiL7~e^s)9~56ee+^Mh)i3DKXLODZmNTRhNTUtMDM2MC00ZTY5LTkyNWItZGIwNjZmMDMyZTg5L4kmWbA"; key = encodeURIComponent(key); key = GlideStringUtil.base64Encode(key); var msg = requestVars; msg = encodeURIComponent(msg); var mac = new GlideCertificateEncryption(); signature = mac.generateMac(key, "HmacSHA256", msg); gs.print(signature); // Yes! bp7ym3X//Ft6uuUn1Y/a2y/kLnIZARl2kXNDBl9Y7Uo= var bytes = GlideStringUtil.base64DecodeAsBytes(signature); gs.print(JSON.stringify(bytes)); gs.print(bytes.length); // Yes! [110,-98,-14,-101,117,-1,-4,91,122,-70,-27,39,-43,-113,-38,-37,47,-28,46,114,25,1,25,118,-111,115,67,6,95,88,-19,74] var hex = HexUtil.convertByteArrayToHex(bytes); gs.print(hex); // Yes! 6e9ef29b75fffc5b7abae527d58fdadb2fe42e7219011976917343065f58ed4a var hexB64 = GlideStringUtil.base64Encode(hex); gs.print(hexB64); var token = 'LMv1 ' + ACCESS_ID + ':' + hexB64 + ':' + epoch; gs.info('Devices = ' +token); var request = new sn_ws.RESTMessageV2(); request.setEndpoint('https://cde.logicmonitor.com/santaba/rest/device/devices'); request.setHttpMethod('GET'); request.setRequestHeader('Authorization', token); //request.setRequestHeader("Accept", "application/json"); request.setRequestHeader("Content-Type", 'application/json'); var response = request.execute(); var responseBody = response.getBody(); var httpStatus = response.getStatusCode(); gs.log("test==="+httpStatus+responseBody); if (httpStatus == 200) { var temJson = JSON.parse(responseBody); var aTA = temJson.data; gs.log("aTA ==="+aTA); } Thank You, Sai.Solved234Views4likes1CommentUsing REST API from ServiceNow Scripting
I would like to use the REST API from ServiceNow but I'm not able to generate the HMAC using the ServiceNow Glide System native class GlideCertificateEncryption(), the resulting values don't match with what I would expect from Python or PowerShell. Are there any ServiceNow developers out there who have managed to call the LogicMonitor REST API from a ServiceNow script?If you have, could anyone share an example script please. var JavaString = Packages.java.lang.String; var key = new JavaString("key"); var message = new JavaString("message"); var keyUTF8 = new JavaString(key.getBytes("UTF8")); var messageUTF8 = new JavaString(message.getBytes("UTF8")); var util = new GlideStringUtil(); var encryption = new GlideCertificateEncryption(); //var mac = encryption.generateMac(util.base64Encode(keyUTF8), "HMACSHA256", messageUTF8); var mac = encryption.generateMac(HexUtil.convertToBase64(keyUTF8 + ""), "HMACSHA256", messageUTF8 + ""); gs.log(mac); gs.log(HexUtil.convertToBase64(mac)); var decoded = util.base64Decode(mac); var utf8Bytes = decoded.getBytes("UTF8"); gs.log(utf8Bytes.length); gs.log(JSON.stringify(utf8Bytes));Solved477Views3likes7CommentsUnable to authenticate Rest api with servicenow to get devices
Hi All, I am trying to authenticate in servicenow using script but it is not working. It is throwing an error authentication failed status 401. var ACCESS_ID = '123'; var ACCESS_KEY = 'abc'; var ACCOUNT_NAME = 'test'; var resourcePath = '/device/devices'; var epoch = (new Date()).getTime(); var id = 2; var requestVars = 'GET' + epoch + resourcePath; var HexUtil = { convertByteArrayToHex : function(byteArray) { var hex = ""; byteArray.forEach(function(byteValue) { hex += HexUtil.convertByteToHex(byteValue); }); return hex; }, convertByteToHex : function(b) { var hexChar = ["0", "1", "2", "3", "4", "5", "6", "7","8", "9", "a", "b", "c", "d", "e", "f"]; return hexChar[(b >> 4) & 0x0f] + hexChar[b & 0x0f]; } }; // Compute the HMACSHA256 hash using GlideDigest var key = "key"; key = encodeURIComponent(key); key = GlideStringUtil.base64Encode(key); var msg = "message"; msg = encodeURIComponent(msg); var mac = new GlideCertificateEncryption(); signature = mac.generateMac(requestVars, "HmacSHA256", ACCESS_ID); var bytes = GlideStringUtil.base64DecodeAsBytes(signature); var hex = HexUtil.convertByteArrayToHex(bytes); var hexB64 = GlideStringUtil.base64Encode(hex); var token = 'LMv1 ' + ACCESS_ID + ':' + signature + ':' + epoch; gs.info('Devices = ' +token); var httpRequest = new GlideHTTPRequest('https://' + ACCOUNT_NAME + '.logicmonitor.com/santaba/rest/device/devices'); httpRequest.addHeader('Content-Type', 'application/json'); httpRequest.addHeader('Authorization', token); //httpRequest.addHeader('x-server-version', '3'); var response = httpRequest.getBody(); gs.log(response); Could you please help me on this.275Views4likes3Comments