/// <summary> /// Create a SCOM Connector /// </summary> public static void CreateConnector() { Guid connectorGuid = new Guid("B7746650-70AA-4B4B-8E33-F5E4F0AA679E"); IConnectorFrameworkManagement cfMgmt = m_managementGroup.ConnectorFramework; try { m_monitoringConnector = cfMgmt.GetConnector(connectorGuid); } catch (Microsoft.EnterpriseManagement.Common.ObjectNotFoundException) { //The connector does not exist, so create it. ConnectorInfo connectorInfo = new ConnectorInfo { Description = "This Connector is to Discover EMC Isilon Information", DisplayName = "AP EMC Isilon Connector", Name = "AP.Isilon.Connector" }; m_monitoringConnector = cfMgmt.Setup(connectorInfo, connectorGuid); } if (!m_monitoringConnector.Initialized) { m_monitoringConnector.Initialize(); } }
public void RemoveConnector(ManagementGroup managementGroup, MonitoringConnector monitoringConnector) { var subscriptions = managementGroup.ConnectorFramework.GetConnectorSubscriptions(); foreach (var subscription in subscriptions) { managementGroup.ConnectorFramework.DeleteConnectorSubscription(subscription); } try { monitoringConnector.Uninitialize(); } catch (Exception) { // ignored } try { managementGroup.ConnectorFramework.Cleanup(monitoringConnector); } catch (Exception) { // ignored } }
/// <summary> /// Create a SCOM Connector /// </summary> public static void CreateConnector() { Guid connectorGuid = new Guid("4B9A593A-1C22-4CCC-B5CA-B7483A14F992"); IConnectorFrameworkManagement cfMgmt = m_managementGroup.ConnectorFramework; try { m_monitoringConnector = cfMgmt.GetConnector(connectorGuid); } catch (Microsoft.EnterpriseManagement.Common.ObjectNotFoundException) { //The connector does not exist, so create it. ConnectorInfo connectorInfo = new ConnectorInfo { Description = "This Connector is to Collect F5 LTM Information", DisplayName = "AP F5 LTM Connector", Name = "AP.F5.LTM.Connector" }; m_monitoringConnector = cfMgmt.Setup(connectorInfo, connectorGuid); } if (!m_monitoringConnector.Initialized) { m_monitoringConnector.Initialize(); } }
/// <summary> /// Create a SCOM Connector /// </summary> public static void CreateConnector() { Guid connectorGuid = new Guid("95146120-C05D-4C67-BE50-0750F67184B2"); IConnectorFrameworkManagement cfMgmt = m_managementGroup.ConnectorFramework; try { m_monitoringConnector = cfMgmt.GetConnector(connectorGuid); } catch (Microsoft.EnterpriseManagement.Common.ObjectNotFoundException) { //The connector does not exist, so create it. ConnectorInfo connectorInfo = new ConnectorInfo { Description = "This Connector is to Collect F5 BIG-IP Information", DisplayName = "AP F5 Base Connector", Name = "AP.F5.Base.Connector" }; m_monitoringConnector = cfMgmt.Setup(connectorInfo, connectorGuid); } if (!m_monitoringConnector.Initialized) { m_monitoringConnector.Initialize(); } }
/// <summary> /// Create a SCOM Connector /// </summary> public static void CreateConnector() { Guid connectorGuid = new Guid("2C7E79C4-7A0D-4B38-AB69-BB02BD1B3AB5"); IConnectorFrameworkManagement cfMgmt = m_managementGroup.ConnectorFramework; try { m_monitoringConnector = cfMgmt.GetConnector(connectorGuid); } catch (Microsoft.EnterpriseManagement.Common.ObjectNotFoundException) { //The connector does not exist, so create it. ConnectorInfo connectorInfo = new ConnectorInfo { Description = "This Connector is to Collect VMware", DisplayName = "AP VMware Connector", Name = "AP.VMware.Connector" }; m_monitoringConnector = cfMgmt.Setup(connectorInfo, connectorGuid); } if (!m_monitoringConnector.Initialized) { m_monitoringConnector.Initialize(); } }
/// <summary> /// This constructor is for unhosted objects managed by All Management Server resource pool. /// </summary> /// <param name="managementGroup"></param> /// <param name="seedClass"></param> /// <param name="insertConnector"></param> public ScomClassInstanceEditor(ManagementGroup managementGroup, ManagementPackClass seedClass, MonitoringConnector monitoringConnector = null) { _managementGroup = managementGroup ?? throw new ArgumentNullException(nameof(managementGroup)); _seedClass = seedClass ?? throw new ArgumentNullException(nameof(seedClass)); _monitoringConnector = monitoringConnector; _relToClearHs = _managementGroup.EntityTypes.GetRelationshipClass(SystemMonitoringRelationship.HealthServiceShouldManageEntity); _relToClearMap = _managementGroup.EntityTypes.GetRelationshipClass(_managementActionPointShouldManageEntityRelationshipId); }
private void DefaultConstructor(ManagementGroup managementGroup, ManagementPackClass seedClass, MonitoringConnector insertConnector) { mySeedClass = seedClass; myConnector = insertConnector; myMG = managementGroup; relToClearHS = managementGroup.EntityTypes.GetRelationshipClass(SystemCenterId.HealthServiceShouldManageEntityRelationshipId); relToClearMAP = managementGroup.EntityTypes.GetRelationshipClass(SystemCenterId.ManagementActionPointShouldManageEntityRelationshipId); // load initial data Refresh(); }
private static void CreateNewConnector() { ConnectorInfo connectorInfo = new ConnectorInfo { Name = "HUAWEI ESight Connector", DisplayName = "HUAWEI ESight Connector", Description = "Connector for HUAWEI ESight Management Packs" }; OM12Connection.HuaweiESightConnector = OM12Connection.HuaweiESightMG.ConnectorFramework.Setup(connectorInfo, OM12Connection.HuaweiESightGuid); }
private static bool CreateConnection() { try { OM12Connection.HuaweiESightConnector = OM12Connection.HuaweiESightMG.ConnectorFramework.GetConnector(OM12Connection.HuaweiESightGuid); if (!OM12Connection.HuaweiESightConnector.Initialized) { OM12Connection.HuaweiESightConnector.Initialize(); } return(true); } catch (Exception) { return(false); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); dgvDemoObjects.AutoGenerateColumns = false; try { // Extension method GetOrCreateConnector defined in Maximus.Base.Library.Console assembly, see https://github.com/MaxxVolk/Maximus.Base.Library/tree/master/Maximus.Base.Library.Console myConnector = ManagementGroup.ConnectorFramework.GetOrCreateConnector( connectorID: myConnectorId, name: myConnectorName, displayName: myConnectorDisplayName, description: myConnectorDescription, discoveryDataIsManaged: true ); if (myConnector == null) { throw new Exception("Cannot find/create the connector."); } ConsoleJobs.RunJob(this, delegate { // inserted object will be hosted at All Management Servers Resource Pool scieDemoObjects = new SCOMClassInstanceEditor <SCOMAthonDemoClassClassAdapter>(managementGroup: ManagementGroup, seedClass: ManagementGroup.EntityTypes.GetClass(DemoClassIds.SCOMAthonDemoClassClassId), insertConnector: myConnector); }); if (scieDemoObjects == null) { throw new Exception("Cannot load management point editor."); } bsDemoObjects = new BindingSource { DataSource = scieDemoObjects }; dgvDemoObjects.DataSource = bsDemoObjects; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void CheckAlerts(object data) { eventLog1.Source = "Ops2ZenossSource"; if (!(Monitor.TryEnter(chkAlertsTimer))) { eventLog1.WriteEntry("CheckAlerts is running too long. Timer function found that prior execution is still active.", EventLogEntryType.Error, EventCheckAlertsRunningLong); return; } try { if (connector == null) { ManagementGroup mg = new ManagementGroup("localhost"); IConnectorFrameworkManagement icfm = mg.ConnectorFramework; connector = icfm.GetConnector(connectorGuid); } ReadOnlyCollection<ConnectorMonitoringAlert> Alerts; Alerts = connector.GetMonitoringAlerts(); if (Alerts.Count > 0) { eventLog1.WriteEntry("Found " + Alerts.Count + " alerts for processing", EventLogEntryType.Information); OutputAlerts(Alerts); eventLog1.WriteEntry("Acknowledging all alerts.", EventLogEntryType.Information); connector.AcknowledgeMonitoringAlerts(Alerts); } } catch (EnterpriseManagementException error) { connector = null; eventLog1.WriteEntry("MonitoringException in timer function:" + error.Message, EventLogEntryType.Error, EventCheckAlertsMonitoringException); } catch (Exception excp) { connector = null; eventLog1.WriteEntry("Exception in timer function:" + excp.Message, EventLogEntryType.Error, EventCheckAlertsMonitoringException); } finally { Monitor.Exit(chkAlertsTimer); } }
public ScomClassInstanceEditor <T> GetInstanceEditor <T>(ManagementPackClass seedClass, MonitoringConnector monitoringConnector = null) where T : ScomMonitoringInstance { return(new ScomClassInstanceEditor <T>(ManagementGroup, seedClass, monitoringConnector)); }
public ScomClassInstanceEditor(ManagementGroup managementGroup, Guid seedClassId, Guid actionPointClassId, MonitoringConnector monitoringConnector = null, ManagementPackRelationship hostingRelationship = null) : this(managementGroup, managementGroup.EntityTypes.GetClass(seedClassId), managementGroup.EntityTypes.GetClass(actionPointClassId), monitoringConnector, hostingRelationship) { }
/// <summary> /// This constructor is for unhosted objects managed by specific instance of defined Action Point class OR for hosted objects, /// which are hosted on defined Action Point class. /// </summary> /// <param name="managementGroup"></param> /// <param name="seedClass"></param> /// <param name="actionPointClassName"></param> /// <param name="monitoringConnector"></param> public ScomClassInstanceEditor(ManagementGroup managementGroup, ManagementPackClass seedClass, ManagementPackClass actionPointClass, MonitoringConnector monitoringConnector = null, ManagementPackRelationship hostingRelationship = null) : this(managementGroup, seedClass, monitoringConnector) { _actionPointClass = actionPointClass ?? throw new ArgumentNullException(nameof(actionPointClass)); if (seedClass.Hosted) { _relMapShouldManageEntity = null; _relMapManagesEntity = null; _relHosting = hostingRelationship ?? managementGroup.EntityTypes.GetRelationshipClass(SystemRelationship.Hosting); } else { if (actionPointClass.IsSubtypeOf(managementGroup.EntityTypes.GetClass(_managementActionPointClassId)) || actionPointClass.Id == _managementActionPointClassId) { _relMapShouldManageEntity = managementGroup.EntityTypes.GetRelationshipClass(_managementActionPointShouldManageEntityRelationshipId); } else if (actionPointClass.IsSubtypeOf(managementGroup.EntityTypes.GetClass(SystemMonitoringClass.HealthService)) || actionPointClass.Id == SystemMonitoringClass.HealthService.Id) { _relHsShouldManageEntity = managementGroup.EntityTypes.GetRelationshipClass(SystemMonitoringRelationship.HealthServiceShouldManageEntity); } else { throw new NotSupportedException("For unhosted scenario, action point class should be either Microsoft.SystemCenter.ManagementActionPoint or Microsoft.SystemCenter.HealthService, or inherited from these classes."); } _relMapManagesEntity = managementGroup.EntityTypes.GetRelationshipClass(_managementActionPointManagesEntityRelationshipId); } _actionPoints.AddRange(managementGroup.EntityObjects.GetObjectReader <MonitoringObject>(_actionPointClass, ObjectQueryOptions.Default)); }
public ScomClassInstanceEditor(ManagementGroup managementGroup, Guid seedClassId, MonitoringConnector monitoringConnector = null) : this(managementGroup, managementGroup.EntityTypes.GetClass(seedClassId), monitoringConnector) { }
public ScomClassInstanceEditor <T> GetInstanceEditor <T>(ManagementPackClass seedClass, ManagementPackClass actionPointClass, MonitoringConnector monitoringConnector = null, ManagementPackRelationship hostingRelationship = null) where T : ScomMonitoringInstance { return(new ScomClassInstanceEditor <T>(ManagementGroup, seedClass, actionPointClass, monitoringConnector)); }
/// <summary> /// This constructor is for unhosted objects managed by specific instance of defined Action Point class OR for hosted objects, which are hosted on defined Action Point class. /// </summary> /// <param name="managementGroup"></param> /// <param name="seedClass"></param> /// <param name="actionPointClassName"></param> /// <param name="insertConnector"></param> public SCOMClassInstanceEditor(ManagementGroup managementGroup, ManagementPackClass seedClass, ManagementPackClass actionPointClass, MonitoringConnector insertConnector, ManagementPackRelationship hostingRelationship = null) { myActionPointClass = actionPointClass; if (seedClass.Hosted) { relMAPShouldManageEntity = null; relMAPManagesEntity = null; relHosting = hostingRelationship ?? managementGroup.EntityTypes.GetRelationshipClass(SystemId.HostingRelationshipId); } else { relHosting = null; if (actionPointClass.IsSubtypeOf(managementGroup.EntityTypes.GetClass(SystemCenterId.ManagementActionPointClassId)) || actionPointClass.Id == SystemCenterId.ManagementActionPointClassId) { relMAPShouldManageEntity = managementGroup.EntityTypes.GetRelationshipClass(SystemCenterId.ManagementActionPointShouldManageEntityRelationshipId); } else if (actionPointClass.IsSubtypeOf(managementGroup.EntityTypes.GetClass(SystemCenterId.HealthServiceClassId)) || actionPointClass.Id == SystemCenterId.HealthServiceClassId) { relHSShouldManageEntiry = managementGroup.EntityTypes.GetRelationshipClass(SystemCenterId.HealthServiceShouldManageEntityRelationshipId); } else { throw new NotSupportedException("For unhosted scenario, action point class should be either Microsoft.SystemCenter.ManagementActionPoint or Microsoft.SystemCenter.HealthService, or inherited from these classes."); } relMAPManagesEntity = managementGroup.EntityTypes.GetRelationshipClass(SystemCenterId.ManagementActionPointManagesEntityRelationshipId); } myActionPoints = new List <MonitoringObject>(); myActionPoints.AddRange(managementGroup.EntityObjects.GetObjectReader <MonitoringObject>(myActionPointClass, ObjectQueryOptions.Default)); DefaultConstructor(managementGroup, seedClass, insertConnector); }
// constructors /// <summary> /// This constructor is for unhosted objects managed by All Management Server resource pool. /// </summary> /// <param name="managementGroup"></param> /// <param name="seedClass"></param> /// <param name="insertConnector"></param> public SCOMClassInstanceEditor(ManagementGroup managementGroup, ManagementPackClass seedClass, MonitoringConnector insertConnector) { DefaultConstructor(managementGroup, seedClass, insertConnector); }