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]"
10.72.14.72
10.72.156.33
28
1
20
2
1
1000
").DocumentElement
$CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext)
$EngineID = 1
$DeleteProfileAfterDiscoveryCompletes = "false"
$StartDiscoveryContext = ([xml]"
Script Discovery $([DateTime]::Now)
$EngineID
3600
2500
2500
1
2500000
161
0
SNMP2c
false
false
false
false
$($CorePluginConfiguration.InnerXml)
").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
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:
- Connect to SWIS and feed step 2,3,4 info into above script.
- Find the engine ID
- All the nodes which are getting polled by that Engine ID
- All credential info which is associated with the particular Node.
- 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.