Open Alerts but Health Explorer shows Healthy

On occasions you can run into a situation where SCOM shows open alerts in the console (with a warning or error condition), but  when you open Health Explorer it shows that the monitored object is actually Healthy!??

Here’s a quick powershell command to show you them (if you have any):-

Get-SCOMAlert | ? {$_.IsMonitorAlert -eq $True -and $_.MonitoringObjectInMaintenanceMode -eq $False -and $_.ResolutionState -ne 255 -and $_.MonitoringObjectHealthState -eq “Success”}

Copy the code below save it as a .ps1 script and run it in a OpsMgr Powershell session to remedy this situation:-

#get open alerts
$Alerts = Get-SCOMAlert -Criteria “ResolutionState != 255 AND IsMonitorAlert = ‘True’ AND MonitoringObjectInMaintenanceMode = ‘False'”

$MonitorList = New-Object “System.Collections.Generic.List[Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitor]”

#loop through the alerts
ForEach($Alert in $Alerts) {

$Monitor = Get-SCOMMonitor -id $Alert.MonitoringRuleId

if($Monitor) {
$MonitorList.Add($Monitor) | Out-Null
$MonitoredInstance = Get-SCOMClassInstance -Id $Alert.MonitoringObjectId
$Result = $MonitoredInstance.GetMonitoringStates($MonitorList)
if ($Result.HealthState -eq “Success”) {

#Close the alert
$Alert | Set-SCOMAlert -ResolutionState 255 -Comment “Closed by Automation Script” | out-null
Write-Host “Closing alert ‘$($Alert)’ for object ‘$($MonitoredInstance.DisplayName)'”

}
$MonitorList.Remove($Monitor) | Out-Null

}

}

Advertisements
This entry was posted in Misc Stuff, Powershell for SCOM and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s