From 1b4af9fee2577ed85d6dfddb528d8ea4420d9b7b Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Thu, 2 May 2019 12:00:19 +0200 Subject: [PATCH] Add human friendly system name to health report Relates to #20 --- ATxCommon/SystemChecks.cs | 4 +++- ATxService/AutoTx.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ATxCommon/SystemChecks.cs b/ATxCommon/SystemChecks.cs index bddd1ae..f5f53da 100644 --- a/ATxCommon/SystemChecks.cs +++ b/ATxCommon/SystemChecks.cs @@ -155,11 +155,13 @@ namespace ATxCommon /// Generate an overall system health report with free space, grace location status, etc. /// </summary> /// <param name="storage">StorageStatus object used for space and grace reports.</param> + /// <param name="humanSystemName">A human-friendly name/description of the system.</param> /// <returns>A multi-line string containing the details assembled in the report. These /// comprise system uptime, free RAM, free storage space and current grace location status. /// </returns> - public static string HealthReport(StorageStatus storage) { + public static string HealthReport(StorageStatus storage, string humanSystemName="N/A") { var report = "------ System health report ------\n\n" + + $" - human name: {humanSystemName}\n" + $" - hostname: {Environment.MachineName}\n" + $" - uptime: {TimeUtils.SecondsToHuman(Uptime(), false)}\n" + $" - free system memory: {GetFreeMemory()} MB" + "\n\n"; diff --git a/ATxService/AutoTx.cs b/ATxService/AutoTx.cs index 5703786..734759b 100644 --- a/ATxService/AutoTx.cs +++ b/ATxService/AutoTx.cs @@ -408,7 +408,7 @@ namespace ATxService "\n------ Loaded configuration settings ------\n" + _config.Summary(); - var health = SystemChecks.HealthReport(_storage); + var health = SystemChecks.HealthReport(_storage, _config.HostAlias); SendHealthReport(health); msg += "\n" + health; -- GitLab