From c99b0cef4c81ccad976927aa23d044c33cac6956 Mon Sep 17 00:00:00 2001 From: Debian Date: Mon, 25 May 2026 06:43:56 +0200 Subject: [PATCH] feat(system): health-Endpoint liefert jetzt hostname + OS + kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /system/health gibt zusätzlich hostname, os (PRETTY_NAME aus /etc/os-release) und kernel (/proc/version, ohne Build-Details) zurück - Settings-Seite: SystemHealth-Interface erweitert, System-Info-Card zeigt Hostname, Betriebssystem und Kernel-Version an (conditional, nur wenn vorhanden) - Nützlich beim Verwalten mehrerer Boxen — ohne SSH sofort sehen welches System gerade geöffnet ist Co-Authored-By: Claude Sonnet 4.6 --- VERSION | 2 +- cmd/edgeguard-api/main.go | 2 +- cmd/edgeguard-ctl/main.go | 2 +- cmd/edgeguard-scheduler/main.go | 2 +- internal/handlers/system.go | 25 +++++++++++++++++-- management-ui/src/i18n/locales/de/common.json | 3 +++ management-ui/src/i18n/locales/en/common.json | 3 +++ management-ui/src/pages/Settings/index.tsx | 6 +++++ 8 files changed, 39 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 219fe46..b223598 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.97 +1.1.98 diff --git a/cmd/edgeguard-api/main.go b/cmd/edgeguard-api/main.go index ad37a53..91b3216 100644 --- a/cmd/edgeguard-api/main.go +++ b/cmd/edgeguard-api/main.go @@ -60,7 +60,7 @@ import ( usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users" ) -var version = "1.1.97" +var version = "1.1.98" func main() { addr := os.Getenv("EDGEGUARD_API_ADDR") diff --git a/cmd/edgeguard-ctl/main.go b/cmd/edgeguard-ctl/main.go index 82b5e76..e58392a 100644 --- a/cmd/edgeguard-ctl/main.go +++ b/cmd/edgeguard-ctl/main.go @@ -11,7 +11,7 @@ import ( "git.netcell-it.de/projekte/edgeguard-native/internal/services/setup" ) -var version = "1.1.97" +var version = "1.1.98" const usage = `edgeguard-ctl — EdgeGuard CLI diff --git a/cmd/edgeguard-scheduler/main.go b/cmd/edgeguard-scheduler/main.go index 30ec136..835f9c0 100644 --- a/cmd/edgeguard-scheduler/main.go +++ b/cmd/edgeguard-scheduler/main.go @@ -35,7 +35,7 @@ import ( "git.netcell-it.de/projekte/edgeguard-native/internal/services/tlscerts" ) -var version = "1.1.97" +var version = "1.1.98" const ( // renewTickInterval — how often we re-evaluate expiring certs. diff --git a/internal/handlers/system.go b/internal/handlers/system.go index 4ed5866..798460a 100644 --- a/internal/handlers/system.go +++ b/internal/handlers/system.go @@ -752,10 +752,31 @@ func (h *SystemHandler) ConfigPreview(c *gin.Context) { } func (h *SystemHandler) Health(c *gin.Context) { - response.OK(c, gin.H{ + resp := gin.H{ "status": "ok", "version": h.Version, - }) + } + if hn, err := os.Hostname(); err == nil { + resp["hostname"] = hn + } + if data, err := os.ReadFile("/proc/version"); err == nil { + // /proc/version: "Linux version 6.x.y (...)" — Kurzform: alles + // bis zum ersten '(' kürzen. + line := strings.TrimSpace(string(data)) + if idx := strings.Index(line, " ("); idx > 0 { + line = strings.TrimSpace(line[:idx]) + } + resp["kernel"] = line + } + if data, err := os.ReadFile("/etc/os-release"); err == nil { + for _, line := range strings.Split(string(data), "\n") { + if k, v, ok := strings.Cut(line, "="); ok && k == "PRETTY_NAME" { + resp["os"] = strings.Trim(v, `"`) + break + } + } + } + response.OK(c, resp) } // PackageVersions reports installed and available versions for the diff --git a/management-ui/src/i18n/locales/de/common.json b/management-ui/src/i18n/locales/de/common.json index fd8f8b5..0a6d4c6 100644 --- a/management-ui/src/i18n/locales/de/common.json +++ b/management-ui/src/i18n/locales/de/common.json @@ -517,6 +517,9 @@ "systemInfo": "System", "version": "Version", "status": "Status", + "hostname": "Hostname", + "os": "Betriebssystem", + "kernel": "Kernel", "dbSize": "PostgreSQL-DB-Größe", "dbSizeTop": "Top-Tabellen", "upgradeStatusCardTitle": "Letzter Update-Versuch", diff --git a/management-ui/src/i18n/locales/en/common.json b/management-ui/src/i18n/locales/en/common.json index bb66194..a96c676 100644 --- a/management-ui/src/i18n/locales/en/common.json +++ b/management-ui/src/i18n/locales/en/common.json @@ -517,6 +517,9 @@ "systemInfo": "System", "version": "Version", "status": "Status", + "hostname": "Hostname", + "os": "OS", + "kernel": "Kernel", "dbSize": "PostgreSQL DB size", "dbSizeTop": "Top tables", "upgradeStatusCardTitle": "Last upgrade attempt", diff --git a/management-ui/src/pages/Settings/index.tsx b/management-ui/src/pages/Settings/index.tsx index d9b4cde..4a0c641 100644 --- a/management-ui/src/pages/Settings/index.tsx +++ b/management-ui/src/pages/Settings/index.tsx @@ -23,6 +23,9 @@ interface ContactEmailValues { interface SystemHealth { status: string version: string + hostname?: string + kernel?: string + os?: string } interface ChangePasswordValues { @@ -329,6 +332,9 @@ export default function SettingsPage() { {health?.version ?? '—'} {health?.status ?? '—'} + {health?.hostname && {health.hostname}} + {health?.os && {health.os}} + {health?.kernel && {health.kernel}} {dbSize && (