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.

Discovery Failing via API

After adding a new node to the Solarwinds via the SDK / API I run a discovery on the node but this fails.

I have looked in \OrionDiscoveryJob.log and all I can see is:

2020-04-27 15:27:10,929 [STP SmartThreadPool Thread #0] DEBUG ResultDumpLogger - Activities that ends up with error:
2020-04-27 15:27:10,945 [STP SmartThreadPool Thread #0] DEBUG ResultParser - Processing protocol 'WMI' (SolarWinds.Orion.Discovery.Contract.Protocols.DiscoveredWmiContext) on endpoint [IP: <IP> Hostname:<HOSTNAME.<DOMAIN> ].
2020-04-27 15:27:10,960 [STP SmartThreadPool Thread #0] DEBUG ResultParser - Discovered pollers [N.ResponseTime.ICMP.Native, N.Status.ICMP.Native, N.Details.WMI.Vista, N.Uptime.WMI.XP, N.Cpu.WMI.Windows, N.Memory.WMI.Windows], added pollers [N.ResponseTime.ICMP.Native on N:1, N.Status.ICMP.Native on N:1, N.Details.WMI.Vista on N:1, N.Uptime.WMI.XP on N:1, N.Cpu.WMI.Windows on N:1, N.Memory.WMI.Windows on N:1].
2020-04-27 15:27:10,960 [STP SmartThreadPool Thread #0] DEBUG ResultParser - Discovered pollers [V.Details.WMI.Windows, V.Statistics.WMI.Windows, V.Status.WMI.Windows], added pollers [V.Details.WMI.Windows on V:1, V.Statistics.WMI.Windows on V:1, V.Status.WMI.Windows on V:1].
2020-04-27 15:27:10,960 [STP SmartThreadPool Thread #0] DEBUG ResultParser - Processed protocol 'WMI' for endpoint [IP: <IP> Hostname:<HOSTNAME.<DOMAIN> ], skipping other protocols.
*** Assembly SolarWinds.NCM.Discovery.Plugin, Version=2019.4.0.3834, Culture=neutral, PublicKeyToken=null, .NET version v4.0.30319 ***
2020-04-27 15:27:10,976 [STP SmartThreadPool Thread #0] DEBUG HyperVDiscoveryPlugin - Number of Hyper-V nodes: 0
*** Assembly SolarWinds.PCU.DiscoveryPlugin, Version=2.0.0.3319, Culture=neutral, PublicKeyToken=null, .NET version v4.0.30319 ***
*** Assembly SolarWinds.Topology.DiscoveryPlugin, Version=3000.2.0.10599, Culture=neutral, PublicKeyToken=null, .NET version v4.0.30319 ***
2020-04-27 15:27:10,992 [STP SmartThreadPool Thread #0] DEBUG TopologyDiscoveryPlugin - Processing protocol 'WMI' (SolarWinds.Orion.Discovery.Contract.Protocols.DiscoveredWmiContext) on endpoint [IP: <IP> Hostname:<HOSTNAME.<DOMAIN> ].
2020-04-27 15:27:10,992 [STP SmartThreadPool Thread #0] DEBUG TopologyDiscoveryPlugin - Processing protocol 'ICMP' (SolarWinds.Orion.Discovery.Contract.Protocols.DiscoveredIcmpContext) on endpoint [IP: <IP> Hostname:<HOSTNAME.<DOMAIN> ].
2020-04-27 15:27:10,992 [STP SmartThreadPool Thread #0] DEBUG AssetInventoryDiscoveryPlugin - Getting profile results for AssetInventoryDiscoveryPlugin
2020-04-27 15:27:10,992 [STP SmartThreadPool Thread #0] DEBUG AssetInventoryDiscoveryPlugin - Processing endpoint <IP>.
2020-04-27 15:27:11,007 [STP SmartThreadPool Thread #0] DEBUG AssetInventoryDiscoveryPlugin - Endpoint <IP> has 1 features. Polling method: Wmi PollingDescription: WindowsServerWMI
2020-04-27 15:27:11,007 [STP SmartThreadPool Thread #0] DEBUG AssetInventoryDiscoveryPlugin - Feature 'Polling method: Wmi PollingDescription: WindowsServerWMI' selected for endpoint <IP>.
2020-04-27 15:27:11,163 [STP SmartThreadPool Thread #0] DEBUG JobMonitor - Stop tracking job d3f30ee1-831b-4c02-bb09-fcf4dadc059b


Here is a snippet of the code I am using - mostly unedited from the GitHub page for the SDK:

$EngineID = 1
$DeleteProfileAfterDiscoveryCompletes = "true"

$CorePluginConfigurationContext = ([xml]"
<CorePluginConfigurationContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
<BulkList>
<IpAddress>
<Address>$($IPAddress.IPV4Address.IPAddressToString)</Address>
</IpAddress>
</BulkList>
<Credentials>
<SharedCredentialInfo>
<CredentialID>$($credentialId.ID)</CredentialID>
<Order>1</Order>
</SharedCredentialInfo>
</Credentials>
<WmiRetriesCount>1</WmiRetriesCount>
<WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>
</CorePluginConfigurationContext>
").DocumentElement


$StartDiscoveryContext = ([xml]"
<StartDiscoveryContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
<Name>Script Discovery $([DateTime]::Now)</Name>
<EngineId>$EngineID</EngineId>
<SnmpRetries>1</SnmpRetries>
<RepeatIntervalMiliseconds>1500</RepeatIntervalMiliseconds>
<SnmpPort>161</SnmpPort>
<HopCount>0</HopCount>
<PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>
<DisableIcmp>false</DisableIcmp>
<AllowDuplicateNodes>false</AllowDuplicateNodes>
<IsAutoImport>true</IsAutoImport>
<IsHidden>$DeleteProfileAfterDiscoveryCompletes</IsHidden>
<PluginConfigurations>
<PluginConfiguration>
<PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
</PluginConfiguration>
</PluginConfigurations>
</StartDiscoveryContext>
").DocumentElement

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

Write-Verbose "$(Get-Date -Format 'dd/MM/yyyy HH:mm:ss'):`t DISCOVERY profile #$DiscoveryProfileID running..."

# WAIT until the discovery completes
do {
Write-Host -NoNewline "."
Start-Sleep -Seconds 1
$Status = Get-SwisData $swis "SELECT Status FROM Orion.DiscoveryProfiles WHERE ProfileID = @profileId" @{profileId = $DiscoveryProfileID }
} while ($Status -eq 1)

$Result = Get-SwisData $swis "SELECT Result, ResultDescription, ErrorMessage, BatchID FROM Orion.DiscoveryLogs WHERE ProfileID = @profileId" @{profileId = $DiscoveryProfileID }

# PRINT the outcome
switch ($Result.Result) {
1 { "InProgress" }
2 { "Finished" }
3 { "Error" }
4 { "NotScheduled" }
5 { "Scheduled" }
6 { "NotCompleted" }
7 { "Canceling" }
8 { "ReadyForImport" }
}
$Result.ResultDescription
$Result.ErrorMessage


Any ideas? The code hasn't changed since it stopped working. It seems to have stopped after updating to 2019.4.1, which seems to be a common thing I have found - random things not working via the API.

Anything else I should be looking for in the log file? I have made sure our instance of Solarwinds is up-to-date

Parents Reply Children
  • Seems I am getting the below now, which I don't think I was getting before

    2020-04-28 12:06:31,565 [STP SmartThreadPool Thread #47] DEBUG WMIHelper - Connection Attempt to <IP> as <DOMAIN>\<SVC_ACCOUNT> Failed.
    System.Management.ManagementException: Invalid namespace 
       at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
       at System.Management.ManagementScope.InitializeGuts(Object o)
       at System.Management.ManagementScope.Initialize()
       at System.Management.ManagementScope.Connect()
       at SolarWinds.APM.Probes.WMI.WMIHelper.DoActionWithRetry(Action action, Int32 retries, TimeSpan retryInterval, String logMessage)
    2020-04-28 12:06:31,597 [STP SmartThreadPool Thread #47] ERROR WMIHelper - Error while connecting to "<IP>" via WMI. errCode=InvalidNamespace
    System.Management.ManagementException: Invalid namespace 
       at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
       at System.Management.ManagementScope.InitializeGuts(Object o)
       at System.Management.ManagementScope.Initialize()
       at System.Management.ManagementScope.Connect()
       at SolarWinds.APM.Probes.WMI.WMIHelper.DoActionWithRetry(Action action, Int32 retries, TimeSpan retryInterval, String logMessage)
       at SolarWinds.APM.Probes.WMI.WMIHelper.ConnectWithRetry(String targetComputer, String userName, ManagementScopeContext[] scopes)
    2020-04-28 12:06:31,628 [STP SmartThreadPool Thread #47] DEBUG CacheDictionary`2 - Value for key 'WMI_<IP>_root\MSCluster_<DOMAIN>\<SVC_ACCOUNT>_745504234' retrieved.
    2020-04-28 12:06:31,628 [STP SmartThreadPool Thread #47] DEBUG WMIHelper - Host name for '<IP>: '<HOSTNAME>.<DOMAIN>'
    2020-04-28 12:06:31,628 [STP SmartThreadPool Thread #47] DEBUG WMIHelper - List of all IP addresses for '<IP>': <IP>
    2020-04-28 12:06:31,690 [STP SmartThreadPool Thread #47] DEBUG PowerShellScriptHelper - Creating remote runspace to https://<IP>:5986/wsman with schema http://schemas.microsoft.com/powershell/Microsoft.PowerShell
    2020-04-28 12:06:37,815 [STP SmartThreadPool Thread #47] VERBOSE PowerShellScriptHelper - output log: 
    2020-04-28 12:09:31,130 [STP SmartThreadPool Thread #1] DEBUG CacheDictionary`2 - Getting value for key 'WMI_<IP>_root\CIMV2_<DOMAIN>\<SVC_ACCOUNT>_745504234'
    2020-04-28 12:09:31,130 [STP SmartThreadPool Thread #1] DEBUG WMIHelper - Trying to connect to '<IP>' as '<DOMAIN>\<SVC_ACCOUNT>' with following scope properties: Path='\\<IP>\root\CIMV2', Username='<SVC_ACCOUNT>', Authority='NTLMDOMAIN:<DOMAIN>'
    2020-04-28 12:09:31,146 [STP SmartThreadPool Thread #1] DEBUG CacheDictionary`2 - Value for key 'WMI_<IP>_root\CIMV2_<DOMAIN>\<SVC_ACCOUNT>_745504234' retrieved.
    2020-04-28 12:09:31,162 [STP SmartThreadPool Thread #1] DEBUG CacheDictionary`2 - Getting value for key 'WMI_<IP>_root\MSCluster_<DOMAIN>\<SVC_ACCOUNT>_745504234'
    2020-04-28 12:09:31,162 [STP SmartThreadPool Thread #1] DEBUG WMIHelper - Trying to connect to '<IP>' as '<DOMAIN>\<SVC_ACCOUNT>' with following scope properties: Path='\\<IP>\root\MSCluster', Username='<SVC_ACCOUNT>', Authority='NTLMDOMAIN:<DOMAIN>'
    2020-04-28 12:09:31,177 [STP SmartThreadPool Thread #1] ERROR WMIHelper - Error while connecting to "<IP>" via WMI. errCode=InvalidNamespace
    System.Management.ManagementException: Invalid namespace 
       at SolarWinds.APM.Probes.WMI.WMIHelper.ConnectWithRetry(String targetComputer, String userName, ManagementScopeContext[] scopes)
    2020-04-28 12:09:31,177 [STP SmartThreadPool Thread #1] DEBUG CacheDictionary`2 - Value for key 'WMI_<IP>_root\MSCluster_<DOMAIN>\<SVC_ACCOUNT>_745504234' retrieved.
    2020-04-28 12:09:31,177 [STP SmartThreadPool Thread #1] DEBUG WMIHelper - Host name for '<IP>: '<HOSTNAME>.<DOMAIN>'
    2020-04-28 12:09:31,177 [STP SmartThreadPool Thread #1] DEBUG WMIHelper - List of all IP addresses for '<IP>': <IP>
    2020-04-28 12:09:31,209 [STP SmartThreadPool Thread #1] DEBUG PowerShellScriptHelper - Creating remote runspace to https://<IP>:5986/wsman with schema http://schemas.microsoft.com/powershell/Microsoft.PowerShell
    2020-04-28 12:09:37,365 [STP SmartThreadPool Thread #1] VERBOSE PowerShellScriptHelper - output log: 

    Other than that there isn't any more useful after changing:

    Discovery Job

    Result Dump

    from DEBUG to ALL