public void AppendDisplayColumns(ref ColumnDisplay columnDisplay) { var sources = MonitoringSources; columnDisplay.AppendCol(Name ?? "?"); columnDisplay.AppendCol($"{TopHeight:#;;'n/a'}"); columnDisplay.AppendCol($"{sources}"); if (MonitoringSources == 0) { columnDisplay.AppendCol("n/a"); columnDisplay.AppendCol("n/a"); columnDisplay.AppendCol("n/a - no data sources available"); } else if (FullBlockMesured) { columnDisplay.AppendCol(LastHeight.HasValue ? $"{LastHeight.Value:HH:mm:ss}" : "n/a"); columnDisplay.AppendCol(NextHeight.HasValue ? $"{(NextHeight.Value - DateTime.UtcNow).ToMSDisplay()}" : "n/a"); var sb = new StringBuilder(); foreach (var bt in AverageBlocktime.GetValues().Reverse().Take(3)) { if (sb.Length > 0) { sb.Append("<"); } sb.Append($"[{new TimeSpan(0, 0, bt).ToMSDisplay()}]"); } if (MonitoringSources == 1) { sb.Append(" (only one data source)"); } columnDisplay.AppendCol(sb.ToString()); } else { columnDisplay.AppendCol("n/a"); columnDisplay.AppendCol("n/a"); columnDisplay.AppendCol("n/a - please wait for next block"); } }
static public string GetNodes() { var columnDisplay = new ColumnDisplay(); columnDisplay.AppendCol("Node"); columnDisplay.AppendCol("Host"); columnDisplay.AppendCol("Ver"); columnDisplay.AppendCol("Height"); columnDisplay.AppendCol("Ave reply"); columnDisplay.AppendCharLine('-'); foreach (var group in NodeGroupList) { foreach (var node in NodesList.Values.Where(x => x.Group == group.Key)) { node.AppendDisplayColumns(ref columnDisplay); columnDisplay.NewLine(); } } return(columnDisplay.ToString()); }
public void AppendDisplayColumns(ref ColumnDisplay columnDisplay) { columnDisplay.AppendCol(Name ?? "?"); columnDisplay.AppendCol(Host ?? "?"); columnDisplay.AppendCol(NodeVersion ?? ""); columnDisplay.AppendCol($"{LeaderHeight}"); columnDisplay.AppendCol($"{LatencyList.CurrentAverage.ToString().PadLeft(3)} ms ({(100 - PacketLoss.CurrentAverage):0.#}%) "); if (!Monitor) { columnDisplay.Append("MONITOR OFF"); } else if (AlarmRequestFail != null) { columnDisplay.Append("NOT RESPONDING"); } else { if (AlarmHeightLow != null) { columnDisplay.Append("HEIGHT LOW "); } if (AlarmSyncing != null) { columnDisplay.Append("SYNCING "); } if (AlarmLatencyLow != null) { columnDisplay.Append("LATENCY LOW "); } } if (string.IsNullOrEmpty(ErrorMsg)) { columnDisplay.Append(ErrorMsg); } }
public void HelpString(ref ColumnDisplay columnDisplay) { columnDisplay.AppendCol("users", "", "List users."); }