How to automate the creation of Orion Platform (aka Core) nodes from the API

As our customers deploy more SolarWinds products, we see an increasing number of demand for a programmatic way to export and/or import nodes (as well as interfaces, volumes…) from/to an Orion instance.

 

The combinations of products involved in these scenarios cover, but are not limited to combinations such as:

 

  • Export nodes from NCM and import them into NPM network monitor
  • Export nodes from your own CMDB and import them into NPM
  • Export nodes from your own CMDB and import them into NCM
  • Export nodes from NPM and import them into NCM

 

This blog contains and describes a working PowerShell script example, that exports nodes from SolarWinds NPM network monitoring software and imports  them into NCM, but it can be easily modified to accommodate other combinations, including non-SolarWinds sources (CMDB)

 

The required configuration to run this script is:

 

  • NPM 10.2.x or 10.3.x (different versions of the script are required, see below)
  • NCM 7.0.2 or 7.1.x (different versions of the script are required, see below)
  • SDK 1.3 or 1.4 or 1.5
  • Windows PowerShell (ISE is used in this illustration)

 

The script for 10.2.x is located here:PowerShell script that exports Nodes from NPM and imports them into NCM (for Core 2011.2.x and before - NPM 10.2 and before).

The version adapted for Core 2012.1 (comes with NPM 10.3) is here: PowerShell script that exports Nodes from NPM and imports them into NCM (for Core 2012.1 and after - NPM 10.3 and after)

 

Here is an example of run, which extracted 561 nodes from my NPM 10.2.2 and imported them into my NCM 7.0.2

 

  • The upper panel of PowerShell ISE contains the script. The first 2 blocks define hosts and credential for your data source (NPM in this example) and target (NCM in this example). These need to be changed for your environment, of course.
  • The second panel shows the trace of the run. Should be pretty self explanatory.

 

image_thumb_03D8D49E.png

 

  • After the run, the target system (NCM 7.0.2) had 561 more nodes. As you can see, the nodes added by the API, are “tagged” with a property called “ImportedByAPI”, so you can easily identify, group and mass-modify them if needed.

 

image_thumb_30EDC16C.png

 

A few features of the script:

 

  • Nodes that already exist (same IP) in the target system, are skipped. The trace will send you messages such as this:

 

image_thumb_296251FF.png

  • The script as uploaded, actually ignores interfaces and volumes, but just because the 2 relevant sections are “commented out”. Look for sections like this and remove the If (0) {…} to enable them and start moving interfaces and volumes too (interfaces requires NPM network management software on both sides of the script, of course)

 

image_thumb_41F1EF4F.png

 

  • The script extracts all properties from the Nodes and copies them over to the target Orion.
  • If you run this script against an NCM 7 target, prior to 7.0.2 (i.e. 7 or 7.0.1), the added node won’t be manageable by NCM (they will just be in Core), you will need to add them manually to NCM, using the Add or Manage Nodes UI. NCM 7.0.2 has a new API verb that imports the node up to NCM, so it becomes immediately and automatically manageable by NCM. The last line of the script takes care of this:

 

image_thumb_3583CC26.png

 

I hope you will enjoy and benefit from this script, and I don’t want to finish without thanking Tim and Tomas for their invaluable help!

Try the 30-day free download of NPM and NCM network management software.

Thwack - Symbolize TM, R, and C