ConnectorMonitoringAlert Class

System Center

Updated: April 16, 2012

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Contains information about an alert returned from a monitoring connector.

Namespace: Microsoft.EnterpriseManagement.ConnectorFramework
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in Microsoft.EnterpriseManagement.OperationsManager.dll)

'Usage
Dim instance As ConnectorMonitoringAlert

[SerializableAttribute] 
public ref class ConnectorMonitoringAlert : public MonitoringAlert
/** @attribute SerializableAttribute() */ 
public class ConnectorMonitoringAlert extends MonitoringAlert
SerializableAttribute 
public class ConnectorMonitoringAlert extends MonitoringAlert

The following example retrieves all of the alerts subscribed to a specific connector and displays a few of the ConnectorMonitoringAlert properties, including the ManagementGroupId and the ManagementGroupName.

This example assumes that a monitoring connector exists and that alerts are marked for this connector.

using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Monitoring;
using Microsoft.EnterpriseManagement.ConnectorFramework;
using Microsoft.EnterpriseManagement.Common;
using Microsoft.EnterpriseManagement.Configuration;

namespace ConnectorSample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Connect to a management group.
            ManagementGroup mgmtGroup = new ManagementGroup("localhost");
      
            // Get a collection of all connectors
            IList<MonitoringConnector> connectors = mgmtGroup.ConnectorFramework.GetConnectors();
            Console.WriteLine("There are " + connectors.Count + " connectors");

            // Get the alerts of the first connector
            MonitoringConnector connector = connectors[0];
            ReadOnlyCollection<ConnectorMonitoringAlert> alerts = connector.GetMonitoringAlerts();
            if (alerts.Count > 0)
            {
                Console.WriteLine("There are " + alerts.Count + " alerts subscribed to by " + connector.Name);
                // Get information for the first alert
                ConnectorMonitoringAlert alert = alerts[0];
                Console.WriteLine("\nAlert Name: " + alert.Name);
                Console.WriteLine("  Management group:  " + alert.ManagementGroupName);
                Console.WriteLine("  ManagementGroupId: " + alert.ManagementGroupId);
                Console.WriteLine("  Raised:            " + alert.TimeRaised);
                Console.WriteLine("  Has been repeated: " + alert.RepeatCount + " times.");
                Console.WriteLine("  Resolution state:  " + (SystemMonitoringAlertResolutionState)alert.ResolutionState);
                Console.WriteLine("  Severity:          " + alert.Severity.ToString());
            }
        }
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows Server 2003, and

Target Platforms

 

Community Additions

ADD
Show: