/// <summary> /// Gets the status of the server. /// </summary> /// <param name="status">Target status output <see cref="StringBuilder"/>.</param> /// <param name="maxFileListing">Maximum file listing.</param> public void GetFullStatus(StringBuilder status, int maxFileListing = -1) { lock (m_syncRoot) { status.AppendLine($"Historian Instances:{Environment.NewLine}"); int count = 0; foreach (DatabaseInfo dbInfo in GetDatabaseInfo()) { status.AppendLine($"Instance {++count:N0}: {dbInfo.DatabaseName}{Environment.NewLine}"); try { GetDatabase(dbInfo.DatabaseName).GetFullStatus(status, maxFileListing); } catch (Exception ex) { Log.Publish(MessageLevel.Warning, "Full Status", $"Failed to get full status for {dbInfo.DatabaseName}", exception: ex); } } status.AppendLine($"{Environment.NewLine}Socket Connections:{Environment.NewLine}"); count = 0; foreach (KeyValuePair <IPEndPoint, SnapSocketListener> socket in m_sockets) { status.AppendLine($"Connection {++count:N0}: Port: {socket.Key}{Environment.NewLine}"); try { SnapSocketListener historian = socket.Value; historian.GetFullStatus(status); } catch (Exception ex) { Log.Publish(MessageLevel.Warning, "Full Status", $"Failed to get full status for port {socket.Key}", exception: ex); } } } }
/// <summary> /// Gets the status of the server. /// </summary> /// <param name="status"></param> public void GetFullStatus(StringBuilder status) { //ToDo: Consider a better way to get status data. lock (m_syncRoot) { status.AppendFormat("Historian Instances:"); foreach (DatabaseInfo dbInfo in GetDatabaseInfo()) { status.AppendFormat("DB Name:{0}\r\n", dbInfo.DatabaseName); try { GetDatabase(dbInfo.DatabaseName).GetFullStatus(status); } catch (Exception ex) { Log.Publish(MessageLevel.Warning, "Full Status", $"Failed to get full status for {dbInfo.DatabaseName}", exception: ex); } } status.AppendFormat("Socket Connections"); foreach (KeyValuePair <IPEndPoint, SnapSocketListener> socket in m_sockets) { status.AppendFormat("Port:{0}\r\n", socket.Key); try { SnapSocketListener historian = socket.Value; historian.GetFullStatus(status); } catch (Exception ex) { Log.Publish(MessageLevel.Warning, "Full Status", $"Failed to get full status for port {socket.Key}", exception: ex); } } } }