/// <summary> /// Get all possible information about a server. /// </summary> /// <param name="id">ServiceID string identifying the server</param> /// <returns></returns> public FullServerInfo GetFullServerInfo(string id) { ServerInfo basicInfo = _client.GetServerDetails(_credentials, id); MonthlyBandwidthReportEntry[] externalMonthlyBandwidth = _client.GetMonthlyBandwidthReport(_credentials, id, true); MonthlyBandwidthReportEntry[] internalMonthlyBandwidth = _client.GetMonthlyBandwidthReport(_credentials, id, false); BandwidthReport externalBandwidth = _client.GetServerBandwidthReport(_credentials, id, true); BandwidthReport internalBandwidth = _client.GetServerBandwidthReport(_credentials, id, false); CurrentMonitorStatus[] monitorStatus = _client.GetServerStatus(_credentials, id); ReverseDnsEntry[] reverseDnsEntries = _client.GetReverseDnsEntries(_credentials); //reverseDnsEntries contains all entries, pick out those relecant to this servers IPAddresses List <ReverseDnsEntry> relevantEntries = new List <ReverseDnsEntry>(); foreach (ReverseDnsEntry rev in reverseDnsEntries) { if (basicInfo.IPAddresses.Contains(rev.IPAddress)) { relevantEntries.Add(rev); } } basicInfo.ReverseDnsEntries = relevantEntries.ToArray(); //compile all of this info into one object return(new FullServerInfo(basicInfo, internalBandwidth, externalBandwidth, internalMonthlyBandwidth, externalMonthlyBandwidth, monitorStatus)); }
/// <summary> /// Raises the <see cref="ReportDownloaded"/> event. /// </summary> /// <param name="report"> /// The report. /// </param> /// <param name="timestamp"> /// The time stamp. /// </param> /// <param name="exception">Exception.</param> protected virtual void OnReportDownloaded(BandwidthReport report, DateTime timestamp, Exception exception) { var handler = this.ReportDownloaded; if (null != handler) { handler(this, new ReportDownloadedEventArgs(report, timestamp, exception)); } }
public FullServerInfo(ServerInfo baseInfo, BandwidthReport internalBandwidthReport, BandwidthReport externalBandwidthReport, MonthlyBandwidthReportEntry[] internalMonthlyBandwidthReport, MonthlyBandwidthReportEntry[] externalMonthlyBandwidthReport, CurrentMonitorStatus[] monitorStatuses) { this.BaseInfo = baseInfo; this.InternalBandwidthReport = internalBandwidthReport; this.InternalMonthlyBandwidthReport = internalMonthlyBandwidthReport; this.ExternalBandwidthReport = externalBandwidthReport; this.ExternalMonthlyBandwidthReport = externalMonthlyBandwidthReport; this.MonitorStatuses = monitorStatuses; }
public static ReportDownloadedEventArgs CreateEventArgs() { var oneGigabytes = 1048576; var monthly = new List <MonthlyBandwidth>() { new MonthlyBandwidth(2011, 1, oneGigabytes, oneGigabytes) }; var daily = new List <DailyBandwidth> { new DailyBandwidth(2011, 1, 1, oneGigabytes, oneGigabytes) }; var bandWidthReport = new BandwidthReport(monthly, daily); return(new ReportDownloadedEventArgs(bandWidthReport, DateTime.Now, null)); }
public static ReportDownloadedEventArgs CreateEventArgs() { var monthly = new List <MonthlyBandwidth>() { new MonthlyBandwidth(2010, 11, 0, 0), new MonthlyBandwidth(2010, 12, 0, 0), new MonthlyBandwidth(2011, 1, 0, 0), new MonthlyBandwidth(2011, 2, 0, 0), new MonthlyBandwidth(2011, 3, 0, 0), }; var bandWidthReport = new BandwidthReport(monthly, Enumerable.Empty <DailyBandwidth>()); return(new ReportDownloadedEventArgs(bandWidthReport, DateTime.Now, null)); }
public static ReportDownloadedEventArgs CreateEventArgs() { var monthly = new List <MonthlyBandwidth>() { new MonthlyBandwidth(2011, 1, 0, 0), new MonthlyBandwidth(2011, 2, 0, 0), new MonthlyBandwidth(2011, 3, 0, 0), new MonthlyBandwidth(2011, 4, 0, 0), new MonthlyBandwidth(2011, 5, 0, 0), }; var daily = new List <DailyBandwidth> { new DailyBandwidth(2011, 1, 1, 0, 0) }; var bandWidthReport = new BandwidthReport(monthly, daily); return(new ReportDownloadedEventArgs(bandWidthReport, DateTime.Now, null)); }
/// <summary> /// Initializes a new instance of the <see cref="ReportDownloadedEventArgs"/> class. /// </summary> /// <param name="report"> /// The report. /// </param> /// <param name="timestamp"> /// The timestamp. /// </param> /// <param name="exception">Exception.</param> public ReportDownloadedEventArgs(BandwidthReport report, DateTime timestamp, Exception exception) { this.monthly = new List <MonthlyValue>(); this.daily = new List <DailyValue>(); this.Timestamp = timestamp; if (null != exception) { this.Error = exception; return; } report.Monthly.Each((value) => { var monthlyValue = new MonthlyValue(value); this.monthly.Add(monthlyValue); }); report.Daily.Each((value) => { var dailyValue = new DailyValue(value); this.daily.Add(dailyValue); }); }