コード例 #1
0
        public override ClusterConnection CopyConnection()
        {
            if (this.ConnectionObject == null)
            {
                Logger.Instance.WriteEntry("BrightClusterConnection_CopyConnection(): Connection was null and cannot be copied", LogType.Warning);
                throw new Exception("BrightClusterConnection_CopyConnection: You didn't call INIT before accessing the Cluster connection. Do this before any calls!");
            }
            ClusterConnection c = new BrightClusterConnection();

            c.Init(this.url, this.username, this.password);
            return(c);
        }
コード例 #2
0
        public List <Tuple <string, object, DataType> > AcquireData(List <string> indicatorNames, string monitoredSystemName, ClusterConnection clusterConnection)
        {
            if (clusterConnection.GetType() == typeof(BrightClusterConnection))
            {
                this.clusterConnection = (BrightClusterConnection)clusterConnection;
            }
            else
            {
                throw new ArgumentOutOfRangeException("ClusterConnection is no valid BrightClusterConnecction 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 indicatorName in indicatorNames)
            {
                try
                {
                    result.Add(indicatorDictionary[indicatorName].Invoke(monitoredSystemName));
                }
                catch (KeyNotFoundException)
                {
                    Logger.Instance.WriteEntry("Network-Adapter: [ERROR] Could not find indicator name " + indicatorName + ".", LogType.Warning);
                }
                catch (ArgumentNullException)
                {
                    // Do nothing. The first error that occurs is going to be logged in the plugin.
                }
                catch (Exception e)
                {
                    Logger.Instance.WriteEntry("BrightCluster_Network: Unknown Exception in " + indicatorName + " on Node " + monitoredSystemName + ": " + e.Message, LogType.Exception);
                }
            }

            return(result);
        }
コード例 #3
0
        public List <Tuple <string, object, DataType> > AcquireData(List <string> indicatorNames, string monitoredSystemName, ClusterConnection clusterConnection)
        {
            if (clusterConnection.GetType() == typeof(BrightClusterConnection))
            {
                this.clusterConnection = (BrightClusterConnection)clusterConnection;
            }
            else
            {
                throw new ArgumentOutOfRangeException("ClusterConnection is no valid BrightClusterConnecction 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, GetTotalCapacity(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("BrightCluster_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, GetTotalLoad(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("BrightCluster_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, GetNumberOfDrives(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("BrightCluster_Storage: Unknown Exception in " + indicator + " on Node " + monitoredSystemName + ": " + e.Message, LogType.Exception);
                        }
                    }
                    else if (indicator.Equals(indicators[3].IndicatorName))
                    {
                        try
                        {
                            result.Add(new Tuple <string, object, DataType>(indicators[3].IndicatorName, GetCapacityPerDrive(monitoredSystemName), indicators[3].DataType));
                        }
                        catch (ArgumentNullException)
                        {
                            // Do nothing. The first error that occurs is going to be logged in the plugin.
                        }
                        catch (Exception e)
                        {
                            Logger.Instance.WriteEntry("BrightCluster_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 BrightCluster data. Occured when checking for " + indicator + ". Exception was: " + e.ToString(), LogType.Exception);
                }
            }
            return(result);
        }