Showing posts with label Dependencies. Show all posts
Showing posts with label Dependencies. Show all posts

How to Bulk Disable/Enable Topology Polling on All SolarWinds Orion Nodes (SQL)

If you're not familiar with topology polling, it is used by SolarWinds Orion to determine the node-to-node dependencies. So, for example, if a switch goes down you would get an alert for the switch and not for all of the dependent child nodes that are plugged into the switch.

One of the SolarWinds Orion environments that I took over had topology polling disabled on a large portion of the nodes. This prevented a lot of dependencies from being created which otherwise would have been.

Of course, you could go through all of the nodes one at a time, hit the list resources button, and add topology polling back to each one of them. Or, you could run a simple SQL query to enable it on each of the nodes that have it disabled.

Let's start by identifying which nodes have topology polling disabled. The select statement below will find all of them and also get the related node information from the NodesData table so that you sanity check what you're going to change.

SELECT n.Caption
, n.IP_Address
, n.Vendor
, n.MachineType
, p.PollerID
, p.PollerType
, [Enabled]
FROM Pollers p
INNER JOIN NodesData n ON n.NodeID=p.NetObjectID
WHERE PollerType LIKE 'N.Topology%' AND [Enabled] = 0

If all of the results look good to you, the query below can be used to enable topology polling on any nodes that have the setting explicitly disabled.

UPDATE Pollers
SET [Enabled] = 1
WHERE PollerType LIKE 'N.Topology%' AND [Enabled] = 0

Easy peasy! I have a couple variations of these on GitHub if you want to go the other way and disable topology polling in mass. Those are linked below

How to Bulk Enable Application Dependency Mapping on Agents in SolarWinds Orion Using PowerShell

SolarWinds Server & Application Monitor (SAM) has a feature called Application Dependency Mapping. This feature analyzes the connections on servers running the Orion agent to determine which processes and servers are talking to each other. It then takes those connections and creates application dependencies for them.

Identifying and enabling application dependency mappings programmatically in SolarWinds Orion can get a little funky. Below is a PowerShell script which finds any agents that do not have application dependency mappings enabled and enabled it on them. I also have this script posted on GitHub if you'd prefer to grab it from there. Sometime copying code from a web page can morph characters.

# Verify that the OrionSDK is installed and available.
# This is a required prerequisite for this script.
# It can be downloaded from https://github.com/solarwinds/OrionSDK
if (!(Get-Command Get-SwisData)) {
    if (!(Get-PSSnapin | Where-Object { $_.Name -eq "SwisSnapin" })) {
        Try {
            Add-PSSnapin "SwisSnapin"
        } Catch {
            if (Test-Path "C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll") {
                C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll" | Out-Null
                C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll" | Out-Null
            } else {
                Write-Host "This script requires the OrionSDK to be installed." -ForegroundColor Red
                Write-Host "https://github.com/solarwinds/OrionSDK" -ForegroundColor Red
            }
        }
    }
}

# Checking to see if we already have stored credentials.
# If not, we'll prompt for credentials and securely
# store them with Export-CLIXML.
$ApiCredPath = $env:Userprofile + '\ApiCreds'
if (!(Test-Path -Path $ApiCredPath)) {
    $ApiCred = Get-Credential -Message "Please enter your credentials for SolarWinds Orion"
    if ($ApiCred) {
        Export-Clixml -Path $ApiCredPath -InputObject $ApiCred
    }
}
$SwCredential = Import-Clixml -Path $ApiCredPath -Verbose

# Checking to see if we have a cached an Orion server.
# If not, we'll prompt for hostname or IP address of the
# primary Orion server and cache it to the Orion environment variable.
if (!$Env:Orion) {
    $OrionServer = Read-Host "Enter the hostname or IP of your primary Orion server."
    if ($OrionServer) {
        New-Item -Path Env:\Orion -Value $OrionServer
    }
}
$Swis = Connect-Swis -Hostname $env:Orion -Credential $SwCredential

# Get agent nodes that don't yet have application dependencies enabled
$NodesQuery = @"
    SELECT NodeID, ObjectSubType, IPAddress, Caption, n.CustomProperties.Environment, n.Inventory.NodeID AS [InventoryNodeID]
    FROM Orion.Nodes n
    WHERE n.ObjectSubType='Agent' AND 
        n.Inventory.NodeID IS NULL AND 
"@

$Nodes = Get-SwisData -SwisConnection $Swis -Query $NodesQuery


# Loop through each of the nodes and enable application dependencies
foreach ($Node in $Nodes) {
    Invoke-SwisVerb -SwisConnection $Swis -EntityName Orion.ADM.NodeInventory -Verb Enable -Arguments @( ,@( $($Node.NodeID) ) )
}

Enable-ApplicationDependencyPolling.ps1

Issue Where SolarWinds Orion Agents Show As Connected But They Are Not Updating Statistics (RESOLVED)

This issue can easily slip by unnoticed. All of that status indicators still show green, so everything is good, right? Not so! Statistics an...