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.

10.4.1 - use of Orion.Discovery verbs

FormerMember
FormerMember

I was using the SWQL Studio to look through a server newly updated to NPM 10.4.1 and noticed the verbs "CreateCorePluginConfiguration" and "StartDiscovery" on the new Orion.Discovery object. I was able to pull out the XML templates for their parameters from the Metadata.VerbArgument section, but I'm not clear on their usage. For some context, we're trying to programmatically add interfaces to a node and only add the new interfaces that are in an up/up state. It looks like we can do it if the interfaces are in the Orion.NPM.DiscoveredInterfaces table, but we don't know how to get them there and we're hoping/assuming that using these verbs will get them there.

I have three questions about actually using these verbs, and hoping someone here can provide some insight:

  1. Would using these verbs actually add a node/interfaces to the DiscoveredNodes/DiscoveredInterfaces tables, as we're hoping?
  2. It looks like we could use StartDiscovery if we can update the discovery engine on the fly to only discover the relevant IP address. Is this possible via SWIS? If so, does anyone have any guidance on updating the ranges for the discovery engine?
  3. It looks like CreateCorePluginConfiguration might get us what we want (i.e., a request to only discover specific IPs in a range.) Is there any guidance available on using this method in conjunction with StartDiscovery to do that?

Thanks!

  • FormerMember
    0 FormerMember

    Figured it out on my own. Explanation below, but please note that I'm coming at this almost entirely from an integration perspective (and so may have some specifics about how NPM works somewhat wrong).

    Working from the XSD also stored in the metadata, you use the "CreateCorePluginConfiguration" verb and build out the following XML as the argument (if you're using the Bulk List of IPs):

    <CorePluginConfigurationContext xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.solarwinds.com/2012/Orion/Core">

    <BulkList>

    <IpAddress>

    <Address>(device address)</Address>

    </IpAddress>

    </BulkList>

    <Credentials>

    <SharedCredentialInfo>

    <CredentialID>(credential ID as in Orion.Credentials)</CredentialID>

    <Order>(order to try credentials in)</Order>

    </SharedCredentialInfo>

    </Credentials>

    <WmiRetriesCount>0</WmiRetriesCount>

    <WmiRetryIntervalMiliseconds>0</WmiRetryIntervalMiliseconds>

    </CorePluginConfigurationContext>

    The XML response passes back an xml-encoded string that contains the XML configuration for the discovery. For my particular use case, I had to strip off the XML header from this return - your mileage may vary depending on the tools you're using. You stuff this string into the argument for "StartDiscovery", which will be an XML block that looks like the following (timeout and retry parameters not described - should be pretty straightforward):

    <StartDiscoveryContext xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.solarwinds.com/2012/Orion/Core">

    <Name>(discovery name to use)</Name>

    <EngineId>(Engine ID - as Orion.Engines)</EngineId>

    <JobTimeoutSeconds>3600</JobTimeoutSeconds>

    <SearchTimeoutMiliseconds>2000</SearchTimeoutMiliseconds>

    <SnmpTimeoutMiliseconds>3000</SnmpTimeoutMiliseconds>

    <SnmpRetries>1</SnmpRetries>

    <RepeatIntervalMiliseconds>1800000</RepeatIntervalMiliseconds>

    <SnmpPort>161</SnmpPort>

    <HopCount>0</HopCount>

    <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>

    <DisableIcmp>false</DisableIcmp>

    <AllowDuplicateNodes>true</AllowDuplicateNodes>

    <IsAutoImport>false</IsAutoImport>

    <IsHidden>true</IsHidden>

    <PluginConfigurations>

    <PluginConfiguration>

    <PluginConfigurationItem>

    (the plugin configuration string from the previous call)

    </PluginConfigurationItem>

    </PluginConfiguration>

    </PluginConfigurations>

    </StartDiscoveryContext>


    The response contains the ID of the created discovery profile, which starts immediately. From there results are in the Orion.DiscoveryProfiles, Orion.DiscoveredNodes, and Orion.NPM.DiscoveredInterfaces tables as you'd expect.

  • Hi Robert,

    Great info!  Is there a way to start a discovery using an already created Discovery Profile without adding a new profile?  It seems the StartDiscovery Verb always creates a new profile even when you "point" it to an already created Discovery Profile.

    Thanks!

    Chris

  • Can setting the IsAutoImport section to true make the discovery import all results after it's completed? If so then this is fantastic as I won't have to pull in the Discovered Nodes and Discovered Interfaces and add them all in using more scripting.

  • Yes, this is correct assumption. We use it quite often. Enjoy it;-)

  • I found that there is a column at the end of our discovery profiles that is true/false for IsAutoImport. I'm trying it now but I think maybe this is something I can use instead of trying to generate the XML for a discovery. Though I would still like to learn how to do that sort of generation and automation.

    Are there any good examples or tutorials you've used for something like this? I'm a very new beginner to the SDK.

  • I've found the framework for the discovery request in the SWQL studio but I'm not sure how to work with it. I'm seeing tags like <BulkList /> and I'm not familiar with them. Below is what I'm getting as output and would like to know a little more about the <something /> tags I'm seeing. I've not worked with XML much but a little html so the / at the end is confusing me.

    <CorePluginConfigurationContext xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.solarwinds.com/2012/Orion/Core"><BulkList /><IpRanges /><Subnets /><Credentials /><WmiRetriesCount>0</WmiRetriesCount><WmiRetryIntervalMiliseconds>0</WmiRetryIntervalMiliseconds></CorePluginConfigurationContext>

  • Ok so a little digging and I found that <something /> is an empty set and is the same as <something></something>. Now my question is do we need these empty sets or can we remove them. My attempts all lead to the following error message:

    pastedImage_0.png

  • If you post the inputs that are leading to this error message, I might be able to guide you.

  • Here is what I'm doing in PowerShell. SWQL studio seems to have added one discovery but I can't tell if subsequent runs of the verb overwrite the job or if it's not working any more.

    if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {

        Add-PSSnapin "SwisSnapin"

    }

    $hostname = "localhost"

    $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

    $z = '<CorePluginConfigurationContext xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.solarwinds.com/2012/Orion/Core">

    <BulkList >

    <IpAddress>

    <Address>192.168.21.3</Address>

    </IpAddress>

    </BulkList>

    <IpRanges />

    <Subnets />

    <Credentials>

    <SharedCredentialInfo>

    <CredentialID>1</CredentialID>

    <Order>1</Order>

    </SharedCredentialInfo>

    </Credentials>

    <WmiRetriesCount>0</WmiRetriesCount>

    <WmiRetryIntervalMiliseconds>0</WmiRetryIntervalMiliseconds>

    </CorePluginConfigurationContext>'

    $discovered = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration $z

  • CreateCorePluginConfiguration does not create a discovery profile in the database. It just takes the input (CorePluginConfigurationContext), combines it with some other data, and returns a blob of XML that you need for the next step: calling Orion.Discovery.StartDiscovery. That verb expects a StartDiscoveryContext object. This object has a bunch of properties including PluginConfigurations, which has type List<PluginConfiguration>. A PluginConfiguration just has one property of type string called PluginConfigurationItem. Take the XML that was returned by CreateCorePluginConfiguration and use it as the value for PluginConfigurationItem.