feat(ux): Hostname in Sidebar + CPU-Anzahl neben Load Average

- Sidebar: Hostname unter der Versionsnummer (aus /system/health);
  10px, gedimmt — beim Verwalten mehrerer Boxen sofort erkennbar
- /system/resources: neues Feld num_cpus (via runtime.NumCPU)
- Dashboard Resources-Card: Load-Average-Label zeigt "(N CPU)" —
  1.80 auf 1 CPU ist saturiert, auf 4 CPUs ist es harmlos

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-25 09:49:15 +02:00
parent c99b0cef4c
commit 757b58f607
7 changed files with 25 additions and 9 deletions

View File

@@ -8,6 +8,7 @@ import (
"net/http"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"syscall"
@@ -211,6 +212,7 @@ type resources struct {
LoadAvg1 float64 `json:"load_avg_1"`
LoadAvg5 float64 `json:"load_avg_5"`
LoadAvg15 float64 `json:"load_avg_15"`
NumCPUs int `json:"num_cpus"`
MemTotalKB int64 `json:"mem_total_kb"`
MemAvailKB int64 `json:"mem_avail_kb"`
MemUsedPct float64 `json:"mem_used_pct"`
@@ -234,7 +236,7 @@ func (h *SystemHandler) Resources(c *gin.Context) {
// gin.Context erstellen kann. Best-effort: fehlende Quellen lassen
// die jeweiligen Felder einfach auf 0.
func computeLocalSystemResources() resources {
r := resources{}
r := resources{NumCPUs: runtime.NumCPU()}
if data, err := os.ReadFile("/proc/loadavg"); err == nil {
f := strings.Fields(string(data))
if len(f) >= 3 {