Get Alert of dependent Groups

H S 216 Reputation points
2020-10-06T14:01:43.423+00:00

Hello!

I have a Serviceobject with some dependent Groups.

The Monitors of the Instances wich are members of the groups are creating Alerts.

Between the Service-Object and Group-Object their are relationships and Dependence Monitors.

I want to create a Powershell-Skript that is reading the unhelathy Monitor(s) and write-out the alert.

for example. The Monitor of MyInstance1 is Error and an alert is created. Because of dependency the Service-Object "MyService" is also unhealthy. Now I want to start a script that find out the unhealty monitor with the alert-message.

How can I do this?

My dependency-Monitors don't create an alert.

30531-image.png

rg
Hansi

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,482 questions
0 comments No comments
{count} votes

Accepted answer
  1. CyrAz 5,181 Reputation points
    2020-10-07T18:49:20.877+00:00

    There probably is a way to do it, but I would rather try a slightly different approach : what you're interested in are the actual alerts and the health of the objects they're coming from, right?
    Since the groups are not creating alerts anyway, let's just fetch the actual alerts and display them with their originating object name and health state :

    Get-SCOMClass -displayname "Certificate Services" | Get-SCOMClassInstance | %{$_.GetRelatedMonitoringObjects()} | %{$_.GetMonitoringRelationshipObjects()} | %{$_.TargetMonitoringObject} | Get-SCOMAlert | where {$_.resolutionstate -ne 255} | select MonitoringObjectDisplayName,MonitoringObjectHealthState,Name
    
    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. CyrAz 5,181 Reputation points
    2020-10-06T15:42:00.657+00:00
    0 comments No comments

  2. H S 216 Reputation points
    2020-10-07T06:28:45.507+00:00

    Hello
    Many thanks for Info.

    I have tested it. But one thing I want to filter:

    Get-SCOMClass -displayname "MyService" | Get-SCOMClassInstance | %{$_.GetRelatedMonitoringObjects()} | %{$_.GetMonitoringRelationshipObjects()} | %{$_.TargetMonitoringObject}  
      
    HealthState     InMaintenanceMode  DisplayName                                                                                             
    -----------     -----------------  -----------    
    Error               False          MyInstance1  
    Error               False          MyInstance2  
    Uninitialized       False          not available        
    Error               False          MyGroup  
    

    The Object with DisplayName "MyGroup" I don't want in selection.
    I have append next pipe "| Where-object {$_.Name -ne $null}". I don't know if this is correct.

    If you look at the Object-Information you can see, that at the group-object no name and no path is listed.
    30480-image1.png

    Or is their a other possibility with PS-Command?

    rg

    0 comments No comments

  3. SChalakov 10,386 Reputation points MVP
    2020-10-07T07:54:29.287+00:00

    Hey,

    I would filter, based on the DisplayName, not on the property value, being empty…

    | Where-object {$_.DisplayName -ne "MyGrouDisplayName"}
    

    Otherwise you can potentially filter out other objects, which have no value in the 'Name' property.

    Regards,
    Stoyan

    0 comments No comments

  4. CyrAz 5,181 Reputation points
    2020-10-07T07:57:08.013+00:00

    If the DisplayName is correct, you can simply use it to do the exclusion :
    Get-SCOMClass -displayname "MyService" | Get-SCOMClassInstance | %{$.GetRelatedMonitoringObjects()} | ? {$.DisplayName -ne 'MyGroup Display Name'} | %{$.GetMonitoringRelationshipObjects()} | %{$.TargetMonitoringObject}

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.