소스 수정

This commit is contained in:
2025-12-28 18:24:58 +09:00
parent e49c962cee
commit 240e096bd8
3 changed files with 98 additions and 11 deletions

View File

@@ -176,16 +176,19 @@ async function getServerDashboard() {
for (const server of servers) {
// 최신 스냅샷
const snapshot = await queryOne(`
SELECT cpu_percent, memory_percent, collected_at
SELECT cpu_percent, memory_percent, memory_total, memory_free, memory_used,
cpu_temp, load_percent, uptime_str, collected_at
FROM server_snapshots
WHERE target_id = $1 AND is_online = 1
ORDER BY collected_at DESC
LIMIT 1
`, [server.target_id])
// 최신 디스크 사용률 (최대값)
// 최신 디스크 사용률 (최대값) + 용량
const diskData = await queryOne(`
SELECT MAX(disk_percent) as disk_percent
SELECT MAX(disk_percent) as disk_percent,
SUM(disk_used) as disk_used,
SUM(disk_total) as disk_total
FROM server_disks
WHERE target_id = $1
AND collected_at = (SELECT MAX(collected_at) FROM server_disks WHERE target_id = $1)
@@ -291,8 +294,16 @@ async function getServerDashboard() {
cpu_level: cpuLevel,
memory_percent: snapshot?.memory_percent ?? null,
memory_level: memLevel,
memory_total: snapshot?.memory_total ?? null,
memory_free: snapshot?.memory_free ?? null,
memory_used: snapshot?.memory_used ?? null,
disk_percent: diskData?.disk_percent ?? null,
disk_level: diskLevel,
disk_used: diskData?.disk_used ?? null,
disk_total: diskData?.disk_total ?? null,
cpu_temp: snapshot?.cpu_temp ?? null,
load_percent: snapshot?.load_percent ?? null,
uptime_str: snapshot?.uptime_str ?? null,
last_collected: lastCollected,
containers: containers,
container_summary: containerSummary