Contents
The Device42 ServiceNow Integration connects Device42 to ServiceNow. The integration enables users to seamlessly add Device42’s IT infrastructure management capabilities to their ServiceNow solution for an enhanced IT experience.
Device42-ServiceNow Integration
Using the Device42-ServiceNow integration connector, ServiceNow users can synchronize Device42’s enhanced asset management and tracking capabilities to their ServiceNow IP-enabled configuration items (CI) data maintained inside ServiceNow’s Configuration Management Database (CMDB). This synchronization can be manually refreshed at any time by the user and also scheduled for an automatic refresh at user-defined intervals.
ServiceNow Integration — Technical Overview
Managing ServiceNow Data Sources
Each ServiceNow data source points to one data source endpoint. From ServiceNow, the URI endpoints look something like this:
Version 3.0.0+
Cloud Connector Configuration
sn/route_doql_csv/{DOQL Name}
Direct Connection Configuration (3.0.0+ only)
/services/data/v1.0/query/?saved_query_name={DOQL Name}&delimiter=,&header=yes&output_type=csv
Version 2.0.1 (or previous)
Cloud Connector Configuration
sn/route_doql_csv/{VERIFICATION TOKEN}/{DOQL NAME}
The general request flow is as follows:
Cloud Connector Configuration
- When a request is made to the CC (Cloud Connector), the CC finds the appropriate account (by matching verification tokens). That account’s appliance_guid and am_guid are then utilized by the WebSocket server to route the request to the appropriate client.
- The verification token is then validated on the Device42 instance to ensure that the cloud connector has appropriate access to the utilized resources. If the integration is configured for direct connections only, the request is rejected. Otherwise, the request is processed.
- The CC then runs the appropriate DOQL query against the proper Device42 instance on behalf of the requesting ServiceNow instance and then returns the query results to ServiceNow for processing by the data source transformation maps.
Direct Connection Configuration
- When a request is made directly to the Device42 appliance, Device42 searches for a configured integration with a matching verification token. The request goes through a verification procedure to ensure that the request is valid, and that the integration can make direct connection to the Device42 appliance. If it fails, the request is rejected. Otherwise, the request is processed.
- The Device42 instance then runs the appropriate DOQL query, then returns the query results to ServiceNow for processing by the data source transformation maps.
Custom Device42 DOQL Datasources
Using Device42’s stored DOQL (Device42 object query language), ServiceNow integration users are able to customize exactly the data that their Device42 instance sends to ServiceNow, leveraging the full power of DOQL in any way they wish. Simply add a new Saved DOQL query in Device42, and then add a new ServiceNow datasource that points to that query. Saved DOQL queries are managed via the D42 Main Menu -> Tools -> Integrations -> Saved DOQL Queries.
In ServiceNow, you can create and/or modify existing data sources, setting the ‘file’ path as such, modifying the string below to reference the name of your new D42 Saved DOQL query:
Note:
The file path field for a data source is limited to 100 characters by default; if for any reason you are unable to enter the entirety of your file path, you can work around this by assigning your custom query to a system property and utilizing it in the field using ${name_of_your_system_property}, or simply increasing the character limit of the data source file path field.
System Property Method:
Cloud Connection:
Name: name_of_your_system_property
Type: String
Value: YOUR_DOQL_NAME
Direct Connection:
Name: name_of_your_system_property
Type: String
Value: saved_query_name=YOUR_DOQL_NAME&delimiter=,&header=yes&output_type=csv
Do not include `?` symbols in your system property as ServiceNow will percent encode them when retrieving the system property value. Instead include them in the file path field itself.
/services/data/v1.0/query/?${name_of_your_system_property}
Increase Field Length:
You may also increase the character limit of this field by navigating to System Definition > Tables > sys_data_source > File Path and increasing the max character length on this page and update the table.
Version 3.0.0+
Cloud Connection
File Path: sn/route_doql_csv/YOUR_DOQL_NAME
Username: You may use any value here, but it is required
Password: ${x_192652_device42.instance_key}
Please note: in versions 3+, because we use the Identification and REconsiliation Engine (IRE) all records will appear to be ignored.
Direct Connection (3.0.0+ Only)
File Path: /services/data/v1.0/query/?saved_query_name=YOUR_DOQL_NAME&delimiter=,&header=yes&output_type=csv
Username: You may use any value here, but it is required
Password: ${x_192652_device42.instance_key}
Version 2.0.1 (or previous)
Cloud Connection
sn/route_doql_csv/${x_192652_device42.instance_key}/SAVEDDOLQNAME
To add a custom DOQL data-source, in Servicenow, head to System Import Sets -> Administration -> Data sources:
Then go ahead and add your new data source:
Note that you must create a data-source per endpoint to add more than one!
That’s all there is to it! ServiceNow should now have access to your new data source. Should you run into any issues, email [email protected].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The Cloud Connector
The ServiceNow integration uses the Device42 Cloud Connector to facilitate communication between a user’s ServiceNow Cloud instance and Device42 instance without requiring that Device42 be exposed to the internet.
This is accomplished by re-use of a WebSocket connection initiated by the Device42 appliance to the Cloud Connector.
For a detailed rundown of the Cloud Connector communication & security architecture, see our Cloud Connector documentation here.
There is also a direct connection option available on version 3.0.0+ of the ServiceNow integration plugin for users who would like to keep their integration in their private network.
Integration Setup / Configuration Overview
Downloading the ServiceNow Integration
Download the Device42 – ServiceNow connector from the ServiceNow Marketplace
Installing and Configuring the Integration
Version 3.0.0+
If you have the latest version of the ServiceNow integration plugin, you will be required to follow a few additional steps to configure the plugin and utilize ServiceNow’s Identification and Reconciliation Engine (IRE).
Install needed dependencies on ServiceNow (NewYork only; Orlando has this dependency pre-installed).
- Navigate to System Definition > Plugins.
- Search for Configuration Management For Scoped Apps (CMDB).
- Click install and allow the dependency to be installed.
Add Device42 as the Datasource choice list record (New York and Orlando+).
- Navigate to System Definition > Scripts – Background.
- Ensure that the script is set to run in the global scope.
- Paste the following script into the run script text box and select run script’
var discoverySource = ‘Device42’;
var gr = new GlideRecord(‘sys_choice’);
gr.addQuery(‘element’, ‘discovery_source’);
gr.addQuery(‘name’, ‘cmdb_ci’);
gr.addQuery(‘value’, discoverySource);
gr.query();
if (!gr.hasNext()) {
var grNew = new GlideRecord(‘sys_choice’);
grNew.initialize();
grNew.setValue(‘element’, ‘discovery_source’);
grNew.setValue(‘name’, ‘cmdb_ci’);
grNew.setValue(‘value’, discoverySource);
grNew.setValue(‘label’, discoverySource);
if (!grNew.insert()) {
gs.info(‘Adding discovery source failed for: ‘ + discoverySource);
}
}
If you are not on version 3.0.0+, or have completed these steps, continue with the rest of the configuration.
1) Begin by ensuring that the External Integration Settings section of your Device42 Global Configuration (the D42 URL for SaaS apps: field) is correctly set. Head to the Device42 main menu, Tools -> Settings -> Global Settings, go to the External Integration Settings section, and enter your Device42 instance’s URL or IP address in this field (e.g., https://myd42url.com
). If you aren’t based in the USA, you can change to the optional Europe-based Cloud connector in the same section:
2) Login to Device42, go to Tools > Integrations > External Integrations.
3) Create a new External Integration using ServiceNow from the drop down, and set the URL as your ServiceNow URL.
For version 3.0.0+:
Direct Connection
If you have the latest version of Device42 you will see an option on the ServiceNow external integration page that displays a Direct Connect option. If you would like to configure the integration to use direct connection, ensure that this option is checked. You cannot go back and change this option (you will have to delete and setup a new configuration), so confirm your settings before creating the integration.
Cloud Connection
Ensure that the Direct Connect option is unchecked.
For version 2.0.1:
Cloud Connection
Create the integration by following entering the URL of your ServiceNow instance. The Token credential field is not utilized in the ServiceNow integration so you may use whatever you wish for this field.
Note the Verification Token, you’ll need to enter this in ServiceNow:
4) Login to your ServiceNow instance and install the Device42 integration.
Download and install the Device42-ServiceNow connector from the ServiceNow store and install it.
5) Once installed, search for Device42 Settings and click on it.
a) On the settings page click at the top of the page to enable editing (See below)
b) Fill in the URL for the Device42 connector (connect.device42.net), and paste in the Verification token you have from D42 (see first steps above) and enter your D42 URL, then Save.
6) Configure data sync schedules as appropriate for your environment. Search ServiceNow for System Import Sets to find the schedules page:
These can be scheduled to run at certain times – they should be run in the order highlighted above – Devices, IP’s, Services, Software Details (version 2.0.1) and Software Instances. You can click on an individual schedule to edit it or to Execute Now.
The scheduled imports first run the respective data source to collect and store data into the import set tables for a given data source. After this data has been imported into this table a transform script is run to map the data into ServiceNow’s internal tables. Version 3.0.0 of the ServiceNow integration plugin leverages ServiceNow’s IRE module. For more information on this feature, please visit ServiceNow’s documentation page:
To view devices that have been imported or to debug any issues, please visit the import log by navigating to System Import Sets > Import Log. This is a very useful page utilized by the IRE and can help you track the majority of common problems
Required ServiceNow User Roles for Non-Admins
For the ServiceNow integration, there are a few user roles that need to be granted to a user to allow them to edit our Data Sources / Transform Maps. This is not required for the application to run “out of the box,” but if customers want to make changes, they’ll need to add the following user roles to authorized users.
ServiceNow User Management Screen
The specific groups required (for users who are not already ServiceNow admins) for full integration functionality and the ability to edit the CI transform maps and data sources are:
-
-
- import_set_loader
- import_transformer
- import_scheduler
- import_admin
- x_192652_device42.Device42_Admin
-
A quick overview of the Device42-ServiceNow connector, screenshots, and links to the ServiceNow store can be found on our ServiceNow integration page
If you have any questions that weren’t covered here, feel free to reach out to [email protected].
Increasing Field Size for Imported Device42 Data
If data coming in from Device42 is being truncated, follow the steps below in ServiceNow to increase the column length limit. These steps are to be done at the discretion of the user. Please be aware that making changes to the sys_properties table will affect all applications and cause the field lengths for all import sets to automatically increase in size if data being imported is greater than the default character limit.
To have the import set table column size automatically based on the size of the data, follow these steps in ServiceNow:
- Search for tables.
- Click System Definition > Tables.
- Find the sys_properties table and click it.
- Scroll down the page and find Related Links.
- Click Show List.
- Add a new system property with the following information:
- Name = com.glide.loader.verify_target_field_size
- Application = Global
- Type = true | false
- Value = true
- Read Roles = appropriate roles (e.g., admin)
- Write Roles = appropriate roles (e.g., admin)
- Click the Submit button.
- Run the D42 Device Import Schedule scheduled job to sync device data from Device42 to ServiceNow.
The data should now appear in ServiceNow without truncation.
Updating the Integration
If you updated the ServiceNow app from version 4.0.0 or older, a script should be run to delete old software instance records that were created by the app and are no longer needed. These cmdb_software_instance records that will be deleted will have a name that has the format [software_name]_instance. To delete these records, follow the steps below.
-
Go to System Definition > Fix Scripts.
- Search for the fix script with the name D42_Remove_Software_Instances.
- Click D42_Remove_Software_Instances.
- Copy all lines from the script field except the first line which has /* and the last line which has */.
- Go to System Definition > Scripts – Background.
- Paste the script that you copied into the run script field.
-
Select global for in scope.
-
Click the Run script button.