Does anyone know how to access the target of an alert using C# and the SCOM
SDK?
In the SCOM GUI console this is obtained by selecting an alert under
Monitoring and then clicking on either the “Alert Rule” or the “Alert
Monitor” under the “Alert Details” pane. From the properties window that pops
up, I am looking for the “Rule target” or the “Monitor target” field.
I tried the following code which seemed like the obvious solution, but I
find that the name property on the target object is null. There is a guid in
the id property of the target object, but I don’t know how to translate it or
even if it is the data I am looking for.
if (alert.IsMonitorAlert)
{
ManagementPackMonitor mon = mg.GetMonitor(alert.MonitoringRuleId);
target_name = mon.Target.Name;
}
else
{
MonitoringRule rule = mg.GetMonitoringRule(alert.MonitoringRuleId);
target_name = rule.Target.Name;
}
Thanks
--
Jakub Oleksy
Developer
Blog: http://blogs.msdn.com/jakuboleksy/
Log a bug or Feature Request directly to the SCOM Product Team by going to
http://connect.microsoft.com/site/sitehome.aspx?SiteID=209. This posting is
provided "AS IS" with
no warranties, and confers no rights.
"Rex" <R...@discussions.microsoft.com> wrote in message
news:5F477EF5-8F93-4DFD...@microsoft.com...