Gets alerts marked for the monitoring connector. Namespace: Microsoft.EnterpriseManagement.ConnectorFramework
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in microsoft.enterprisemanagement.operationsmanager.dll)

Usage

Visual Basic
Dim instance As MonitoringConnector
Dim returnValue As ReadOnlyCollection(Of ConnectorMonitoringAlert)

returnValue = instance.GetMonitoringAlerts

Syntax

Visual Basic
Public Function GetMonitoringAlerts As ReadOnlyCollection(Of ConnectorMonitoringAlert)
C#
public ReadOnlyCollection<ConnectorMonitoringAlert> GetMonitoringAlerts ()
C++
public:
ReadOnlyCollection<ConnectorMonitoringAlert^>^ GetMonitoringAlerts ()
J#
public ReadOnlyCollection<ConnectorMonitoringAlert> GetMonitoringAlerts ()
JScript
public function GetMonitoringAlerts () : ReadOnlyCollection<ConnectorMonitoringAlert>

Return Value

A collection of ConnectorMonitoringAlert objects.

Example

The following example uses the GetMonitoringAlerts method to get the first alert that is marked for this connector and display that alert.

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

C#  Copy Code
using System;
using System.Collections.ObjectModel;
using System.Text;
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");
			// Gets a reference to the connector framework administration object.
			ConnectorFrameworkAdministration cfAdmin = mgmtGroup.GetConnectorFrameworkAdministration();

			// Get a collection of all connectors.
			ReadOnlyCollection<MonitoringConnector> connectors = cfAdmin.GetMonitoringConnectors();

			// 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());
		}
		 }
}
}

Remarks

This method only gets alerts that are marked for the monitoring connector from the bookmark time to the current time less 30 seconds.


Thread Safety

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

Platforms

Development Platforms

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

Target Platforms

Windows Server 2008,Windows Server 2003,Windows Vista,Windows XP

See Also