alerts from the specific view

Hello!

Can you help me on SCOM?

$mg = Get-SCOMManagementGroup –ComputerName “scom”
$ActiveAlertsView = $mg.GetMonitoringView(“ca3d3bd8-0438-f8d6-12c6-e5936952483c”)

How to get alerts from $ActiveAlertsView ?

Yes, not all active

Hey

Interesting question. The native cmdlet get-scomalert has no parameter to specify the view. Maybe you can retrieve them with a SQL query though (haven’t tried yet). Is that an option?

Thanks

I think you need to look at the specifik alert view and see how it is scoped. And then retrieve the alerts from the specific class/group and what else conditions that are applied.

Import-Module OperationsManager

$ManagementGroup = “HQSCOM-LB”

New-SCOMManagementGroupConnection -ComputerName $ManagementGroup

$JuniorGroup = @()
$JuniorActiveAlerts = @()
$JuniorActiveAlertProperty = @()

$JuniorGroup = Get-SCOMGroup | Where {$_.DisplayName -like “2ndJunior*”}

#First method
$ClassInstances = @()
$ClassInstances = Get-SCOMGroup -Id $JuniorGroup.Id | Get-SCOMClassInstance

ForEach ($ClassInstance in $ClassInstances)
{
$JuniorActiveAlerts += (Get-SCOMAlert -Instance $ClassInstance.Id -Criteria “ResolutionState = 0 or ResolutionState = 3 and Severity > 0 and Priority > 0”)
}

PS C:\Scripts\scom_alerts> .\JuniorActiveAlerts2.ps1
Get-SCOMAlert : Cannot bind parameter ‘Instance’. Cannot convert the “Microsoft.Linux.Universal.LogicalDisk:Kubesdcmast
er1;/var/lib/docker/overlay2/cbe8882c2bf0930544f6bebd786d9a9ae54976ad4ec54aff052494a7fad6fb31/merged” value of type “Sy
stem.String” to type “Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject”.
At C:\Scripts\scom_alerts\JuniorActiveAlerts2.ps1:16 char:25

  • Get-SCOMAlert -Instance $ClassInstances[0].FullName -Criteria "Resolu …
  • CategoryInfo : InvalidArgument: (:slight_smile: [Get-SCOMAlert], ParameterBindingException
  • FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SystemCenter.OperationsManagerV10.Commands.GetSCAlertCommand

Get-SCOMAlert -Instance

How to see what the -Instance parameter means?

Just to be clear, you want to get the active alerts for a specific view. Not all active alerts?