/// <summary> /// Initializes a timerjob for an indicator. /// </summary> /// <param name="nodeID">The ID of the node.</param> /// <param name="connection">The connection to the cluster.</param> /// <param name="plugin">The plugin.</param> /// <param name="indicator">The indicator.</param> /// <param name="interval">The update interval.</param> public ClusterTimerJob(WorkstationInfo node, ClusterConnection connection, IPlugin plugin, string indicator, TimeSpan interval) { this.ID = node.ID + "." + plugin.GetName() + "." + indicator; this.Interval = interval; this.node = node; this.plugin = plugin; this.indicator = indicator; this.clusterConnection = connection; if (clusterConnection.GetType() == typeof(BrightClusterConnection)) { this.platform = Platform.Bright; } else if (clusterConnection.GetType() == typeof(HpcClusterConnection)) { this.platform = Platform.HPC; } else { Logger.Instance.WriteEntry("ClusterTimerJob: Trying to create timerjobs for unsupported platform.", LogType.Exception); throw new ArgumentOutOfRangeException(); } }
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); }
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); }
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); }
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); }