Storage Center Ack Alert Rule

Dell.Storage.Dell.Storage.StorageCenterAlertAck (Rule)

Description for the new rule

Element properties:

TargetMicrosoft.SystemCenter.RootManagementServer
CategoryNone
EnabledTrue
Alert GenerateFalse
RemotableTrue

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.Scheduler Default
WA WriteAction Microsoft.Windows.PowerShellWriteAction Default

Source Code:

<Rule ID="Dell.Storage.Dell.Storage.StorageCenterAlertAck" Target="SC!Microsoft.SystemCenter.RootManagementServer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>None</Category>
<DataSources>
<DataSource ID="DS" TypeID="System!System.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">150</Interval>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WA" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>AckAlert.ps1</ScriptName>
<ScriptBody><Script>
Import-Module -Name OperationsManager

$listOfAlerts = Get-SCOMClass -DisplayName 'Storage Center' | Get-SCOMClassInstance | Get-SCOMAlert -ResolutionState 249
if ($listOfAlerts.Count -ne 0)
{
foreach ( $scomAlert in $listOfAlerts)
{
# extract the InstanceId of the alert
[xml]$alertXml = $scomAlert.Context
$alertXml.DataItem.Property | % {if ($_.Name -eq "InstanceId") {$id = $_.InnerText} }

# Get the Alert object from EM
$emalertobj = Get-WmiObject -ComputerName $scomAlert.PrincipalName -Namespace "root\Dell\Storage" -Class "Dell_StorageCenterAlert" -Filter "InstanceId = '$id'"

# if it is not acknowledged, call AckAlert
if (($emalertobj -ne $null) -and ($emalertobj.Acknowledged -eq $False))
{
# Alert is not acknowledged in EM; do the same

Invoke-WmiMethod -ComputerName $scomAlert.PrincipalName -Namespace "root\Dell\Storage" -Class "Dell_StorageCenterAlert" -Name "AckAlert" -ArgumentList $id,$null
}
}#end of for each
}</Script></ScriptBody>
<Parameters/>
<TimeoutSeconds>300</TimeoutSeconds>
</WriteAction>
</WriteActions>
</Rule>