Adds a newly created subscription to a monitoring connector. Namespace: Microsoft.EnterpriseManagement.ConnectorFramework
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in microsoft.enterprisemanagement.operationsmanager.dll)

Usage

Visual Basic
Dim instance As ConnectorFrameworkAdministration
Dim connectorSubscription As MonitoringConnectorSubscription

instance.InsertConnectorSubscription(connectorSubscription)

Syntax

Visual Basic
Public Sub InsertConnectorSubscription ( _
		connectorSubscription As MonitoringConnectorSubscription _
)
C#
public void InsertConnectorSubscription (
		MonitoringConnectorSubscription connectorSubscription
)
C++
public:
void InsertConnectorSubscription (
		MonitoringConnectorSubscription^ connectorSubscription
)
J#
public void InsertConnectorSubscription (
		MonitoringConnectorSubscription connectorSubscription
)
JScript
public function InsertConnectorSubscription (
		connectorSubscription : MonitoringConnectorSubscription
)

Parameters

connectorSubscription

The MonitoringConnectorSubscription object to insert in the Management Group.

Example

The following example assumes there is at least one connector created in the Operations Manager. The example gets the first connector and adds a subscription to that connector.

  Copy Code
using System;
using System.Collections.ObjectModel;
using System.Text;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Administration;
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 reference to the connector framework administration object.
			ConnectorFrameworkAdministration cfAdmin = mgmtGroup.GetConnectorFrameworkAdministration();

			// Get the first connector. The subscription will be to this object.
			ReadOnlyCollection<MonitoringConnector> connectors = cfAdmin.GetMonitoringConnectors();
			MonitoringConnector connector = connectors[0];
			// Create a subscription
			AlertNotChangedSubscriptionConfiguration config = new AlertNotChangedSubscriptionConfiguration(AlertSubscriptionConfigurationType.Any);
			config.Criteria = "<SimpleExpression><ValueExpression><Property>ResolutionState</Property></ValueExpression><Operator>Equal</Operator><ValueExpression><Value>255</Value></ValueExpression></SimpleExpression>";
			MonitoringConnectorSubscription subscription = new MonitoringConnectorSubscription("AlertSubscription", connector.Id, config);
			subscription.DisplayName = "Alerts Subscription";
			subscription.Description = "Alerts Subscription Description";
			cfAdmin.InsertConnectorSubscription(subscription);
	}
}
}

Remarks

Product connectors subscribe to alerts and forward them to other products.


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