How to integrate Solarwinds with ServiceNow to pull the Network Assets ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 08:05 AM
Hi,
I have a requirement to integrate the ServiceNow with Solar Winds and pull the network assets which are active to ServiceNow. Do I need to integrate with SolarWinds data Source and bring the data or do I need to write REST API's which can pull the data from SolarWinds REST API's?
I have seen a plugin for SolarWinds which is useful for creating alert tickets but my use case is different and that plugin doesn't help me.
If someone has already integrated to track the assets, please let me know the procedure.
Thanks in advance!
Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2019 06:58 AM
I have done this. Solarwinds has a weird API, you pretty much send a get call with a url parameter of your query to the machine and it will return the json back.
Source: https://github.com/solarwinds/OrionSDK/wiki/REST
var requestBody = {};
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setBasicAuth(this.username,this.password);
restMessage.setHttpMethod("GET");
var query = [];
query.push('SELECT');
query.push('n.NodeID,');
query.push('n.ObjectSubType,');
query.push('n.IPAddress,');
query.push('n.IPAddressType,');
query.push('n.DynamicIP,');
query.push('n.Caption,');
query.push('n.NodeDescription,');
query.push('n.Description,');
query.push('n.DNS,');
query.push('n.SysName,');
query.push('n.Vendor,');
query.push('n.SysObjectID,');
query.push('n.Location,');
query.push('n.Contact,');
query.push('n.VendorIcon,');
query.push('n.Icon,');
query.push('n.Status,');
query.push('n.StatusLED,');
query.push('n.StatusDescription,');
query.push('n.CustomStatus,');
query.push('n.IOSImage,');
query.push('n.IOSVersion,');
query.push('n.GroupStatus,');
query.push('n.StatusIcon,');
query.push('n.LastBoot,');
query.push('n.SystemUpTime,');
query.push('n.ResponseTime,');
query.push('n.PercentLoss,');
query.push('n.AvgResponseTime,');
query.push('n.MinResponseTime,');
query.push('n.MaxResponseTime,');
query.push('n.CPULoad,');
query.push('n.MemoryUsed,');
query.push('n.MemoryAvailable,');
query.push('n.PercentMemoryUsed,');
query.push('n.PercentMemoryAvailable,');
query.push('n.LastSync,');
query.push('n.LastSystemUpTimePollUtc,');
query.push('n.MachineType,');
query.push('n.IsServer,');
query.push('n.Severity,');
query.push('n.UiSeverity,');
query.push('n.ChildStatus,');
query.push('n.Allow64BitCounters,');
query.push('n.AgentPort,');
query.push('n.TotalMemory,');
query.push('n.CMTS,');
query.push('n.CustomPollerLastStatisticsPoll,');
query.push('n.CustomPollerLastStatisticsPollSuccess,');
query.push('n.SNMPVersion,');
query.push('n.PollInterval,');
query.push('n.EngineID,');
query.push('n.RediscoveryInterval,');
query.push('n.NextPoll,');
query.push('n.NextRediscovery,');
query.push('n.StatCollection,');
query.push('n.External,');
query.push('n.Community,');
query.push('n.RWCommunity,');
query.push('n.IP,');
query.push('n.IP_Address,');
query.push('n.IPAddressGUID,');
query.push('n.NodeName,');
query.push('n.BlockUntil,');
query.push('n.BufferNoMemThisHour,');
query.push('n.BufferNoMemToday,');
query.push('n.BufferSmMissThisHour,');
query.push('n.BufferSmMissToday,');
query.push('n.BufferMdMissThisHour,');
query.push('n.BufferMdMissToday,');
query.push('n.BufferBgMissThisHour,');
query.push('n.BufferBgMissToday,');
query.push('n.BufferLgMissThisHour,');
query.push('n.BufferLgMissToday,');
query.push('n.BufferHgMissThisHour,');
query.push('n.BufferHgMissToday,');
query.push('n.OrionIdPrefix,');
query.push('n.OrionIdColumn,');
query.push('n.SkippedPollingCycles,');
query.push('n.MinutesSinceLastSync,');
query.push('n.EntityType,');
query.push('n.DetailsUrl,');
query.push('n.DisplayName,');
query.push('n.Category,');
query.push('n.IsOrionServer,');
query.push('n.UnManaged,');
query.push('n.UnManageFrom,');
query.push('n.UnManageUntil,');
query.push('n.Image,');
query.push('n.AncestorDisplayNames,');
query.push('n.AncestorDetailsUrls,');
query.push('n.StatusIconHint,');
query.push('n.InstanceType,');
query.push('n.Uri,');
query.push('n.InstanceSiteId,');
query.push('n.NodeProperties.CiscoChassis.ChassisSerialNumberString,');
query.push('n.HardwareHealthInfos.ServiceTag,');
query.push('n.CustomProperties.SERIALNUMBER_MANUAL');
query.push('FROM Orion.Nodes AS n');
query = query.join('\n');
query = encodeURI(query);
restMessage.setEndpoint("YOURSOLARWINDSENDPOINT/SolarWinds/InformationService/v3/JSON/Query?query=" + query);
restMessage.setRequestBody(JSON.stringify(requestBody));
restMessage.setMIDServer('winappinf45409_shk_prod_mid');
var response = restMessage.execute();
var error = response.haveError();
if(error){
var errorCode = response.getErrorCode();
var errorMsg = response.getErrorMessage();
} else {
}
var headerVal = response.getHeader("Content-Type");
var headers = response.getHeaders();
var queryString = response.getQueryString();
var statusCode = response.getStatusCode();
var responseBody = response.getBody();
var responseObject = JSON.parse(responseBody);
var importSet = new GlideRecord('sys_import_set');
importSet.setValue('table_name','u_import_solarwinds');
importSet.setValue('state','loaded');
var importSetSysid = importSet.insert();
for (var i = 0;i<responseObject.results.length;i++){
var is = new GlideRecord('u_import_solarwinds');
is.initialize();
is.setValue('sys_import_set', importSetSysid);
for(var prop in responseObject.results[i]){
var field = 'u_' + prop.toLowerCase();
var value = responseObject.results[i][prop];
is.setValue(field,value);
}
is.insert();
}
var swTransformMap = '4c680363db61a3408b079c41ba961960'; // Solarwinds Transformmap
var transformWorker1 = new GlideImportSetTransformerWorker(importSetSysid, swTransformMap);
transformWorker1.setBackground(true);
transformWorker1.start();
That's how we did it. than transform map to proper network class.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2019 08:22 AM
Thanks for your response,
So do I need any knowledge on SolarWinds Tables in order to write this Script? How do I get the information on what table needs to use of what field is which table?
Do you have any documentation on this that you can share with me redacting your private information?
Thanks,
Kumar