Exemple #1
0
        /// <summary>
        /// Get Fans
        /// </summary>
        private void GetFans()
        {
            // Get Count of Fans
            int fanCount = Convert.ToInt32(SNMP.GetSNMP(SNMP.sysChassisFanNumber, Address, Port, Community)[0].Data.ToString());

            // If There Are Fans Then Create FanGroup and Relationship
            if (fanCount > 0)
            {
                // Create Device Group Management Pack Class
                ManagementPackClass mpc_Device = SCOM_Functions.GetManagementPackClass("AP.F5.Device");

                // Create Root Entity Class & Display Name Prop
                ManagementPackClass    mpc_Entity            = SCOM_Functions.GetManagementPackClass("System.Entity");
                ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"];

                // Parent Device Key Property (IP Address)
                ManagementPackProperty mpp_DeviceKey = mpc_Device.PropertyCollection["DeviceName"];

                // Create FanGroup Object
                ManagementPackClass mpc_DeviceFanGroup = SCOM_Functions.GetManagementPackClass("AP.F5.Device.FansGroup");
                SCOM_Object_FanGroup = new CreatableEnterpriseManagementObject(m_managementGroup, mpc_DeviceFanGroup);
                SCOM_Object_FanGroup[mpp_DeviceKey].Value = SystemNodeName; // Set Key of Device
                ManagementPackProperty mpp_DeviceFansGroupName = mpc_DeviceFanGroup.PropertyCollection["Name"];
                SCOM_Object_FanGroup[mpp_DeviceFansGroupName].Value = "Fans";


                // Create Management Pack Class Objects for Fan and Needed Properties
                ManagementPackClass    mpc_Fan      = SCOM_Functions.GetManagementPackClass(className: "AP.F5.Device.Fan");
                ManagementPackProperty mpp_FanIndex = mpc_Fan.PropertyCollection["Index"];
                ManagementPackProperty mpp_FanName  = mpc_Fan.PropertyCollection["Name"];

                // Set Fan-Group Relationship
                ManagementPackRelationship mpr_FanGroup = SCOM_Functions.GetManagementPackRelationship("AP.F5.Device.FansGroup.HostsFans");

                // Create Fans
                for (int i = 1; i <= fanCount; i++)
                {
                    Fan newfan = new Fan();

                    // Create SCOM Fan Object
                    newfan.SCOM_Object_Fan = new CreatableEnterpriseManagementObject(SCOM_Functions.m_managementGroup, mpc_Fan);
                    // Set Key of Device
                    newfan.SCOM_Object_Fan[mpp_DeviceKey].Value = SystemNodeName;
                    // Set Key of Fans Group
                    newfan.SCOM_Object_Fan[mpp_DeviceFansGroupName].Value = "Fans";
                    //Set Logical Entity Display Name
                    newfan.SCOM_Object_Fan[mpp_EntityDisplayName].Value = "Fan-" + i.ToString();
                    // Set Fan Properties
                    newfan.SCOM_Object_Fan[mpp_FanIndex].Value = Convert.ToInt32(SNMP.GetSNMP(SNMP.sysChassisFanIndex + i.ToString(), Address, Port, Community)[0].Data.ToString());;
                    newfan.SCOM_Object_Fan[mpp_FanName].Value  = "Fan-" + i.ToString();

                    Fans.Add(newfan);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Get Temp Sensor
        /// </summary>
        private void GetTempSensors()
        {
            // Get Count of Temperature Sensors
            int TempSensorCount = Convert.ToInt16(SNMP.GetSNMP(SNMP.sysChassisTempNumber, Address, Port, Community)[0].Data.ToString());

            // If we have Temperature Sensors
            if (TempSensorCount > 0)
            {
                // Create Device Group Management Pack Class
                ManagementPackClass mpc_Device = SCOM_Functions.GetManagementPackClass("AP.F5.Device");

                // Create Root Entity Class & Display Name Prop
                ManagementPackClass    mpc_Entity            = SCOM_Functions.GetManagementPackClass("System.Entity");
                ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"];

                // Parent Device Key Property (IP Address)
                ManagementPackProperty mpp_DeviceKey = mpc_Device.PropertyCollection["DeviceName"];

                // Create FanGroup Object
                ManagementPackClass mpc_DeviceTempSensorsGroup = SCOM_Functions.GetManagementPackClass("AP.F5.Device.TempSensorsGroup");
                SCOM_Object_TempSensorsGroup = new CreatableEnterpriseManagementObject(m_managementGroup, mpc_DeviceTempSensorsGroup);
                SCOM_Object_TempSensorsGroup[mpp_DeviceKey].Value = SystemNodeName; // Set Key of Device
                ManagementPackProperty mpp_DeviceTempSensorsGroupName = mpc_DeviceTempSensorsGroup.PropertyCollection["Name"];
                SCOM_Object_TempSensorsGroup[mpp_DeviceTempSensorsGroupName].Value = "Temp. Sensors";

                // Create Management Pack Class Objects for TempSensor and Needed Properties
                ManagementPackClass    mpc_TempSensor      = SCOM_Functions.GetManagementPackClass(className: "AP.F5.Device.TempSensor");
                ManagementPackProperty mpp_TempSensorIndex = mpc_TempSensor.PropertyCollection["Index"];
                ManagementPackProperty mpp_TempSensorName  = mpc_TempSensor.PropertyCollection["Name"];

                // Set Fan-Group Relationship
                ManagementPackRelationship mpr_TempSensorsGroup = SCOM_Functions.GetManagementPackRelationship("AP.F5.Device.TempSensorsGroup.HostsTempSensors");

                // Create Temp Sensors
                for (int i = 1; i <= TempSensorCount; i++)
                {
                    TempSensor newTempSensor = new TempSensor();

                    // Create SCOM TempSensor Object
                    newTempSensor.SCOM_Object_TempSensor = new CreatableEnterpriseManagementObject(SCOM_Functions.m_managementGroup, mpc_TempSensor);
                    // Set Key of Device
                    newTempSensor.SCOM_Object_TempSensor[mpp_DeviceKey].Value = SystemNodeName;
                    // Set Key of Fans Group
                    newTempSensor.SCOM_Object_TempSensor[mpp_DeviceTempSensorsGroupName].Value = "Temp. Sensors";
                    //Set Logical Entity Display Name
                    newTempSensor.SCOM_Object_TempSensor[mpp_EntityDisplayName].Value = "TempSensor-" + i.ToString();
                    // Set Fan Properties
                    newTempSensor.SCOM_Object_TempSensor[mpp_TempSensorIndex].Value = Convert.ToInt32(SNMP.GetSNMP(SNMP.sysChassisTempIndex + i.ToString(), Address, Port, Community)[0].Data.ToString());
                    newTempSensor.SCOM_Object_TempSensor[mpp_TempSensorName].Value  = "TempSensor-" + i.ToString();

                    TempSensors.Add(newTempSensor);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Get Power Supplies
        /// </summary>
        private void GetPowerSupplies()
        {
            // Get Count of PowerSupplies
            int powerSupplyCount = Convert.ToInt16(SNMP.GetSNMP(SNMP.sysChassisPowerSupplyNumber, Address, Port, Community)[0].Data.ToString());

            // If There are Fans Then Continue
            if (powerSupplyCount > 0)
            {
                // Create Device Group Management Pack Class
                ManagementPackClass mpc_Device = SCOM_Functions.GetManagementPackClass("AP.F5.Device");

                // Create Root Entity Class & Display Name Prop
                ManagementPackClass    mpc_Entity            = SCOM_Functions.GetManagementPackClass("System.Entity");
                ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"];

                // Parent Device Key Property (IP Address)
                ManagementPackProperty mpp_DeviceKey = mpc_Device.PropertyCollection["DeviceName"];

                // Create PowerSuppliesGroup Object
                ManagementPackClass mpc_DevicePowerSupplyGroup = SCOM_Functions.GetManagementPackClass("AP.F5.Device.PowerSuppliesGroup");
                SCOM_Object_PowerSupplyGroup = new CreatableEnterpriseManagementObject(m_managementGroup, mpc_DevicePowerSupplyGroup);
                SCOM_Object_PowerSupplyGroup[mpp_DeviceKey].Value = SystemNodeName; // Set Key of Device
                ManagementPackProperty mpp_DevicePowerSuppliesGroupName = mpc_DevicePowerSupplyGroup.PropertyCollection["Name"];
                SCOM_Object_PowerSupplyGroup[mpp_DevicePowerSuppliesGroupName].Value = "PSUs";

                // Create Management Pack Class Objects for PowerSupply and Needed Properties
                ManagementPackClass    mpc_PowerSupply      = SCOM_Functions.GetManagementPackClass(className: "AP.F5.Device.PowerSupply");
                ManagementPackProperty mpp_PowerSupplyIndex = mpc_PowerSupply.PropertyCollection["Index"];
                ManagementPackProperty mpp_PowerSupplyName  = mpc_PowerSupply.PropertyCollection["Name"];

                // Set PowerSupply-Group Relationship
                ManagementPackRelationship mpr_PowerSuppliesGroup = SCOM_Functions.GetManagementPackRelationship("AP.F5.Device.PowerSuppliesGroup.HostsPowerSupplies");


                for (int i = 1; i <= powerSupplyCount; i++)
                {
                    PowerSupply newpsu = new PowerSupply();

                    // Create SCOM  Object
                    newpsu.SCOM_Object_PowerSupply = new CreatableEnterpriseManagementObject(SCOM_Functions.m_managementGroup, mpc_PowerSupply);
                    // Set Key of Device
                    newpsu.SCOM_Object_PowerSupply[mpp_DeviceKey].Value = SystemNodeName;
                    // Set Key of Fans Group
                    newpsu.SCOM_Object_PowerSupply[mpp_DevicePowerSuppliesGroupName].Value = "PSUs";
                    //Set Logical Entity Display Name
                    newpsu.SCOM_Object_PowerSupply[mpp_EntityDisplayName].Value = "PSU-" + i.ToString();
                    // Set Fan Properties
                    newpsu.SCOM_Object_PowerSupply[mpp_PowerSupplyIndex].Value = Convert.ToInt32(SNMP.GetSNMP(SNMP.sysChassisPowerSupplyIndex + i.ToString(), Address, Port, Community)[0].Data.ToString());
                    newpsu.SCOM_Object_PowerSupply[mpp_PowerSupplyName].Value  = "PSU-" + i.ToString();

                    PowerSupplies.Add(newpsu);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="address"></param>
        /// <param name="community"></param>
        /// <param name="port"></param>
        /// <param name="f5usr"></param>
        /// <param name="f5pwd"></param>
        public f5Device(ManagementGroup mg, string address, string community, int port, string f5usr, string f5pwd)
        {
            // Properties from Arguments
            Address           = address;
            Community         = community;
            Port              = port;
            F5usr             = f5usr;
            F5pwd             = f5pwd;
            m_managementGroup = mg;

            // Get System OID
            SystemOID = SNMP.GetSNMP(SNMP.sysObjectID, address, port, community)[0].Data.ToString();

            // Get SysSystem Info
            SystemNodeName = SNMP.GetSNMP(SNMP.sysSystemName, address, port, community)[0].Data.ToString();

            // Find Out if Virtual Or Physical
            HwName = SNMP.GetSNMP(SNMP.sysGeneralHwName, address, port, community)[0].Data.ToString();
            if (HwName == "Z100")
            {
                Type = "Virtual";
            }
            else
            {
                Type = "Physical";
            }

            // Get Model
            Model = SNMP.GetSNMP(SNMP.sysPlatformInfoMarketingName, address, port, community)[0].Data.ToString();

            // Get SerialNumber
            SerialNumber = SNMP.GetSNMP(SNMP.sysGeneralChassisSerialNum, address, port, community)[0].Data.ToString();

            // Get Location
            Location = SNMP.GetSNMP(SNMP.sysLocation, address, port, community)[0].Data.ToString();

            // Get Contact
            Contact = SNMP.GetSNMP(SNMP.sysContact, address, port, community)[0].Data.ToString();

            // Get Product Info
            List <Variable> returnlist = SNMP.BulkSNMP(SNMP.sysProduct, address, port, community);

            SoftwareVersion = returnlist[1].Data.ToString();
            SoftwareBuild   = returnlist[2].Data.ToString();
            SoftwareHotFix  = returnlist[3].Data.ToString();

            // Get Standalone
            int iSynStatus = Convert.ToInt32(SNMP.GetSNMP(SNMP.sysCmSyncStatusId, address, port, community)[0].Data.ToString());

            if (iSynStatus == 6)
            {
                Standalone = true;
            }
            else
            {
                Standalone = false;
            }

            // Create Scom Object
            CreateDeviceScomObject();

            // Create Failover State Object And Relationship
            CreateFailoverStateScomObjects();

            CreateMemoryScomObjects();

            // Create

            // Get Fans (if Virtual will return 0 Fans)
            GetFans();

            // Get Power Supplies (if Virtual will return 0 Fans)
            GetPowerSupplies();

            // Get Temp Sensors (if Virtual will return 0 Fans)
            GetTempSensors();

            // Get Processors
            GetProcessors();

            // Get Disk Partitions
            GetDiskPartitions();
        }