Showing posts with label GitHub. Show all posts
Showing posts with label GitHub. Show all posts

Why Your SolarWinds Orion Web Server Drives are Filling Up Over Time & How to Fix It

If you've had your SolarWinds Orion install for any length of time, you'll probably notice that the C: drives on the primary polling engine and/or any additional web servers (AWS) keep growing over time. The more support tickets you create, the faster these drives will fill up. Well, there's a reason for this...

When you generate a diagnostics from the Orion web console, it drops all of those hefty zip files on the C: drive of the web server that you were logged into when you generated them. Furthermore, it never cleans these up on it's own. If you're web server has been up for several years, you've probably got a pretty good chunk of disk sucked up by these diagnostic files.

They are easy enough to clean up though, if you know where they are hidden. Yes, they are literally hidden. They exist under the hidden file path of %ProgramData%\SolarWinds\Diagnostics. Typically, that ProgramData environment variable will point to C:\ProgramData which is a hidden folder, but the path can vary based on your server's configuration.

In order to automatically clean these up, I wrote the PowerShell script below and I run it daily from Task Scheduler. This simple one-liner will check the directory for any zip files older that 14 days and delete them. Typically, after you submit that zip file to support, you'll never use it again. So, you're not going to be missing anything by removing these old files.

Get-ChildItem -Path "$ENV:ProgramData\SolarWinds\Diagnostics" | `
Where-Object {$_.LastWriteTime -lt ((Get-Date).AddDays(-14)) -and $_.Extension -eq '.zip'} | `
Remove-Item -Force -Confirm $false

You will probably have to run this PowerShell snippet in an elevated PowerShell window for it to access these files if they have their default permissions.

I also have this script available on GitHub as Remove-OldOrionDiagnosticFiles.ps1 if you'd prefer to grab it from there.

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 Disable/Enable Multicast Polling on All SolarWinds Orion Nodes (SQL)

When I was doing SolarWinds consulting, I ran into a lot of clients complaining about poor database performance in relation to their multicast routing tables having millions of rows in them. These customers were often looking a quick and easy way to identify all of the nodes which have multicast polling enabled on them, as well as a way to quickly disable it.

First things first. If you want to identify which nodes have multicast polling enabled, you can run the SQL query below in Database Manager or SQL Server Management Studio.

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.MulticastRouting%' AND [Enabled] = 1

Whether you have used the query above to identify the nodes with multicast polling enabled or not, the SQL query below can be used to disable multicast polling on any nodes in Orion that currently have them enabled.

UPDATE Pollers
SET [Enabled] = 0
WHERE PollerType LIKE 'N.MulticastRouting%' AND [Enabled] <> 0

If you want to enable multicast polling on them again, you can just change the enabled line to equal one where it currently equals zero, like below.

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

Below are links to these SQL queries on GitHub:

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

Prelude

I have been working with SolarWinds products for many years now. I've done everything from professional services across the SolarWinds portfolio of products to systems engineering and administration jobs. I've even earned five SolarWinds SCP certifications. Over the years, I've learned a lot of tips and tricks, as well as developed an extensive archive of PowerShell scripts, pollers, SWQL and SQL queries, etc. As I have time, I'll be cleaning up my code, posting the details here, and building out a related GitHub repository. Bookmark the site, subscribe to the RSS feed, etc... there's a lot of good things coming down the pipe!

Feel free to follow me on GitHubThwack and/or LinkedIn

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...