Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

Mute Alerts in SolarWinds via Powershell

$
0
0

Hello All,

 

I have the script below which works great for scheduling nodes for unmanage.  Is there any way to configure this script not to unmanage nodes, but to mute the alerts?

 

# 2017-03-29 Node Scheduled Unmanage script for SolarWinds SDK Powershell

#Instructions:Configure the Start and End times.  Edit the nodelist.txt file to include all of the servers that need

#the alerts muted for the scheduled change times.

#Region PSSnapin presence check/add

#Silently Call SolarWinds SDK

 

if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue)) 

{     

    Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue 

}

 

#EndRegion

 

 

 

 

$OrionServer = 'ServerName'

GET-CREDENTIAL –Credential abc\ServiceAccount | EXPORT-CLIXML C:\Users\kbryant\Desktop\Powershell\SecureCredentials.xml

$MyCredentials=IMPORT-CLIXML C:\Users\kbryant\Desktop\Powershell\SecureCredentials.xml

 

 

$swis = Connect-Swis -Hostname $OrionServer -Credential $MyCredentials

 

 

write-host "Sample - Date:'2019-05-22 05:45:00 PM'" -ForegroundColor Red -BackgroundColor Black

[datetime]$start = Read-Host "enter date and time to mute alerts" -ForegroundColor Red -BackgroundColor Black

 

 

 

 

write-host "Sample - Date:'2019-05-22 06:30:00 PM'" -ForegroundColor Green -BackgroundColor Black

[datetime]$end = Read-Host "enter date and time to end alert muting" -ForegroundColor Green -BackgroundColor Black

 

 

Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE Caption IN @captions" @{captions=(Get-Content c:\temp\nodelist.txt)} | Set-SwisObject $swis -Properties @{UnmanageFrom=$start.ToUniversalTime();UnmanageUntil=$end.ToUniversalTime()}


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>