diff --git a/src/components/ServerDetailChart.tsx b/src/components/ServerDetailChart.tsx index 2a829e4..c22c671 100644 --- a/src/components/ServerDetailChart.tsx +++ b/src/components/ServerDetailChart.tsx @@ -274,6 +274,8 @@ export default function ServerDetailChart({ const gpuStats = server.state.gpu || []; const gpuList = server.host.gpu || []; + // Newer agents also report memory per card, index-aligned with the above. + const gpuDetails = server.state.gpus || []; return (
@@ -298,6 +300,7 @@ export default function ServerDetailChart({ now={nezhaWsData.now} gpuStat={gpuStats[index]} gpuName={gpu} + gpuMemory={gpuDetails[index]} messageHistory={messageHistory} period={selectedPeriod} key={index} @@ -311,6 +314,7 @@ export default function ServerDetailChart({ now={nezhaWsData.now} gpuStat={gpu} gpuName={`#${index + 1}`} + gpuMemory={gpuDetails[index]} messageHistory={messageHistory} period={selectedPeriod} key={index} @@ -426,6 +430,7 @@ function GpuChart({ index, gpuStat, gpuName, + gpuMemory, messageHistory, period, }: { @@ -434,6 +439,7 @@ function GpuChart({ index: number; gpuStat: number; gpuName?: string; + gpuMemory?: { memory_used?: number; memory_total?: number }; messageHistory: NezhaWebsocketResponse[]; period: ChartPeriod; }) { @@ -532,6 +538,14 @@ function GpuChart({
{!gpuName &&

GPU

} {gpuName &&

GPU: {gpuName}

} + {gpuMemory?.memory_total ? ( +

+ {gpuMemory.memory_used != null + ? formatBytes(gpuMemory.memory_used * 1024 * 1024) + : "—"}{" "} + / {formatBytes(gpuMemory.memory_total * 1024 * 1024)} +

+ ) : null}

diff --git a/src/types/nezha-api.ts b/src/types/nezha-api.ts index 7431130..4f8f6f8 100644 --- a/src/types/nezha-api.ts +++ b/src/types/nezha-api.ts @@ -45,6 +45,12 @@ export interface NezhaServerStatus { process_count: number; temperatures: temperature[]; gpu: number[]; + // Per-card figures; index-aligned with host.gpu. Absent on older agents. + gpus?: { + utilization: number; + memory_used?: number; + memory_total?: number; + }[]; } interface temperature {