We are using the following script to suppress alerts during our patching windows. The script is executing with no errors and the scheduled suppression is successful.
Our issue is that the scheduled suppression time is being removed a few hours later and not being saved. Therefore if we mute alerts for the following day, the scheduled suppression time is being removed and the alerts are still triggering during the previously scheduled time.
I've modified the script to only select the top 4 nodes:
Import-Module SwisPowerShell
$SwindSrv = "server"
$Username = "username"
$Password = Read-Host "Enter Password" -AsSecureString
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $Username,$Password
$swis = connect-swis -Host [IP] -Credential $Cred
$SwqlQueryForDevices = "SELECT TOP 4 [Caption], [IP_Address], [NodeID] FROM Orion.Nodes"
$Nodes = Get-SwisData -SwisConnection $Swis -Query $SwqlQueryForDevices
ForEach ($Node in $Nodes) {
$NodeID = $Node.NodeID
$entityUris += @("swis://$SwindSrv/Orion/Orion.Nodes/NodeID=$NodeId")
Write-Host $entityUris
}
$now = ([DateTime] "04/24/2019 22:00").ToUniversalTime()
$later = $now.AddMinutes(1)
Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($entityUris, $Now, $Later)
The alert suppression information is being populated in the AlertSuppression table and can be viewed in the Node Details after executing the script, but within a short time after (approx. 2 hours) it is being removed automatically.
Has anyone experienced this issue or something similar?