This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Questions about dealing with discovery using the SDK

I've got a rather large network that spans 100 countries. We have some 4200 subnets across over 480 discovery profiles that we're constantly scanning in order to find new devices.

This, of course, creates a rather populated DiscoveryNodes table. Fortuantely, I don't have to accept everything that's found. I have an IPAM tool that handles registrations, and I only need to start managing nodes that meet certain criteria out of the IPAM tool. The best thing is that I can script pulling exactly which Nodes and IP addresses matter to me from my IPAM tool and can match it using queries against the DiscoveredNodes table to know which ones I want to start monitoring. I already have a script that does this, and right now I just kick out a spreadsheet to tell us which nodes need to be promoted, which we currently have to do manually.

The next obvious step: I want to automate the frontend manual process of managing a discovered node. I know exactly which disocvered nodes need to get added. But while I can extract the various fields from the Discovered node table to fill in the required properties on an Addnode, that seems clunky compared to just choosing a row from the DiscoveredNodes table, and promoting it to be a managed node similar to how you'd do it from the frontend.

Thing is, I can't tell if it's possible to promote a Discovered Node from to a managed one using the SDK. Can the SDK do this?

Separately, I have the same situation for Interfaces. I have interfaces in the DiscoveredInterfaces table that I know I want to manage. Can I do this with the SDK, or is it necessary to trigger the DiscoverInterfacesOnNode verb, and use those results to give it to AddInterfacesOnNode. Seems like a wasted discovery when the DiscoveredInterfaces already has what I need, and I can identify the ID that it has.

Thanks.

  • We don't have an API for importing a discovered node other than the method you have already discovered (use the DiscoveredNodes data to fill out the arguments for adding a node). We are looking at improving this in the future, so I'll make sure the team hears about this use case.

    With interfaces, there is not a direct way to add an interface from DiscoveredInterfaces. However, you can call AddInterfacesOnNode without having first called DiscoverInterfacesOnNode as long as you can fill out the structure. Something like this might work for you:

    Add-PSSnapin SwisSnapin

    $hostname = "tdanner-vm-08r2"

    $username = "admin"

    $password = New-Object System.Security.SecureString

    $cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password

    $swis = Connect-Swis -host $hostname -cred $cred

    $discoveredInterfaceID = 1

    $nodeID = 2

    $interface = Get-SwisData $swis "SELECT InterfaceIndex, InterfaceName, InterfaceAlias, InterfaceType, InterfaceSubType FROM Orion.NPM.DiscoveredInterfaces WHERE DiscoveredInterfaceID=@ifID" @{ifID=$discoveredInterfaceID}

    $caption = $interface.InterfaceName

    if ($x.InterfaceAlias -ne '') {

        $caption = "$caption · $($x.InterfaceAlias)";

    }

    $discoveredInterfaces = [xml]"

      <d1p1:DiscoveredInterfaces xmlns:d1p1=""http://schemas.solarwinds.com/2008/NPM"">

        <d1p1:DiscoveredLiteInterface>

          <d1p1:ifIndex>$($interface.InterfaceIndex)</d1p1:ifIndex>

          <d1p1:Caption>$caption</d1p1:Caption>

          <d1p1:ifType>$($interface.InterfaceType)</d1p1:ifType>

          <d1p1:ifSubType>$($interface.InterfaceSubType)</d1p1:ifSubType>

          <d1p1:Manageable>true</d1p1:Manageable>

        </d1p1:DiscoveredLiteInterface>

      </d1p1:DiscoveredInterfaces>";

    Invoke-SwisVerb $swis Orion.NPM.Interfaces AddInterfacesOnNode @($nodeID, $discoveredInterfaces.DiscoveredInterfaces, "AddDefaultPollers")

  • Ok. Thanks for the help. I'll probably implement it using Addnode. And see about the second part. I'm currently using the Perl library, so I'll see if I can translate it to that.

    And it only seem to makes sense to use the huge amount of useful information that we have in the DiscoveredNodes table to trigger addnode. I'd love to ee the SDK handle that.