Udostępnij za pośrednictwem


Using PowerShell to Map OpsMgr Active Alert to the Generating Rule / Monitor and Management Pack Name

Using PowerShell to Map OpsMgr Active Alert to the Generating Rule / Monitor and Management Pack Name

 

Overview

This is achievable using OpsMgr PowerShell cmd-lets through 2 manual steps.

 

Step (1)

Get all Active Alerts:

Get-Alert -criteria "ResolutionState = 0" | Select-Object Name,ProblemID,IsMonitorAlert | Export-Csv C:\My Folder\activealerts.csv

Open the exported CSV file for Alerts’ details and information

 

Step (2)

If the Alert generated by Rule:

Get-Rule | where-object {$_.ID -eq "Replace with ProblemID From The Exported CSV File"} | Select @{name="MP";expression={foreach-Object {$_.GetManagementPack().DisplayName}}},DisplayName | sort mp,displayName

If the Alert generated by Monitor:

Get-Monitor | where-object {$_.ID -eq "Replace with ProblemID From The Exported CSV File"} | Select @{name="MP";expression={foreach-Object {$_.GetManagementPack().DisplayName}}},DisplayName | sort mp,displayName

--Finished