Timing for an Alert notification
User doesn't want to get notifications at 3am. But at 6am they want to know, whilst singing in the shower, if any alert occurred whilst they slept.
So is there a way to gather whatever alerts occurred between 1am and 5 am on System A or B and re-send those alerts via SMS at 6am?
Thx,
John Bradshaw
November 10th, 2010 9:07pm
Hi John,
You can write a rule that will enumerate alerts, select alerts you need and update them. 'Update' method have a side-effect: it triggers a notifications.
Here is the sample. You should rewrite it as you need and
test.
#Get alerts
# Load OpsMgr snap-inn
add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";
$server = "localhost"
# Connect to OpsMgr - change management server to your RMS
new-managementGroupConnection -ConnectionString:$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$;
set-location "OperationsManagerMonitoring::";
# Update alert custom field
$alerts = get-alert -criteria 'ResolutionState = ''0''' | where-object {($_.IsMonitorAlert -eq $false)}
foreach ($alert in $alerts)
{if ($alert.CustomField10 -eq "")
{$alert.CustomField10 = "IsRuleAlert"
$alert.ResolutionState = "200"
$alert.Update("")}}
HTH
http://OpsMgr.ru/
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2010 1:58am
Thx Alexy...
Would u mind explaining how the following lines relate to the part about the timing? I don't understand how to use the
custom field part.
Ta,
JB
foreach ($alert in $alerts)
{if ($alert.CustomField10 -eq "")
{$alert.CustomField10 = "IsRuleAlert"
$alert.ResolutionState = "200"
$alert.Update("")}}
November 18th, 2010 1:13am