Showing results for 
Search instead for 
Did you mean: 
Create Post

Unmanaging and suppressing alerts for applications - Scheduled recurring maintenance windows

Here's my take on a recurring, scheduled maintenance window for applications. We've got a hot/cold environment for one of our big in-house applications that rotates every two weeks.


#Add-Pssnapin swissnapin
Import-Module SwisPowerShell
$start = (Get-Date).ToUniversalTime()
$end = $start.AddDays(14)
$swis = Connect-Swis -Hostname ORIONSERVER -Username username -Password password

$applist = Get-SwisData -SwisConnection $swis -Query @"
FROM Orion.APM.Application

Foreach( $a in $applist ) {
    $appid = @( $a | ForEach-Object { [string]( $_  ) } )
    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.APM.Application -Verb Unmanage -Arguments @( "AA:$appid", $start, $end, "false" )

Suppress alerts:

#Add-Pssnapin swissnapin
Import-Module SwisPowerShell
$start = (Get-Date).ToUniversalTime()
$end = $start.AddDays(14) #two week release cycle
$swis = Connect-Swis -Hostname ORIONSERVER -Username username -Password password

$apps = Get-SwisData -SwisConnection $swis -Query @"
FROM Orion.APM.Application

Foreach( $a in $apps ) {
    $uri = @( $apps | ForEach-Object { [string]( $_  ) } )
    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.AlertSuppression -Verb SuppressAlerts -Arguments @( $uri, $start, $end )   

Just set these Powershell scripts to run on a Scheduled Task and you're all set!

Special thanks to zackmKMSigma​ and aLTeReGo​ for lots of patience while I learn this API thing.


You may want to start replacing your Add-PsSnapin SwisSnapIn with Import-Module SwisPowerShell.  Either will work fine at the moment, but PowerShell is moving away from snap-ins to modules.

I'd like to apply this to a group of Nodes to be unmanaged from 7 a.m. to 10 a.m. every day of the week.  I'm not "scripty" enough to figure out how to make that happen based on your example.  Might you care to show an example of the script that's modified to do this?

Swift packets!

Rick Schroeder

Do you want to unmanage them or mute them?  And for clarification, you want this to occur every single day for forever?

I'd like NPM to NOT show these nodes as down between 7 a.m. and 10 a.m. every day forever.

I'd like NPM to NOT send us e-mailed alerts about these nodes' status (up/down/rebooted/etc.) between 7 a.m. and 10 a.m. every day forever.

I don't mind if NPM sends traps about these nodes to Splunk, but the traps are also unnecessary (they just don't show up in my inbox, so I don't care if Splunk sees them or not).

And how are you getting this list of nodes?  Are they members of a group?  Do they have similar names?

I'm selecting them manually from the list of nodes sorted by Machine Type.  For now there are only two nodes that need no monitoring / alerting between 7 a.m. and 10 a.m., so I've no need for a dynamic selector.

# Import the module

# You may need to do an "Install-Module -Name SwisPowerShell" before running this.
Import-Module -Name SwisPowerShell

# Build a connection to the SolarWinds Information Service
$SwisConnection = Connect-Swis -Hostname -UserName admin -Password "C0mpl3xP@ssw0rd"

# Get a list of thing by querying SWIS
# Build Query
### This is where you will put the names of your nodes
$Swql = "SELECT Uri, Caption, NodeID FROM Orion.Nodes WHERE Caption IN ( 'NOCKMSAWS01v', 'NOCKMSAPE01v' )"
# Execute Query
$QueryResults = Get-SwisData -SwisConnection $SwisConnection -Query $Swql

# Validate that we got something back

# Setup Start Date/Time and End Date/Time
# Get today's date and just give me the short date as a string (MM/DD/YYYY) then tack 7 AM on the end of that,
# then convert the whole thing back to a date/time type
# Since we want 7 AM to 10 AM, let's just add three hours to get the end time.
$StartTime = [datetime]( ( Get-Date ).ToShortDateString() + " 07:00:00" )
$EndTime   = $StartTime.AddHours(3)

# Flag each node as Unmanaged
ForEach ( $Node in $QueryResults )
    Write-Host "Unmanaging $( $Node.Caption ) from $StartTime to $EndTime"
    Invoke-SwisVerb -SwisConnection $SwisConnection -EntityName Orion.Nodes -Verb Unmanage -Arguments @( "N:$( $Node.NodeID )", $StartTime, $EndTime, "false" ) | Out-Null

Note that this would have to be executed every day (after midnight but before 7 AM) to unmanage the nodes.

Holy Moley!

MAN, them're sum unexpected / non-intuitive commands.  Maybe I should wait for the Apple version of Unmanage. 

Thank you for the powerful writing.  I'm not fit to breath the air in the same room as you.

Just slap that into a scheduled task and you're good to go

I am trying this through python but haven't succeeded yet. any help will be appreciated!!

Unable to unmanage application using orion API

I can *read* python, but can't really write it.  You may get some help via GitHub - solarwinds/orionsdk-python: Python client for interacting with the SolarWinds Orion API

Version history
Revision #:
1 of 1
Last update:
‎10-17-2018 12:32 PM
Updated by: