/// <summary> /// Default Constructor /// </summary> /// <param name="dg"></param> /// <param name="FullName"></param> /// <param name="Description"></param> /// <param name="Port"></param> /// <param name="MonitorRule"></param> public PoolMember(SyncFailoverGroup dg, string PartitionName, string PoolFullName, string FullName, string Description, string Port, string MonitorRule) { // Get ShortName string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); // Get Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create Pool Management Pack Class ManagementPackClass mpc_PoolMember = SCOM.GetManagementPackClass("AP.F5.LTM.PoolMember"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_PoolMember); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Create Pool Management Pack Class ManagementPackClass mpc_Pool = SCOM.GetManagementPackClass("AP.F5.LTM.Pool"); ManagementPackProperty mpp_PoolKey = mpc_Pool.PropertyCollection["FullName"]; SCOM_Object[mpp_PoolKey].Value = PoolFullName; // Create PoolMember Management Pack Class & Properties ManagementPackProperty mpp_PoolMemberFullName = mpc_PoolMember.PropertyCollection["FullName"]; SCOM_Object[mpp_PoolMemberFullName].Value = FullName; ManagementPackProperty mpp_PoolMemberName = mpc_PoolMember.PropertyCollection["Name"]; SCOM_Object[mpp_PoolMemberName].Value = ShortName; ManagementPackProperty mpp_PoolMemberPartition = mpc_PoolMember.PropertyCollection["Partition"]; SCOM_Object[mpp_PoolMemberPartition].Value = Partition; ManagementPackProperty mpp_PoolMemberPort = mpc_PoolMember.PropertyCollection["Port"]; SCOM_Object[mpp_PoolMemberPort].Value = Port; ManagementPackProperty mpp_PoolMemberDescription = mpc_PoolMember.PropertyCollection["Description"]; SCOM_Object[mpp_PoolMemberDescription].Value = Description; ManagementPackProperty mpp_PoolMemberMonitorRule = mpc_PoolMember.PropertyCollection["MonitorRule"]; SCOM_Object[mpp_PoolMemberMonitorRule].Value = MonitorRule; ManagementPackProperty mpp_PoolMemberPoolName = mpc_PoolMember.PropertyCollection["PoolName"]; SCOM_Object[mpp_PoolMemberPoolName].Value = PoolFullName; }
/// <summary> /// Default Constructor /// </summary> /// <param name="SyncFailoverGroupKey"></param> /// <param name="PartitionName"></param> public Partition(string SyncFailoverGroupKey, string PartitionName) { // Create Partition Management Pack Class ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Partition); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = PartitionName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = SyncFailoverGroupKey; // Create Properties of Partition ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; }
/// <summary> /// Create SCOM Object /// </summary> public void CreateDeviceGroupScomObject() { // Create Root Entity Class & Display Name Prop ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; // Create Correct Group Management Pack Class ManagementPackClass mpc_DeviceGroup; if (Type == "Sync-Failover") { mpc_DeviceGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); } else { mpc_DeviceGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncOnlyGroup"); } // Create Sync-Failover Group Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_DeviceGroup); // Display Name of Parent (KEY Property) SCOM_Object[mpp_EntityDisplayName].Value = Name; // Set Properties of Device Group // Name (Key Property) ManagementPackProperty mpp_Name = mpc_DeviceGroup.PropertyCollection["Name"]; SCOM_Object[mpp_Name].Value = Name; // Key ManagementPackProperty mpp_Key = mpc_DeviceGroup.PropertyCollection["Key"]; SCOM_Object[mpp_Key].Value = Key; // Standalone ManagementPackProperty mpp_Standalone = mpc_DeviceGroup.PropertyCollection["Standalone"]; SCOM_Object[mpp_Standalone].Value = Standalone; // Devices ManagementPackProperty mpp_Devices = mpc_DeviceGroup.PropertyCollection["Devices"]; SCOM_Object[mpp_Devices].Value = Devices; // Monitor Address ManagementPackProperty mpp_MonitorAddress = mpc_DeviceGroup.PropertyCollection["Addresses"]; SCOM_Object[mpp_MonitorAddress].Value = Addresses; // Monitor Port ManagementPackProperty mpp_MonitorPort = mpc_DeviceGroup.PropertyCollection["Ports"]; SCOM_Object[mpp_MonitorPort].Value = Ports; // Monitor Community ManagementPackProperty mpp_MonitorCommunity = mpc_DeviceGroup.PropertyCollection["Communities"]; SCOM_Object[mpp_MonitorCommunity].Value = Communities; }
/// <summary> /// Default Constructor /// </summary> /// <param name="FullName"></param> /// <param name="Description"></param> /// <param name="MonitorRule"></param> /// <param name="TotalMembers"></param> /// <param name="ActiveMembers"></param> public Pool(SyncFailoverGroup dg, string PartitionName, string FullName, string ShortName, string Description, string MonitorRule, long TotalMembers, long ActiveMembers) { // Set Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create Pool Management Pack Class ManagementPackClass mpc_Pool = SCOM.GetManagementPackClass("AP.F5.LTM.Pool"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Pool); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Create Properties of Pool ManagementPackProperty mpp_PoolFullName = mpc_Pool.PropertyCollection["FullName"]; SCOM_Object[mpp_PoolFullName].Value = FullName; ManagementPackProperty mpp_PoolName = mpc_Pool.PropertyCollection["Name"]; SCOM_Object[mpp_PoolName].Value = ShortName; ManagementPackProperty mpp_PoolPartition = mpc_Pool.PropertyCollection["Partition"]; SCOM_Object[mpp_PoolPartition].Value = Partition; ManagementPackProperty mpp_PoolTotalMembers = mpc_Pool.PropertyCollection["TotalMembers"]; SCOM_Object[mpp_PoolTotalMembers].Value = TotalMembers; ManagementPackProperty mpp_PoolActiveMembers = mpc_Pool.PropertyCollection["ActiveMembers"]; SCOM_Object[mpp_PoolActiveMembers].Value = ActiveMembers; ManagementPackProperty mpp_PoolDescription = mpc_Pool.PropertyCollection["Description"]; SCOM_Object[mpp_PoolDescription].Value = Description; ManagementPackProperty mpp_PoolMonitorRule = mpc_Pool.PropertyCollection["MonitorRule"]; SCOM_Object[mpp_PoolMonitorRule].Value = MonitorRule; }
/// <summary> /// Default Constructor /// </summary> /// <param name="dg"></param> /// <param name="FullName"></param> /// <param name="Description"></param> /// <param name="CertFileName"></param> public ProfileServerSSL(SyncFailoverGroup dg, string PartitionName, string FullName, string Description, string CertFileNames) { // Get ShortName string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); // Get Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create Profile Management Pack Class ManagementPackClass mpc_Profile = SCOM.GetManagementPackClass("AP.F5.LTM.ProfileServerSSL"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Profile); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Now We Can Create Profile Properties ManagementPackProperty mpp_ProfileName = mpc_Profile.PropertyCollection["Name"]; SCOM_Object[mpp_ProfileName].Value = ShortName; ManagementPackProperty mpp_ProfileFullName = mpc_Profile.PropertyCollection["FullName"]; SCOM_Object[mpp_ProfileFullName].Value = FullName; ManagementPackProperty mpp_ProfilePartition = mpc_Profile.PropertyCollection["Partition"]; SCOM_Object[mpp_ProfilePartition].Value = Partition; ManagementPackProperty mpp_ProfileDeviceGroup = mpc_Profile.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_ProfileDeviceGroup].Value = dg.Name; ManagementPackProperty mpp_ProfileDescription = mpc_Profile.PropertyCollection["Description"]; SCOM_Object[mpp_ProfileDescription].Value = Description; ManagementPackProperty mpp_ProfileCertFileName = mpc_Profile.PropertyCollection["CertFileNames"]; SCOM_Object[mpp_ProfileCertFileName].Value = CertFileNames; }
public Node(string SyncFailoverGroupKey, string PartitionName, string NodeFullName, string NodeShortName, string Address, string Description, string MonitorRules) { // Set Partition string Partition = NodeFullName.Substring(1, NodeFullName.LastIndexOf("/") - 1); // Create Node Management Pack Class ManagementPackClass mpc_Node = SCOM.GetManagementPackClass("AP.F5.LTM.Node"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Node); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = NodeShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = SyncFailoverGroupKey; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Set Node Properties // Create our Virtual Server Properties ManagementPackProperty mpp_Name = mpc_Node.PropertyCollection["Name"]; SCOM_Object[mpp_Name].Value = NodeShortName; ManagementPackProperty mpp_FullName = mpc_Node.PropertyCollection["FullName"]; SCOM_Object[mpp_FullName].Value = NodeFullName; ManagementPackProperty mpp_Description = mpc_Node.PropertyCollection["Description"]; SCOM_Object[mpp_Description].Value = Description; ManagementPackProperty mpp_Address = mpc_Node.PropertyCollection["Address"]; SCOM_Object[mpp_Address].Value = Address; ManagementPackProperty mpp_Partition = mpc_Node.PropertyCollection["Partition"]; SCOM_Object[mpp_Partition].Value = Partition; ManagementPackProperty mpp_MonitorRule = mpc_Node.PropertyCollection["MonitorRules"]; SCOM_Object[mpp_MonitorRule].Value = MonitorRules; }
/// <summary> /// Public Constructor /// </summary> public SCOM_Devices() { // Get All Devices ManagementPackClass mpc_Devices = SCOM.GetManagementPackClass("AP.F5.Device"); IObjectReader <EnterpriseManagementObject> DeviceReader; //List<Guid> DevicesGuidList; DeviceReader = SCOM.m_managementGroup.EntityObjects.GetObjectReader <EnterpriseManagementObject>(mpc_Devices, ObjectQueryOptions.Default); foreach (EnterpriseManagementObject dev in DeviceReader) { Items.Add(dev); } }
/// <summary> /// Default Constructor /// </summary> /// <param name="dg">Hosting Device Group</param> /// <param name="Name">name of Traffic Group</param> public void CreateScomObject() { // Create Traffic Group Management Pack Class ManagementPackClass mpc_Trafficgroup = SCOM.GetManagementPackClass("AP.F5.LTM.TrafficGroup"); // Create Traffic Group Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Trafficgroup); // Create Root Entity Class & Display Name Prop ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = Name; // Add in Key Property of Hosting DeviceGroup ManagementPackClass mpc_DeviceGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_DeviceGroup.PropertyCollection["Key"]; // Set parent Cluster Property SCOM_Object[mpp_SyncFailoverGroupKey].Value = DeviceGroup.Key; // Key (Key Property) ManagementPackProperty mpp_TrafficGroupKey = mpc_Trafficgroup.PropertyCollection["Key"]; SCOM_Object[mpp_TrafficGroupKey].Value = Key; // Name ManagementPackProperty mpp_TrafficGroupName = mpc_Trafficgroup.PropertyCollection["Name"]; SCOM_Object[mpp_TrafficGroupName].Value = Name; // FullName ManagementPackProperty mpp_TrafficGroupFullName = mpc_Trafficgroup.PropertyCollection["FullName"]; SCOM_Object[mpp_TrafficGroupFullName].Value = FullName; // Devices ManagementPackProperty mpp_TrafficGroupDevices = mpc_Trafficgroup.PropertyCollection["Devices"]; SCOM_Object[mpp_TrafficGroupDevices].Value = Devices; // DeviceGroup ManagementPackProperty mpp_TrafficGroupDeviceGroup = mpc_Trafficgroup.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_TrafficGroupDeviceGroup].Value = DeviceGroup.Name; }
/// <summary> /// Get Basic Device Info /// </summary> private static void GetDevices() { // Get All Devices from SCOM ManagementPackClass mpc_Devices = SCOM.GetManagementPackClass("AP.F5.Device"); IObjectReader <EnterpriseManagementObject> DeviceReader; //List<Guid> DevicesGuidList; DeviceReader = SCOM.m_managementGroup.EntityObjects.GetObjectReader <EnterpriseManagementObject>(mpc_Devices, ObjectQueryOptions.Default); // Load In CSV File CsvReader csv = new CsvReader(new StreamReader(m_deviceFileName), true); while (csv.ReadNextRecord()) { f5Device newDevice = new f5Device(csv[CSV_ADDRESS], csv[CSV_COMMUNITY], Convert.ToInt32(csv[CSV_PORT]), csv[CSV_F5USER], csv[CSV_F5PASSWORD]); // Loop Through SCOM Objects foreach (EnterpriseManagementObject scom_dev in DeviceReader) { if (scom_dev.DisplayName.ToLower() == newDevice.SystemNodeName.ToLower()) { newDevice.SCOM_DeviceObject = scom_dev; break; } } // Check and Make Sure there's a corresponding SCOM Object if (newDevice.SCOM_DeviceObject != null) { // Add Device to DeviceList DeviceList.Add(newDevice); } else { log.Warn("Could not Find " + newDevice.SystemNodeName + " in SCOM, skipping this device!"); } } // Dispose of CSV File csv.Dispose(); }
static void Main(string[] args) { // Write Header Console.WriteLine("AP.VMware.Seed, ©A.Patrick 2018-2019"); Console.WriteLine("Discovers VMware Virtual Centers for SCOM."); Console.WriteLine(""); // First Thing is to get the Managment Server Name from the config file (if it exists). m_managementServer = GetManagementServer(); log.Info("Using management Server " + m_managementServer); // See if Config File Exists if (File.Exists(m_vCenterFileName)) { // Log Info log.Info("Creating Inbound Connector to " + m_managementServer + "..."); // Get Management Group SCOM.m_managementGroup = new ManagementGroup(m_managementServer); // Create Our Inbound Connector SCOM.CreateConnector(); log.Info("Inbound Connector Created to " + m_managementServer + "..."); // Did it Initialise if (SCOM.m_monitoringConnector.Initialized) { // Log Progress log.Info("Starting Discovery..."); Console.WriteLine(); // Get Data from vCenters GetData(); // Create Discopvery Data Console.WriteLine(); log.Info("Creating Discovery Data..."); CreateDiscoveryData(); try { // Write Discovered Data to SCOM Database log.Info("Writing Discovery Data to " + m_managementServer); discoData.Overwrite(SCOM.m_monitoringConnector); } catch (Exception ex) { log.Error(ex.Message); } // Uninitialize the connector SCOM.m_monitoringConnector.Uninitialize(); SCOM.m_monitoringConnector = null; } else { log.Fatal("Couldn't Initialize Inbound SCOM Connector!"); } } else { log.Fatal("Couldn't Find " + m_vCenterFileName); Environment.Exit(5); } }
/// <summary> /// Default Constructor /// </summary> /// <param name="FullName"></param> /// <param name="Address"></param> /// <param name="Port"></param> /// <param name="Description"></param> /// <param name="Type"></param> /// <param name="DefaultPool"></param> /// <param name="DeviceGroup"></param> /// <param name="ConnectionLimit"></param> /// <param name="ClientSslProfiles"></param> /// <param name="ServerSslProfiles"></param> public VirtualServer(SyncFailoverGroup dg, string PartitionName, string FullName, string Address, string Port, string Description, string Type, string DefaultPool, string ConnectionLimit, string ClientSslProfiles, string ServerSslProfiles) { // Set Default Pool DefaultPoolName = DefaultPool; // Set ShortName string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); // Set Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create VirtualServer Management Pack Class ManagementPackClass mpc_VirtualServer = SCOM.GetManagementPackClass("AP.F5.LTM.VirtualServer"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_VirtualServer); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Create our Virtual Server Properties ManagementPackProperty mpp_Name = mpc_VirtualServer.PropertyCollection["Name"]; SCOM_Object[mpp_Name].Value = ShortName; ManagementPackProperty mpp_FullName = mpc_VirtualServer.PropertyCollection["FullName"]; SCOM_Object[mpp_FullName].Value = FullName; ManagementPackProperty mpp_Description = mpc_VirtualServer.PropertyCollection["Description"]; SCOM_Object[mpp_Description].Value = Description; ManagementPackProperty mpp_Address = mpc_VirtualServer.PropertyCollection["Address"]; SCOM_Object[mpp_Address].Value = Address; ManagementPackProperty mpp_Port = mpc_VirtualServer.PropertyCollection["Port"]; SCOM_Object[mpp_Port].Value = Port; ManagementPackProperty mpp_Type = mpc_VirtualServer.PropertyCollection["Type"]; SCOM_Object[mpp_Type].Value = Type; ManagementPackProperty mpp_Partition = mpc_VirtualServer.PropertyCollection["Partition"]; SCOM_Object[mpp_Partition].Value = Partition; ManagementPackProperty mpp_DefaultPool = mpc_VirtualServer.PropertyCollection["DefaultPool"]; SCOM_Object[mpp_DefaultPool].Value = DefaultPool; ManagementPackProperty mpp_DeviceGroup = mpc_VirtualServer.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_DeviceGroup].Value = dg.Name; ManagementPackProperty mpp_ConnectionLimit = mpc_VirtualServer.PropertyCollection["ConnectionLimit"]; SCOM_Object[mpp_ConnectionLimit].Value = ConnectionLimit; ManagementPackProperty mpp_ProfileClientSSL = mpc_VirtualServer.PropertyCollection["ProfileClientSSL"]; SCOM_Object[mpp_ProfileClientSSL].Value = ClientSslProfiles; ManagementPackProperty mpp_ProfileServerSSL = mpc_VirtualServer.PropertyCollection["ProfileServerSSL"]; SCOM_Object[mpp_ProfileServerSSL].Value = ServerSslProfiles; }
/// <summary> /// Application Entry Point /// </summary> /// <param name="args"></param> static void Main(string[] args) { // Write Header Console.WriteLine("AP.EMC.Isilon.Discovery, ©A.Patrick 2017-2018"); Console.WriteLine("Discovers EMC Isilon Clusters and Nodes for SCOM."); Console.WriteLine(""); // First Thing is to get the Managment Server Name from the config file (if it exists) m_managementServer = GetManagementServer(); if (File.Exists(m_clusterFileName)) { // Write Discovered Data to SCOM Database ( For Relationships log.Info("Creating Inbound Connector to " + m_managementServer + "..."); // Get Management Group SCOM.m_managementGroup = new ManagementGroup(m_managementServer); // Create Our Inbound Connector SCOM.CreateConnector(); // Make Sure Connector is initialized if (SCOM.m_monitoringConnector.Initialized) { // Get Clusters and Nodes log.Info("Starting Cluster & Node Discovery..."); GetClustersAndNodes(); // Add in Discovery Data foreach (IsilonCluster ic in ClusterList) { discoData.Include(ic.SCOM_Object); foreach (IsilonNode node in ic.NodeList) { discoData.Include(node.SCOM_Object); foreach (IsilonNetworkInterface nif in node.NetworkInterfaceList) { discoData.Include(nif.SCOM_Object); } } } // Get Clusters and Nodes log.Info("Writing Discovery data to " + m_managementServer + "..."); discoData.Overwrite(SCOM.m_monitoringConnector); // Free Connector SCOM.m_monitoringConnector.Uninitialize(); SCOM.m_monitoringConnector = null; } else { log.Fatal("Couldn't Initialize Inbound SCOM Connector!"); if (SCOM.m_monitoringConnector != null) { SCOM.m_monitoringConnector = null; } Environment.Exit(5); } } else { log.Fatal("Could not find cluster file, " + m_clusterFileName); Environment.Exit(5); } }
// Default Constructor public Certificate(ManagementKeyCertificateCertificateInformation_v2 certInfo, SyncFailoverGroup dg, string PartitionName) { string FullName = certInfo.certificate.cert_info.id; string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Get Type string CertType = ""; switch (certInfo.certificate.cert_type) { case ManagementKeyCertificateCertificateType.CTYPE_CA_SIGNED_YES: CertType = "Certificate Signed by CA"; break; case ManagementKeyCertificateCertificateType.CTYPE_CA_SIGNED_NO: CertType = "Certificate NOT Signed by CA"; break; default: CertType = "Unknown"; break; } // Get Key Type string KeyType = ""; switch (certInfo.certificate.key_type) { case ManagementKeyCertificateKeyType.KTYPE_RSA_PRIVATE: KeyType = "RSA Private Key"; break; case ManagementKeyCertificateKeyType.KTYPE_RSA_PUBLIC: KeyType = "RSA Public Key"; break; case ManagementKeyCertificateKeyType.KTYPE_DSA_PRIVATE: KeyType = "DSA Private Key"; break; case ManagementKeyCertificateKeyType.KTYPE_DSA_PUBLIC: KeyType = "DSA Public Key"; break; case ManagementKeyCertificateKeyType.KTYPE_EC_PRIVATE: KeyType = "EC Private Key"; break; case ManagementKeyCertificateKeyType.KTYPE_EC_PUBLIC: KeyType = "EC Public Key"; break; default: KeyType = "Unknown"; break; } // Get Expiration in Days DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); DateTime certExpiry = epoch.AddSeconds(certInfo.certificate.expiration_date); int ExpirationDays = (certExpiry - DateTime.Now).Days; // Create Certificate Management Pack Class ManagementPackClass mpc_Certificate = SCOM.GetManagementPackClass("AP.F5.LTM.Certificate"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Certificate); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Set Properties of Certificate // FullName (Key Property) ManagementPackProperty mpp_CertificateFullName = mpc_Certificate.PropertyCollection["FullName"]; SCOM_Object[mpp_CertificateFullName].Value = FullName; ManagementPackProperty mpp_CertificateName = mpc_Certificate.PropertyCollection["Name"]; SCOM_Object[mpp_CertificateName].Value = ShortName; ManagementPackProperty mpp_CertificateEmail = mpc_Certificate.PropertyCollection["eMail"]; SCOM_Object[mpp_CertificateEmail].Value = certInfo.certificate.cert_info.email; ManagementPackProperty mpp_CertificateFileName = mpc_Certificate.PropertyCollection["FileName"]; SCOM_Object[mpp_CertificateFileName].Value = certInfo.file_name; ManagementPackProperty mpp_CertificateCertType = mpc_Certificate.PropertyCollection["CertType"]; SCOM_Object[mpp_CertificateCertType].Value = CertType; ManagementPackProperty mpp_CertificateKeyType = mpc_Certificate.PropertyCollection["KeyType"]; SCOM_Object[mpp_CertificateKeyType].Value = KeyType; ManagementPackProperty mpp_CertificateBitLength = mpc_Certificate.PropertyCollection["BitLength"]; SCOM_Object[mpp_CertificateBitLength].Value = certInfo.certificate.bit_length; ManagementPackProperty mpp_CertificateVersion = mpc_Certificate.PropertyCollection["Version"]; SCOM_Object[mpp_CertificateVersion].Value = certInfo.certificate.version; ManagementPackProperty mpp_CertificateSerialNumber = mpc_Certificate.PropertyCollection["SerialNumber"]; SCOM_Object[mpp_CertificateSerialNumber].Value = certInfo.certificate.serial_number; ManagementPackProperty mpp_CertificateExpirationDate = mpc_Certificate.PropertyCollection["ExpirationDate"]; SCOM_Object[mpp_CertificateExpirationDate].Value = certInfo.certificate.expiration_string; ManagementPackProperty mpp_CertificateExpirationDays = mpc_Certificate.PropertyCollection["ExpirationDays"]; SCOM_Object[mpp_CertificateExpirationDays].Value = ExpirationDays; ManagementPackProperty mpp_CertificateDeviceGroup = mpc_Certificate.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_CertificateDeviceGroup].Value = dg.Name; ManagementPackProperty mpp_CertificatePartition = mpc_Certificate.PropertyCollection["Partition"]; SCOM_Object[mpp_CertificatePartition].Value = Partition; // Get Issuer Info ManagementPackProperty mpp_CertificateIssuerCommon = mpc_Certificate.PropertyCollection["IssuerCommonName"]; SCOM_Object[mpp_CertificateIssuerCommon].Value = certInfo.certificate.issuer.common_name; ManagementPackProperty mpp_CertificateIssuerCountry = mpc_Certificate.PropertyCollection["IssuerCountryName"]; SCOM_Object[mpp_CertificateIssuerCountry].Value = certInfo.certificate.issuer.country_name; ManagementPackProperty mpp_CertificateIssuerDivision = mpc_Certificate.PropertyCollection["IssuerDivisionName"]; SCOM_Object[mpp_CertificateIssuerDivision].Value = certInfo.certificate.issuer.division_name; ManagementPackProperty mpp_CertificateIssuerLocality = mpc_Certificate.PropertyCollection["IssuerLocalityName"]; SCOM_Object[mpp_CertificateIssuerLocality].Value = certInfo.certificate.issuer.locality_name; ManagementPackProperty mpp_CertificateIssuerOrganisation = mpc_Certificate.PropertyCollection["IssuerOrganisationName"]; SCOM_Object[mpp_CertificateIssuerOrganisation].Value = certInfo.certificate.issuer.organization_name; ManagementPackProperty mpp_CertificateIssuerState = mpc_Certificate.PropertyCollection["IssuerStateName"]; SCOM_Object[mpp_CertificateIssuerState].Value = certInfo.certificate.issuer.state_name; // Get Subject Info ManagementPackProperty mpp_CertificateSubjectCommon = mpc_Certificate.PropertyCollection["SubjectCommonName"]; SCOM_Object[mpp_CertificateSubjectCommon].Value = certInfo.certificate.subject.common_name; ManagementPackProperty mpp_CertificateSubjectCountry = mpc_Certificate.PropertyCollection["SubjectCountryName"]; SCOM_Object[mpp_CertificateSubjectCountry].Value = certInfo.certificate.subject.country_name; ManagementPackProperty mpp_CertificateSubjectDivision = mpc_Certificate.PropertyCollection["SubjectDivisionName"]; SCOM_Object[mpp_CertificateSubjectDivision].Value = certInfo.certificate.subject.division_name; ManagementPackProperty mpp_CertificateSubjectLocality = mpc_Certificate.PropertyCollection["SubjectLocalityName"]; SCOM_Object[mpp_CertificateSubjectLocality].Value = certInfo.certificate.subject.locality_name; ManagementPackProperty mpp_CertificateSubjectOrganisation = mpc_Certificate.PropertyCollection["SubjectOrganisationName"]; SCOM_Object[mpp_CertificateSubjectOrganisation].Value = certInfo.certificate.subject.organization_name; ManagementPackProperty mpp_CertificateSubjectState = mpc_Certificate.PropertyCollection["SubjectStateName"]; SCOM_Object[mpp_CertificateSubjectState].Value = certInfo.certificate.subject.state_name; }
/// <summary> /// Create Relationships /// </summary> private static void CreateRelationships() { foreach (SyncFailoverGroup sfog in SyncFailoverGroupList) { // Get SyncFailover Group Object EnterpriseManagementObject syncFailoverGroupObject = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(sfog.SCOM_Object.Id, ObjectQueryOptions.Default); // Add Device Relationship foreach (f5Device dev in sfog.DeviceList) { // Create SyncFailoverGroup->Device Containment Relationship Object ManagementPackRelationship mpr_SyncFailoverGroupContainsDevice = SCOM.GetManagementPackRelationship("AP.F5.LTM.SyncFailoverGroupContainsDevices"); CreatableEnterpriseManagementRelationshipObject obj_SyncFailoverGroupContainsDevice = new CreatableEnterpriseManagementRelationshipObject(SCOM.m_managementGroup, mpr_SyncFailoverGroupContainsDevice); obj_SyncFailoverGroupContainsDevice.SetSource(syncFailoverGroupObject); obj_SyncFailoverGroupContainsDevice.SetTarget(dev.SCOM_DeviceObject); relationshipData.Add(obj_SyncFailoverGroupContainsDevice); } // Loop Through Traffic Groups foreach (TrafficGroup tg in sfog.TrafficGroupList) { // Add Device Relationship foreach (f5Device dev in tg.DeviceGroup.DeviceList) { // Create TrafficGroup->Device Containment Relationship Object ManagementPackRelationship mpr_TrafficGroupContainsDevices = SCOM.GetManagementPackRelationship("AP.F5.LTM.TrafficGroupContainsDevices"); CreatableEnterpriseManagementRelationshipObject obj_TrafficGroupContainsDevice = new CreatableEnterpriseManagementRelationshipObject(SCOM.m_managementGroup, mpr_TrafficGroupContainsDevices); obj_TrafficGroupContainsDevice.SetSource(tg.SCOM_Object); obj_TrafficGroupContainsDevice.SetTarget(dev.SCOM_DeviceObject); relationshipData.Add(obj_TrafficGroupContainsDevice); } } // Loop Through Partitions foreach (Partition p in sfog.PartitionList) { // Create ClientSslProfile -> Certificate Containment foreach (ProfileClientSSL profile in p.ClientSslProfileList) { if (profile.CertificateList.Count > 0) { // Get Client SSL Object EnterpriseManagementObject profile_Object = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(profile.SCOM_Object.Id, ObjectQueryOptions.Default); foreach (Certificate cert in profile.CertificateList) { // Get Certificate Object EnterpriseManagementObject cert_Object = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(cert.SCOM_Object.Id, ObjectQueryOptions.Default); // Create Relationship ManagementPackRelationship mpr_Containment = SCOM.GetManagementPackRelationship("AP.F5.LTM.ProfileClientSSL.ContainsCertificates"); CreatableEnterpriseManagementRelationshipObject obj_Containment = new CreatableEnterpriseManagementRelationshipObject(SCOM.m_managementGroup, mpr_Containment); obj_Containment.SetSource(profile_Object); obj_Containment.SetTarget(cert_Object); relationshipData.Add(obj_Containment); } } } // Create ServerSslProfile -> Certificate Containment foreach (ProfileServerSSL profile in p.ServerSslProfileList) { if (profile.CertificateList.Count > 0) { // Get Client SSL Object EnterpriseManagementObject profile_Object = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(profile.SCOM_Object.Id, ObjectQueryOptions.Default); foreach (Certificate cert in profile.CertificateList) { // Get Certificate Object EnterpriseManagementObject cert_Object = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(cert.SCOM_Object.Id, ObjectQueryOptions.Default); // Create Relationship ManagementPackRelationship mpr_Containment = SCOM.GetManagementPackRelationship("AP.F5.LTM.ProfileServerSSL.ContainsCertificates"); CreatableEnterpriseManagementRelationshipObject obj_Containment = new CreatableEnterpriseManagementRelationshipObject(SCOM.m_managementGroup, mpr_Containment); obj_Containment.SetSource(profile_Object); obj_Containment.SetTarget(cert_Object); relationshipData.Add(obj_Containment); } } } // Add Virtual Server Containments foreach (VirtualServer vs in p.VirtualServerList) { // Get Traffic Group Object EnterpriseManagementObject vipObject = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(vs.SCOM_Object.Id, ObjectQueryOptions.Default); // Do Client SSL Profiles foreach (ProfileClientSSL profile in vs.ProfileClientSslList) { // Get Profile Object EnterpriseManagementObject profileObject = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(profile.SCOM_Object.Id, ObjectQueryOptions.Default); // Create VirtualServer->ProfileClientSSL Containment Relationship Object ManagementPackRelationship mpr_VirtualServerContainsProfile = SCOM.GetManagementPackRelationship("AP.F5.LTM.VirtualServerContainsProfileClientSSL"); CreatableEnterpriseManagementRelationshipObject obj_VirtualServerContainsProfile = new CreatableEnterpriseManagementRelationshipObject(SCOM.m_managementGroup, mpr_VirtualServerContainsProfile); obj_VirtualServerContainsProfile.SetSource(vipObject); obj_VirtualServerContainsProfile.SetTarget(profileObject); relationshipData.Add(obj_VirtualServerContainsProfile); } // Do Server SSL Profiles foreach (ProfileServerSSL profile in vs.ProfileServerSslList) { // Get Profile Object EnterpriseManagementObject profileObject = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(profile.SCOM_Object.Id, ObjectQueryOptions.Default); // Create VirtualServer->ProfileServerSSL Containment Relationship Object ManagementPackRelationship mpr_VirtualServerContainsProfile = SCOM.GetManagementPackRelationship("AP.F5.LTM.VirtualServerContainsProfileServerSSL"); CreatableEnterpriseManagementRelationshipObject obj_VirtualServerContainsProfile = new CreatableEnterpriseManagementRelationshipObject(SCOM.m_managementGroup, mpr_VirtualServerContainsProfile); obj_VirtualServerContainsProfile.SetSource(vipObject); obj_VirtualServerContainsProfile.SetTarget(profileObject); relationshipData.Add(obj_VirtualServerContainsProfile); } // Do Pools if (vs.DefaultPool != null) { // Get Pool Object EnterpriseManagementObject poolObject = SCOM.m_managementGroup.EntityObjects.GetObject <EnterpriseManagementObject>(vs.DefaultPool.SCOM_Object.Id, ObjectQueryOptions.Default); // Create VirtualServer->Pool Containment Relationship Object ManagementPackRelationship mpr_VirtualServerContainsPools = SCOM.GetManagementPackRelationship("AP.F5.LTM.VirtualServerContainsPools"); CreatableEnterpriseManagementRelationshipObject obj_VirtualServerContainsPools = new CreatableEnterpriseManagementRelationshipObject(SCOM.m_managementGroup, mpr_VirtualServerContainsPools); obj_VirtualServerContainsPools.SetSource(vipObject); obj_VirtualServerContainsPools.SetTarget(poolObject); relationshipData.Add(obj_VirtualServerContainsPools); } } } } }
/// <summary> /// Application Entry Point /// </summary> /// <param name="args"></param> static void Main(string[] args) { // Write Header Console.WriteLine("AP.F5.LTM.Discovery, ©A.Patrick 2017-2018"); Console.WriteLine("Discovers F5 LTM Classes for SCOM."); Console.WriteLine(""); // First Thing is to get the Managment Server Name from the config file (if it exists). m_managementServer = GetManagementServer(); // Get Devices (If Device File Exists if (File.Exists(m_deviceFileName)) { // Write Discovered Data to SCOM Database ( For Relationships log.Info("Creating Inbound Connector to " + m_managementServer + "..."); // Get Management Group SCOM.m_managementGroup = new ManagementGroup(m_managementServer); // Create Our Inbound Connector SCOM.CreateConnector(); log.Info("Inbound Connector Created..." + m_managementServer + "..."); // Has Conenctor been created successfully if (SCOM.m_monitoringConnector.Initialized) { // Log Progress log.Info("Starting Device Discovery..."); Console.WriteLine(); // Get Devices from SCOM SCOM_DeviceList = new SCOM_Devices(); // Get Devices from CSV GetDevices(); // Log Progress log.Info(SCOM_DeviceList.Items.Count + " Devices Found in SCOM..."); log.Info(DeviceList.Count + " Devices Found in CSV..."); Console.WriteLine(); // Get Device Groups / Traffic Groups log.Info("Get Device Groups / Traffic Groups from..."); GetDeviceGroups(); // Create Discovery Data Console.WriteLine(); log.Info("Creating Discovery Data..."); // Add Data to Discovery Data AddDataToDiscoveryData(); // Write Discovery Data log.Info("Writing Discovery Data to " + m_managementServer); discoData.Overwrite(SCOM.m_monitoringConnector); // Write Discovered Relationship Data to SCOM Database Console.WriteLine(); log.Info("Creating Relationship Data..."); CreateRelationships(); // Write Relationship Discovery Data log.Info("Writing Relationship Data to " + m_managementServer); relationshipData.Overwrite(SCOM.m_monitoringConnector); Console.WriteLine(); } else { log.Fatal("Couldn't Initialize Inbound SCOM Connector!"); } // Free Connector SCOM.m_monitoringConnector.Uninitialize(); SCOM.m_monitoringConnector = null; } else { log.Fatal("Couldn't Initialize Inbound SCOM Connector!"); Environment.Exit(5); } }