SWIS: Node Rediscovery Process based on Engine ID

Hi Folks,

I am trying to accomplish solarwinds node rediscovery process via SWIS. if i want to run the rediscovery for single/few nodes then it is running completely fine with below script. 

$username = "xxxx"
$password = ConvertTo-SecureString "xxxxx" -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ($username, $password)
$swis = Connect-Swis -Credential $creds -Hostname polling_server_name

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

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

$EngineID = 1
$DeleteProfileAfterDiscoveryCompletes = "false"

$StartDiscoveryContext = ([xml]"
<StartDiscoveryContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>
     <Name>Script Discovery $([DateTime]::Now)</Name>

$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" }

However, if i want to provide a moduler solution to admins to trigger rediscovery on particular polling engine for all its associated Nodes, then i am following below steps:

  1. Connect to SWIS and feed step 2,3,4 info into above script. 
  2. Find the engine ID
  3. All the nodes which are getting polled by that Engine ID
  4. All credential info which is associated with the particular Node. 
  5. then rest of below XML thing. 

Currently I am unable to feed all the info into the above script. Any help related to the same will be helpful, kindly assist. 

  • It reads like you are trying to build a function you can just have people call.  Something like this?

    Start-SwisDiscovery -SwisConnection $Swis -PollingEngine $PollingEngineName

    Is that generally what you are thinking?

    It's completely possible, but that would be a very bad idea as your environment grew larger.  There's every real chance that it would time out since a Network Discovery is not a light function - computationally speaking.

    I'd only use Network Discovery if I needed to get a list of child elements that I'm not currently monitoring (interfaces, volumes, etc.).  If you just want to do a simple rediscovery (refresh the information about the device), you could just decrease the Rediscovery Interval (in Orion.Nodes) for certain devices.

    I guess the larger question is: what are you actually trying to accomplish by offering this function to other users?

  • Hi KMSigma,

    Yes, this is exactly what i want to accomplish to enable my team to rediscover all the nodes and its resources on defined protocols (Like particular set of interfaces and volumes.)

    They are spending a lot of time to run manual discovery and by selecting required resources to be added into polling for each device. so we want to build something which leverage them to trigger discovery on per polling engine basis or by a set of IP ranges.