Get Alerts by Group Name SDK RRS feed

  • Question

  • Hi Guys

    Can someone help me to modify this code. I can get all critical result. Now I want to filter them by group like you do when you create a new view. Parameter should be group name. This is how I do it right now:

    MonitoringAlertCriteria alertCriteria =
      new MonitoringAlertCriteria("ResolutionState != 255 AND Severity == 2");
    IList<MonitoringAlert> alerts = mg.OperationalData.GetMonitoringAlerts(alertCriteria, default(DateTime));

    I guess it's simple but I can't figure it out.

    Any help is appreciated.



    Friday, August 16, 2013 12:48 PM

All replies

  • Hi,

    Just for a reference which might give you some hints:

    Using the SDK to manipulate alerts


    Alex Zhao
    TechNet Community Support

    Tuesday, August 20, 2013 3:57 PM
  • Hi

    Unfortunately that doesn't help me. Since the group is kind of a filter and an alert can be in more than one group I guess it's handled as an Entity Object itself. So I have to get the group object first to get the alerts. But this is just my assumption.

    Can somebody please help?

    Friday, August 23, 2013 9:40 AM
  • Hi,

    this might be quite late for a reply but anyway:
    You can get Alerts related to a MonitoringObject (a Group) and set the TraversalDepth to Recursive. Therefore getting all Alerts related to this group and its members.

    $Group = Get-SCOMGroup -DisplayName "Whatever"

    Of course, you can add the Criteria as a parameter as well, Intellisense will show you that ;)

    Friday, November 15, 2013 1:46 PM