Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves the subnet of the client, that the pipeline is connected to.
        /// </summary>
        /// <param name="pipeline">Pipeline that is connected to the server</param>
        /// <returns>the subnet-address</returns>
        private static string calculatePrivateSubNet(HpcClusterConnection hpcClusterConnection)
        {
            string ipAddress  = "";
            string subnetMask = "";
            string result     = "";

            //acquires ip and subnetmask
            HpcPipelineObject pipelineObject = hpcClusterConnection.getPipeline();

            pipelineObject.pipeline.Commands.AddScript("Add-PSSnapin Microsoft.Hpc");
            pipelineObject.pipeline.Commands.AddScript("Get-HpcNetworkInterface -Type Private");
            Collection <PSObject> results1 = pipelineObject.pipeline.Invoke();

            hpcClusterConnection.freePipeline(pipelineObject);

            PSObject obj = results1[0];

            subnetMask = obj.Properties["Subnetmask"].Value.ToString();
            ipAddress  = obj.Properties["IpAddress"].Value.ToString();

            string[] ipArray          = ipAddress.Split('.');
            string[] networkMaskArray = subnetMask.Split('.');

            string[] subnetArray = new String[4];

            for (int i = 0; i < 4; i++)
            {
                subnetArray[i] = (Convert.ToInt32(ipArray[i]) & Convert.ToInt32(networkMaskArray[i])).ToString();
            }

            for (int i = 0; i < subnetArray.Length; i++)
            {
                result += subnetArray[i];

                if (i != subnetArray.Length - 1)
                {
                    result += ".";
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public List <Tuple <string, object, DataType> > AcquireData(List <string> indicatorNames, string monitoredSystemName, ClusterConnection clusterConnection)
        {
            if (clusterConnection.GetType() == typeof(HpcClusterConnection))
            {
                this.clusterConnection = (HpcClusterConnection)clusterConnection;
            }
            else
            {
                throw new ArgumentOutOfRangeException("ClusterConnection is no valid HpcClusterConnection Object! Method skipped");
            }
            checkClusterConnection();

            // skip method if no real monSysName is given.
            if (monitoredSystemName == null || monitoredSystemName.Length == 0)
            {
                throw new ArgumentOutOfRangeException("MonitoredSystemName is not valid for this cluster");
            }

            List <Tuple <string, object, DataType> > result = new List <Tuple <string, object, DataType> >();

            foreach (string indicator in indicatorNames)
            {
                if (indicator.Equals(indicators[0].IndicatorName))
                {
                    try
                    {
                        result.Add(new Tuple <string, object, DataType>(indicators[0].IndicatorName, getMemSizeInMB(monitoredSystemName), indicators[0].DataType));
                    }
                    catch (Exception e)
                    {
                        Logger.Instance.WriteEntry("Error while retrieving data from the HPC cluster.\n\nThe node \"" + monitoredSystemName + "\" is unreachable. Error in MemSizeInMB: " + e.Message, LogType.Info);
                    }
                }
                else
                {
                    throw new ArgumentOutOfRangeException();
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        public List <Tuple <string, object, DataType> > AcquireData(List <string> indicatorNames, string monitoredSystemName, ClusterConnection clusterConnection)
        {
            if (clusterConnection.GetType() == typeof(HpcClusterConnection))
            {
                this.clusterConnection = (HpcClusterConnection)clusterConnection;
            }
            else
            {
                throw new ArgumentOutOfRangeException("ClusterConnection is no valid HpcClusterConnecction Object! Method skipped");
            }
            CheckClusterConnection();

            // Skip method if no real monSysName is given.
            if (monitoredSystemName == null || monitoredSystemName.Length == 0)
            {
                throw new ArgumentOutOfRangeException("MonitoredSystemName is not valid for this cluster");
            }

            List <Tuple <string, object, DataType> > result = new List <Tuple <string, object, DataType> >();

            foreach (string indicator in indicatorNames)
            {
                try
                {
                    if (indicator.Equals(indicators[0].IndicatorName))
                    {
                        try
                        {
                            result.Add(new Tuple <string, object, DataType>(indicators[0].IndicatorName, GetTotalLoad(monitoredSystemName), indicators[0].DataType));
                        }
                        catch (ArgumentNullException)
                        {
                            // Do nothing. The first error that occurs is going to be logged in the plugin.
                        }
                        catch (Exception e)
                        {
                            Logger.Instance.WriteEntry("HPC_Storage: Unknown Exception in " + indicator + " on Node " + monitoredSystemName + ": " + e.Message, LogType.Exception);
                        }
                    }
                    else if (indicator.Equals(indicators[1].IndicatorName))
                    {
                        try
                        {
                            result.Add(new Tuple <string, object, DataType>(indicators[1].IndicatorName, GetNumberOfDrives(monitoredSystemName), indicators[1].DataType));
                        }
                        catch (ArgumentNullException)
                        {
                            // Do nothing. The first error that occurs is going to be logged in the plugin.
                        }
                        catch (Exception e)
                        {
                            Logger.Instance.WriteEntry("HPC_Storage: Unknown Exception in " + indicator + " on Node " + monitoredSystemName + ": " + e.Message, LogType.Exception);
                        }
                    }
                    else if (indicator.Equals(indicators[2].IndicatorName))
                    {
                        try
                        {
                            result.Add(new Tuple <string, object, DataType>(indicators[2].IndicatorName, GetLoadPerDrive(monitoredSystemName), indicators[2].DataType));
                        }
                        catch (ArgumentNullException)
                        {
                            // Do nothing. The first error that occurs is going to be logged in the plugin.
                        }
                        catch (Exception e)
                        {
                            Logger.Instance.WriteEntry("HPC_Storage: Unknown Exception in " + indicator + " on Node " + monitoredSystemName + ": " + e.Message, LogType.Exception);
                        }
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException();
                    }
                }
                catch (Exception e)
                {
                    Logger.Instance.WriteEntry("Error during collection of HPC data. Occured when checking for " + indicator + ". Exception was: " + e.ToString(), LogType.Exception);
                }
            }
            return(result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This method queries the given DHCP-Servers for IPs an MAC-Addresses
        /// of all Clients in the same subnet as this DHCP-Server
        /// </summary>
        /// <param name="dhcpServerAddress">the DHCP-Server-Address</param>
        /// <returns>dictionarty with the nodename and the mac-address</returns>
        public static Dictionary <string, string> getSubnetInformation(string dhcpServerAddress, HpcClusterConnection hpcClusterConnection)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();

            // gather clients
            ArrayList clients = findDhcpClients(dhcpServerAddress, calculatePrivateSubNet(hpcClusterConnection));


            foreach (dhcpClient d in clients)
            {
                result.Add(d.hostname, convertMac(d.mac));
            }
            return(result);
        }
Ejemplo n.º 5
0
        public List <Tuple <string, object, DataType> > AcquireData(List <string> indicatorNames, string monitoredSystemName, ClusterConnection clusterConnection)
        {
            if (clusterConnection.GetType() == typeof(HpcClusterConnection))
            {
                this.clusterConnection = (HpcClusterConnection)clusterConnection;
            }
            else
            {
                throw new ArgumentException("ClusterConnection is no valid HpcClusterConnection Object! Method skipped");
            }
            checkClusterConnection();
            // skip method if no real monSysName is given.
            if (monitoredSystemName == null || monitoredSystemName.Length == 0)
            {
                throw new ArgumentException("MonitoredSystemName is not valid for this cluster");
            }

            List <Tuple <string, object, DataType> > result = new List <Tuple <string, object, DataType> >();

            foreach (string indicator in indicatorNames)
            {
                try
                {
                    if (indicator.Equals(indicators[1].IndicatorName))
                    {
                        try
                        {
                            result.Add(new Tuple <string, object, DataType>(indicators[1].IndicatorName, GetNumberOfCores(monitoredSystemName), indicators[1].DataType));
                        }
                        catch (Exception e)
                        {
                            Logger.Instance.WriteEntry("Failed to acquire the number of cores from \"" + monitoredSystemName + "\". Error: " + e.ToString(), LogType.Exception);
                        }
                    }

                    else if (indicator.Equals(indicators[0].IndicatorName))
                    {
                        try
                        {
                            result.Add(new Tuple <string, object, DataType>(indicators[0].IndicatorName, GetLoad(monitoredSystemName), indicators[0].DataType));
                        }
                        catch (Exception e)
                        {
                            Logger.Instance.WriteEntry("Failed to acquire the cpu-load of \"" + monitoredSystemName + "\"Error: " + e.ToString(), LogType.Exception);
                        }
                    }

                    /*
                     * else if (indicator.Equals(indicators[2].IndicatorName))
                     * {
                     *  result.Add(new Tuple<string, object, DataType>(indicators[2].IndicatorName, GetProcessorName(monitoredSystemName), indicators[2].DataType));
                     * }
                     */
                    else
                    {
                        throw new ArgumentOutOfRangeException();
                    }
                }
                catch (System.FormatException f)
                {
                    Logger.Instance.WriteEntry("Error during formatation of HPC data. Occured when checking for " + indicator + ".", LogType.Exception);
                }
            }
            return(result);
        }