diff --git a/agent-linux/collector/pbs.go b/agent-linux/collector/pbs.go index 865c79e..ff028c5 100644 --- a/agent-linux/collector/pbs.go +++ b/agent-linux/collector/pbs.go @@ -37,6 +37,7 @@ type PBSTask struct { Duration int64 `json:"duration,omitempty"` User string `json:"user,omitempty"` Datastore string `json:"datastore,omitempty"` + Running bool `json:"running,omitempty"` } type PBSGCStatus struct { @@ -90,10 +91,28 @@ func CollectPBS() *PBSInfo { if avail, ok := d["avail"].(float64); ok { ds.Available = int64(avail) } - // Backup-Anzahl: alle Timestamp-Verzeichnisse zaehlen - // Struktur: /// oder /ns//// - // Timestamp-Format: 2026-02-18T18:24:36Z + // Disk-Auslastung via df if ds.Path != "" { + dfCmd := exec.Command("/bin/df", "-B1", "--output=size,used,avail", ds.Path) + if out, err := dfCmd.Output(); err == nil { + lines := strings.Split(strings.TrimSpace(string(out)), "\n") + if len(lines) >= 2 { + fields := strings.Fields(lines[1]) + if len(fields) >= 3 { + if v, err := strconv.ParseInt(fields[0], 10, 64); err == nil { + ds.Total = v + } + if v, err := strconv.ParseInt(fields[1], 10, 64); err == nil { + ds.Used = v + } + if v, err := strconv.ParseInt(fields[2], 10, 64); err == nil { + ds.Available = v + } + } + } + } + + // Backup-Anzahl: alle Timestamp-Verzeichnisse zaehlen countCmd := exec.Command("/bin/sh", "-c", `find `+ds.Path+` -type d 2>/dev/null | grep -cE '/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$'`) if out, err := countCmd.Output(); err == nil { @@ -131,11 +150,14 @@ func CollectPBS() *PBSInfo { if start, ok := t["starttime"].(float64); ok { task.StartTime = int64(start) } - if end, ok := t["endtime"].(float64); ok { + if end, ok := t["endtime"].(float64); ok && end > 0 { task.EndTime = int64(end) if task.StartTime > 0 { task.Duration = task.EndTime - task.StartTime } + } else { + task.Running = true + task.Status = "running" } if user, ok := t["user"].(string); ok { task.User = user diff --git a/frontend/src/components/ProxmoxPanel.jsx b/frontend/src/components/ProxmoxPanel.jsx index b1251d1..35e19da 100644 --- a/frontend/src/components/ProxmoxPanel.jsx +++ b/frontend/src/components/ProxmoxPanel.jsx @@ -1003,12 +1003,12 @@ function PBSTab({ pbs, agentId, sys }) { } const totalBackups = pbs.datastores?.reduce((s, d) => s + (d.backup_count || 0), 0) || 0 - const kernel = sys?.opnsense_version || '—' + const runningTasks = pbs.tasks?.filter(t => t.running)?.length || 0 - const StatCard = ({ icon, value, label, iconColor }) => ( -
-
{icon}
-
{value}
+ const StatCard = ({ icon, value, label, iconColor, highlight }) => ( +
+
{icon}
+
{value}
{label}
) @@ -1022,30 +1022,31 @@ function PBSTab({ pbs, agentId, sys }) {
{/* Stat-Karten */} -
+
} + icon={} value={pbs.datastores?.length || 0} label="Datastores" iconColor="text-orange-400" /> } + icon={} value={totalBackups} label="Backups" iconColor="text-blue-400" /> } + icon={} value={pbs.sync_jobs ?? 0} label="Sync Jobs" iconColor="text-green-400" /> } - value={kernel !== '—' ? kernel.split('-')[0] : '—'} - label="Kernel" - iconColor="text-orange-400" + icon={} + value={runningTasks > 0 ? runningTasks : '—'} + label="Laufend" + iconColor={runningTasks > 0 ? "text-blue-400" : "text-gray-600"} + highlight={runningTasks > 0} />
@@ -1125,10 +1126,13 @@ function PBSTab({ pbs, agentId, sys }) { {pbs.tasks.map((t, i) => ( - - {t.type || '—'} + + + {t.type || '—'} + {t.running && RUNNING} + {formatTs(t.start_time)} - {formatDuration(t.duration)} + {t.running ? läuft... : formatDuration(t.duration)} {t.status || '—'} ))}