3 Replies Latest reply on Dec 6, 2017 3:45 PM by dan jagnow

    Need some help with API Discovery script

    mesverrum

      I'm using powershell 4 and Orion Platform 2017.3.2.SP2, took some example scripts from others that were reported to be working and cleaned them up for my environment but when I try to run them in my environment they will run for a few seconds/minutes and then I keep getting errors saying that parsing of discovery results failed.

       

      Everything looks good from the powershell side as far as it not kicking back any errors.

       

      here is the script

       

       

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

          Add-PSSnapin "SwisSnapin"

      }

       

       

      #define target host and credentials

      $hostname = 'localhost'

      $user = "admin"

      $password = "password"

      # create a connection to the SolarWinds API

      $swis = connect-swis -host $hostname -username $user -password $password -ignoresslerrors

       

      $CorePluginConfigurationContext = ([xml]"

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

          <BulkList>

          <IpAddress><Address>10.40.40.63</Address></IpAddress>

          </BulkList>

          <Credentials>

              <SharedCredentialInfo>

                  <CredentialID>57</CredentialID>

                  <Order>1</Order>

              </SharedCredentialInfo>

          </Credentials>

          <WmiRetriesCount>1</WmiRetriesCount>

          <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>

      </CorePluginConfigurationContext>

      ").DocumentElement

      $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext)

      $InterfacesPluginConfigurationContext = ([xml]"

      <InterfacesDiscoveryPluginContext xmlns='http://schemas.solarwinds.com/2008/Interfaces'

                                        xmlns:a='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>

          <AutoImportStatus>

              <a:string>Up</a:string>

              <a:string>Down</a:string>

              <a:string>Shutdown</a:string>

          </AutoImportStatus>

          <AutoImportVirtualTypes>

              <a:string>Virtual</a:string>

              <a:string>Physical</a:string>

          </AutoImportVirtualTypes>

          <AutoImportVlanPortTypes>

              <a:string>Trunk</a:string>

              <a:string>Access</a:string>

              <a:string>Unknown</a:string>

          </AutoImportVlanPortTypes>

          <UseDefaults>true</UseDefaults>

      </InterfacesDiscoveryPluginContext>

      ").DocumentElement

      $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration @($InterfacesPluginConfigurationContext)

      $EngineID = 9

      $DeleteProfileAfterDiscoveryCompletes = "false"

      $StartDiscoveryContext = ([xml]"

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

          <Name> Test $([DateTime]::Now)</Name>

          <EngineId>$EngineID</EngineId>

          <JobTimeoutSeconds>3600</JobTimeoutSeconds>

          <SearchTimeoutMiliseconds>2500</SearchTimeoutMiliseconds>

          <SnmpTimeoutMiliseconds>2500</SnmpTimeoutMiliseconds>

          <SnmpRetries>1</SnmpRetries>

          <RepeatIntervalMiliseconds>2500000</RepeatIntervalMiliseconds>

          <SnmpPort>161</SnmpPort>

          <HopCount>0</HopCount>

          <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>

          <DisableIcmp>false</DisableIcmp>

          <AllowDuplicateNodes>false</AllowDuplicateNodes>

          <IsAutoImport>false</IsAutoImport>

          <IsHidden>false</IsHidden>

          <PluginConfigurations>

              <PluginConfiguration>

                  <PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>

                  <PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>

              </PluginConfiguration>

          </PluginConfigurations>

      </StartDiscoveryContext>

      ").DocumentElement

      $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText

       

       

       

       

       

      This is what I see in my discoverprofiles table

      174 Test 12/06/2017 13:22:460NULL93f6df1a9c-e8aa-44c0-a58b-bfe29a0a2f20002500250012500TrueFalseFalseFalseFalse060NULLNULL
      Parsing of discovery result failed.
      FalseFalse<?xml version="1.0"?>
      <ReportSchedule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:nil="true" />

       

      No entry gets added to the discoverylogs for these

       

      Anyone have any suggestions?

       

      I already tried modeling my discovery after what was in this post and the wiki, i basically get the same results no matter which one I use.

      API Network Discovery

      OrionSDK/DiscoverSnmpV3Node.ps1 at master · solarwinds/OrionSDK · GitHub