Free utilityIntegration

Make ServiceNow better by syncing CI data from Device42

If you currently use Device42 and ServiceNow, or have recently acquired either, you can now easily synchronize your Configuration Items between the two with our new open source Device42-ServiceNow Integration script. This python script connects to both your Device42 and ServiceNow APIs, reads the relevant Configuration Item (CI) data, and sends that data to ServiceNow or Device42 depending on which way the synchronization is configured to run.

 

You can rely on Device42’s Continuous Discovery technology to automatically maintain an up-to-date inventory of your physical, virtual, and cloud servers and containers, network components, software, services, applications, and their inter-relationships and interdependencies, and then sync that data with ServiceNow at any time. The sync can be manually run to refresh data at any time, or can be scheduled (via crontab, for example) to run automatically.

A summary of the information below and can also be found on our ServiceNow to Device42 Migration GitHub page, and full details can be found in the README.MD file in the linked repository. Do also check out our ServiceNow Integration page for screenshots of custom fields created within ServiceNow and populated with data from Device42.

 
About the script:

 

Assumptions:

  • The script assumes you have a working, licensed ServiceNow instance
  • This script has been tested to work with Device42 10.5.0.1473709546 or newer

Requirements:

  • python 2.7.x
  • requests (you can install it with $ pip install requests or $ apt-get install python-requests)

Usage:

  1. Create a working directory and copy at minimum [from the GitHub repo] the files: lib.py, sync.py, and mapping.xml.sample
  2. Make a copy of or rename the sample mapping.xml.sample to mapping.xml
  3. Configure sync by putting fields you want to sync into mapping.xml file, following the example entries already present. Be sure to create a custom field for each ServiceNow Table in mapping.xml, and set task enable to true for the syncs you want to run [e.g. <task enable=”true” description=”Copy from Servicenow to Device42″>]
  4. Add both ServiceNow and Device42 URL and credentials to the mapping.xml file:

 

   <settings>
        <servicenow
                url="ServiceNow URL"
                user="SN_USERNAME"
                password="SN_PASS"/>
        <device42
                url="Device42 URL"
                user="D42_USERNAME"
                password="D42_PASS"/>
    </settings>

 

  1.           Run the script with $ python sync.py

or, if python is in your $PATH and the script is set executable (chmod +x),

you can just execute: $ ./sync.py

 
Compatibility and Supplementary Info

 

  • Script will run on Linux and Windows [via Python 2.7.x]

 

  • mapping.xml – file that sets relations between Device42 and ServiceNow
  • lib.py – file that describes how fields should be migrated
  • sync.py – initialization and processing file; prepares API calls
  • Each section of mapping.xml has a `task enable` setting that can be either true or false. Changing this value enables or disables sync for items in that section
  • Within each section, there exists a field mapping. Resource refers to D42 API parameter, and target means ServiceNow field name. For complete information, consult the README.MD file on GitHub.

 
This ServiceNow mapping / sync script is provided as-is, and without any support. We do provide fee-based professional services and support if you need help with this script. For more information, please email [email protected], subject “ServiceNow script support”.

Share this post

About the author